0

私のカウンターは一定の速度で 100 になります。カウンターの速度を上げる方法はありますか?

Flash は三角法の値を使用して速度に影響を与えることができますが、それがタイマー クラスをオンザフライで変更できるかどうかはわかりません。

それにはいくつかの部分があります。
(a.) カウンターの速度を上げる?

(b.) 特定の部分で傾斜?
- 範囲がある
- 90 ~ 100 でランピングが開始される

増分の三角法のいずれかの例が役立ちます

代替テキスト http://www.ashcraftband.com/myspace/videodnd/icon10.jpg

適用したいトリガーの例

var xVel:Number = Math.cos(radians) * speed;
var yVel:Number = Math.sin(radians) * speed;
//-------------------------------------------//
return deg * (Math.PI/180);

ACCELLERATING COUNTER「すべての良い例」

//EVERYONE HELPED "decimals corrected" 
var timer:Timer = new Timer(10);  
var count:int = 0; //start at -1 if you want the first decimal to be 0  
var fcount:int = 0; 

timer.addEventListener(TimerEvent.TIMER, incrementCounter);  
timer.start();  


function incrementCounter(event:TimerEvent) {  
  count++;  
  //
  fcount=int(count*count/10000);//starts out slow... then speeds up 
  //
  var whole_value:int = int(fcount / 100); //change value 
  var tenths:int = int(fcount / 10) % 10;   
  var hundredths:int = int(fcount) % 10; 

「時間を割いて手伝ってくれてありがとう」

4

2 に答える 2

1

TweenLiteなどの多くの ActionScript トゥイーン エンジンの 1 つを使用してみませんか?

補間する変数、最終値、補間の合計時間を指定し、さまざまなイージング関数から選択するだけで、すべての計算を行うことができます。

場合によっては、本当にカスタムなものが必要な場合は、Number 変数を 0 から 1 までトゥイーンし、使用したい期間とイージング関数を使用してから、onUpdate関数を定義してこの値で作業を行うことができます。時間によって補間されます。

于 2010-02-09T22:29:06.177 に答える
0

次のように、カウント変数に数式を適用することで、高速化効果の簡単な概算を得ることができます。

var timer:Timer = new Timer(10); 
var count:int = 0; //start at -1 if you want the first decimal to be 0 
var fcount:int = 0;

timer.addEventListener(TimerEvent.TIMER, incrementCounter); 
timer.start(); 


function incrementCounter(event:TimerEvent) { 
  count++; 
  fcount=int(count*count/10000);//starts out slow... then speeds up 
  var whole_value:int = int(fcount/100); 
  var decimal_value:int = int(fcount/10) % 10;
  var hun_value:int = fcount % 10;
  mytext.text = whole_value + " : " + decimal_value + hun_value; 
} 

つまり、count は定期的に増加しますが、fcount は count の 2 乗に比例して高速化します。

三角関数が必要な場合は試すことができますがfcount=int(acos(count/10000)*10000/(2*Math.PI));、これは count<=10000 でしか機能しません。

于 2010-02-09T23:21:53.913 に答える