Tag Archive for tween

Tweener add Tween Caurina AS3

Tweener.addTween(this.____,{alpha:1,time:1,transition:"easeInOutQuad"});

source

Tween Alpha MovieClips

MovieClip.prototype.incAlpha = function(time){
var myClip = this;
var myTween:Tween = new Tween(myClip, "_alpha", mx.transitions.easing.Regular.easeOut, 0, 100, time, false);
myTween.onMotionFinished = function(){myClip._visible=true;}
};

MovieClip.prototype.decAlpha = function(time){
var myClip2 = this;
var myTween:Tween = new Tween(myClip2, "_alpha", mx.transitions.easing.Regular.easeOut, 100, 0, time, false);
myTween.onMotionFinished = function(){myClip2._visible=false;}
};

source

AS2 Basic Steam Particles; requires MC Tween

// This script requires a movieclip in the library exported for actionscript as "particle_mc"

#include "mc_tween2.as" // from <a href="http://hosted.zeh.com.br/mctween/" >http://hosted.zeh.com.br/mctween/</a>

var speed:Number = 1.2; // speed at which each particle rises per cycle
var lifespan:Number = 4000; // in milliseconds
var particleCount:Number = 30; // the system starts slowing down at/above 50.  This is just a quick & easy particle system, and AS2 isn't the best for particles, either.
var alphaInitial:Number = 80; // what alpha level each particle is set to upon spawning
var fadeRate:Number = .2; // how much per cycle each particle's alpha drops
var spawnMovieClip:MovieClip; // set this to a movieclip if you want to attach the steam to something
if(spawnMovieClip != undefined) {
var spawnX:Number = spawnMovieClip._x;
var spawnY:Number = spawnMovieClip._y;
} else {
var spawnX:Number = Stage.width/2;
var spawnY:Number = Stage.height/2;
}

var wandering:Array = Array(particleCount); // this is a per-particle left-right direction, so that the horizontal movement of each particle is less jumpy

var merging:Number = 0; // Don't change this.  An incrementing value.
var mergingLoop:Number = 1000; // length of merge cycle
var mergingThreshold:Number = 500; // change this to set the frequency of the tendency for particles to group together.  Higher is more frequent, Lower is less.

this.onEnterFrame = function() {
for(intI = 0; intI < particleCount; intI++) {
if(this["steam" + intI + "_mc"] == undefined) { // this happens once for each particle
this.attachMovie("particle_mc", "steam" + intI + "_mc", this.getNextHighestDepth(), {_x:-500, _y:-500, _alpha:0});
if(spawnMovieClip != undefined) this["steam" + intI + "_mc"].swapDepths(spawnMovieClip); // slips each particle underneath the attach object, if defined.
var timeout:Number = setTimeout(spawnSteam, randRange(.25*lifespan,.75*lifespan), this["steam" + intI + "_mc"]); // "spawning" each particle really only resets its default properties, so that we can just recyle the movieclips
wandering[intI] = 0;
}

merging++;
if (merging == mergingLoop) merging = 0;

wandering[intI] += randRange(-100,100)/100;

if (merging < mergingThreshold) {
var thisX:Number = this["steam" + intI + "_mc"]._x;
var prevX:Number = this["steam" + (intI-1) + "_mc"]._x;
var Dif:Number = thisX - prevX;

if (Dif > 0) { // if we're currently to the right of the previous particle
if (thisX - prevX > 10) { // if the difference is more than 10 pixels
wandering[intI] = -1; // set the current particle's direction to move left
}
} else {
if (prevX - thisX > 10) {
wandering[intI] = 1;
}
}
}

// limit each particles horizontal movement to no more than one pixel per cycle
if(wandering[intI] < -1) {wandering[intI] = -1};
if(wandering[intI] > 1) {wandering[intI] = 1};

// apply the changes to each particle
this["steam" + intI + "_mc"]._x += wandering[intI];//randRange(-2*speed,2*speed);
this["steam" + intI + "_mc"]._y -= speed;
this["steam" + intI + "_mc"]._alpha -= fadeRate + randRange(2*fadeRate,4*fadeRate);
this["steam" + intI + "_mc"]._rotation += (randRange(-150,150)/300);

}
}

function spawnSteam (which_mc:MovieClip) {
which_mc.scaleTo(randRange(20,50));
which_mc.blurTo(10);
which_mc._x = spawnX;// + 80 + randRange(20,40); // remove tweaking or change it if you want to adjust where in relation to the attach object you want each particle to spawn
which_mc._y = spawnY;// + 140 + randRange(-5,5); // remove tweaking or change it if you want to adjust where in relation to the attach object you want each particle to spawn
which_mc.alphaTo(alphaInitial, .25);
var timeout:Number = setTimeout(spawnSteam, lifespan+randRange(-.5*lifespan,.5*lifespan), which_mc);
}

function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

stop();

source

AS2 Tween Fuse _widthなどを個別にtweenさせる

/*_root にムービークリップ(インスタンス名: frog) を配置。
frog には、ムービークリップ(インスタンス名: base, shade) を配置。*/
/*brightOffsetTo(), slideTo() を同時に実行するスクリプトを
tween(), ZigoEngine.doTween() を用いて、書き換えてみた。*/

// brightOffsetTo
frog.base._brightOffset = -100;
frog.base.brightOffsetTo(0, 1, "linear", 0.5);
// slideTo
frog.slideTo("-200", "-20", 1, "easeOutQuad", 0.5);

// tween (1)
frog.base._brightOffset = -100;
frog.base.tween("_brightOffset", 0, 1, "linear", 0.5);
frog.tween("_x", "-200", 1, "easeOutQuad", 0.5);
frog.tween("_y", "-20", 1, "easeOutQuad", 0.5);

// tween (2)
frog.base._brightOffset = -100;
frog.base.tween("_brightOffset", 0, 1, "linear", 0.5);
frog.tween("_x, _y", ["-200", "-20"], 1, "easeOutQuad", 0.5);

// doTween (1)
frog.base._brightOffset = -100;
ZigoEngine.doTween(frog.base, "_brightOffset", 0, 1, "linear", 0.5);
ZigoEngine.doTween(frog, "_x,", "-200", 1, "easeOutQuad", 0.5);
ZigoEngine.doTween(frog, "_y", "-20", 1, "easeOutQuad", 0.5);

// doTween (2)
frog.base._brightOffset = -100;
ZigoEngine.doTween(frog.base, "_brightOffset", 0, 1, "linear", 0.5);
ZigoEngine.doTween(frog, "_x, _y", ["-200", "-20"], 1, "easeOutQuad", 0.5);

// ----------------------------------------------------------
/*Blur_blurTo(), scaleTo(),bezierTo() を同時に実行するスクリプトを
tween(), ZigoEngine.doTween() を用いて、書き換えてみた。*/

// Blur_blurTo
frog.Blur_quality = 3;
frog.Blur_blurTo(4, 1, "easeInOutQuad", 0.5);
// scale/bezierTo
frog.scaleTo(90, 1, "easeInOutQuad", 0.5);
frog.bezierTo("-200", "-20", "-150", "20", 1, "easeInOutQuad", 0.5);

// tween (1)
frog.Blur_quality = 3;
frog.tween("Blur_blur", 4, 1, "easeInOutQuad", 0.5);
frog.tween("_scale", 90, 1, "easeInOutQuad", 0.5);
frog.tween("_bezier_", {x: "-200", y: "-20", controlX: "-150", controlY: "20"}, 1, "easeInOutQuad", 0.5);

// tween (2)
frog.Blur_quality = 3;
frog.tween("Blur_blur, _scale, _bezier_", [4, 90, {x: "-200", y: "-20", controlX: "-150", controlY: "20"}], 1, "easeInOutQuad", 0.5);

// doTween (1)
frog.Blur_quality = 3;
ZigoEngine.doTween(frog, "Blur_blur", 4, 1, "easeInOutQuad", 0.5);
ZigoEngine.doTween(frog, "_scale", 90, 1, "easeInOutQuad", 0.5);
ZigoEngine.doTween(frog, "_bezier_", {x: "-200", y: "-20", controlX: "-150", controlY: "20"}, 1, "easeInOutQuad", 0.5);

// doTween (2)
frog.Blur_quality = 3;
ZigoEngine.doTween(frog, "Blur_blur, _scale, _bezier_", [4, 90, {x: "-200", y: "-20", controlX: "-150", controlY: "20"}], 1, "easeInOutQuad", 0.5);

// ----------------------------------------------------------
/*Blur_blurTo(), scaleTo(),bezierTo() を同時に実行するスクリプトを
tween(), ZigoEngine.doTween() を用いて、書き換えてみた。*/

// Blur_blurTo
frog1.Blur_quality = 3;
frog1.Blur_blurTo(4, 1, "easeInOutQuad", 0.5);
frog2.Blur_quality = 3;
frog2.Blur_blurTo(4, 1, "easeInOutQuad", 0.5);
// scale/bezierTo
frog1.scaleTo(90, 1, "easeInOutQuad", 0.5);
frog1.bezierTo("-150", "-20", "-100", "20", 1, "easeInOutQuad", 0.5);
frog2.scaleTo(90, 1, "easeInOutQuad", 0.5);
frog2.bezierTo("-150", "-20", "-100", "20", 1, "easeInOutQuad", 0.5);

// tween (1)
frog1.Blur_quality = 3;
frog1.tween("Blur_blur", 4, 1, "easeInOutQuad", 0.5);
frog1.tween("_scale", 90, 1, "easeInOutQuad", 0.5);
frog1.tween("_bezier_", {x: "-150", y: "-20", controlX: "-100", controlY: "20"}, 1, "easeInOutQuad", 0.5);
frog2.Blur_quality = 3;
frog2.tween("Blur_blur", 4, 1, "easeInOutQuad", 0.5);
frog2.tween("_scale", 90, 1, "easeInOutQuad", 0.5);
frog2.tween("_bezier_", {x: "-150", y: "-20", controlX: "-100", controlY: "20"}, 1, "easeInOutQuad", 0.5);

// tween (2)
frog1.Blur_quality = 3;
frog1.tween("Blur_blur, _scale, _bezier_", [4, 90, {x: "-150", y: "-20", controlX: "-100", controlY: "20"}], 1, "easeInOutQuad", 0.5);
frog2.Blur_quality = 3;
frog2.tween("Blur_blur, _scale, _bezier_", [4, 90, {x: "-150", y: "-20", controlX: "-100", controlY: "20"}], 1, "easeInOutQuad", 0.5);

// doTween (1)
frog1.Blur_quality = 3;
ZigoEngine.doTween(frog1, "Blur_blur, _scale, _bezier_", [4, 90, {x: "-150", y: "-20", controlX: "-100", controlY: "20"}], 1, "easeInOutQuad", 0.5);
frog2.Blur_quality = 3;
ZigoEngine.doTween(frog2, "Blur_blur, _scale, _bezier_", [4, 90, {x: "-150", y: "-20", controlX: "-100", controlY: "20"}], 1, "easeInOutQuad", 0.5);

// doTween (2)
frog1.Blur_quality = 3;
frog2.Blur_quality = 3;
ZigoEngine.doTween([frog1, frog2], "Blur_blur, _scale, _bezier_", [4, 90, {x: "-150", y: "-20", controlX: "-100", controlY: "20"}], 1, "easeInOutQuad", 0.5);

source

Tweener remove tweens

Tweener.removeTweens(child);

source

Tweener

Tweener.addTween(thumb, {alpha:1, time:1, transition:"easeOutQuad"});

source

tweener

Tweener.addTween(mc, {alpha:0, x:20, y:20, time:0.3, delay:0.3, transition:"easeinBack"});

source

Caurina Tween Syntax

import caurina.transitions.*;

Tweener.addTween(b1, {scaleX:1.7, scaleY:1.7, time:1, transition:"easeoutelastic"});

source

AS2 Fuse ZigoEngine.doShortcuts リファレンス 複数のターゲットにtween doTweenの簡略版

stop();
import com.mosesSupposes.fuse.*;
ZigoEngine.register(Shortcuts, PennerEasing);

// 3つのプロパティをトゥイーンします。yが相対移動指定(string)になっている事にもご注意ください。
ZigoEngine.doShortcut(box1_mc, 'slideTo', 100, "150", 1, "easeInOutQuint");

// 相対位置を使って、ベジェ曲線に沿って移動
ZigoEngine.doShortcut(box2_mc, 'bezierTo', '400','-100','300','150', 1, "easeOutBounce", .5);

/*
このサンプルについて

ZigoEngineのstatic(クラス)メソッドであるdoTweenを使えば、
複数のターゲットの複数のプロパティをトゥイーンさせることができます。

doShortcutはdoTweenの代替として使用でき、使いやすいショートカット用の記述ができます。

* このメソッドを使うには(3行目のように)Shotcutsクラスを登録しておいてください *

1つ目のパラメーターで、1つ或は複数個のターゲットを指定できます:
my_mc
my_txt
my_btn
my_obj
[my_mc1, my_mc2, my_mc3]

2つ目のパラメーターでは"alphaTo"といったショートカット名を指定します

以降のパラメーターはショートカット名によって、とる値が変わってきます

各トゥイーンがとる標準パラメーターの詳細はdoTweenに関するファイルをご覧下さい。
*/

/*MEMO by tera(2006.11.19)---------------------------------------- <a href="http://www.trick7.com" >http://www.trick7.com</a>
コールバックでいろいろな指定ができます。リスナーのように、他のオブジェクトに知らせる必要がない、クリップ内で完結するようなコールバックは、
このサンプルのようにパラメーターとして渡してやる方が手軽に使えます。
*/

source

AS2 ZigoEngine.doTween リファレンス プロパティと使い方

stop();
import com.mosesSupposes.fuse.*;
import mx.transitions.easing.*;

// 3つのプロパティをトゥイーンし、終了時にコールバックを実行します。yが相対移動指定(string)になっている事にもご注意ください。
ZigoEngine.doTween(box1_mc, '_x,_y,_brightOffset', [100,"150",100], 1, Strong.easeInOut, 2,
{scope:this,func:'trace',args:'移動完了!'});

// このタイムラインのフレームをトゥイーンさせます
ZigoEngine.doTween(this, '_frame', 40, 2, Bounce.easeOut);

// 相対位置を使って、ベジェ曲線に沿って移動
ZigoEngine.doTween(box2_mc, '_bezier_', { x:'400', controlY:'150' }, 1, Regular.easeInOut, 1);

/*
パラメーターの説明

ZigoEngineのstatic(クラス)メソッドであるdoTweenを使えば、
複数のターゲットの複数のプロパティをトゥイーンさせることができます。

public static function doTween(targets:Object,
props:Object,
endvals:Object,
seconds:Number,
ease:Object,
delay:Number,
callback:Object):String

追加サンプルと情報

* @param targets		オブジェクトや、複数オブジェクトを格納した配列に対してトゥイーン設定できます
my_mc
my_txt
my_btn
my_obj
[my_mc1, my_mc2, my_mc3]

* @param props			プロパティや、複数プロパティを格納した配列に対してトゥイーン設定できます
"_x"
"_x,_y,_brightness"
["_x","_y","_brightness"]

ZigoEngineは追加プロパティに対してもトゥイーンできます:

_brightness		明度(-100 から 100, 0の時がノーマルです)
_brightOffset	明るさのオフセット(-100 から 100, 0の時がノーマルです)
_contrast		コントラスト(0 から 200+, 100の時がノーマルです)
_tint			色合い(0xFF33FF, "0xFF33FF", "#FF33FF", "FF33FF"のようなhex値をとります。ショートカットプロパティで、人が読みやすい"0xFF33FF"といったhexストリング値を返します。Number(my_mc._tint)で、簡単に数値に変換できます。)
_tintPercent	色づき具合(0-100 0の時がノーマルです 100でフル着色です。ターゲットの色が変更されて以降に、アクティブなプロパティとなります。それまではundefinedです。)
_colorReset		カラーリセット(現状の色合いが-100で、100にすると元の色(無着色)に戻ります。 - tintPercentを逆行させるものとお考え下さい。initializeされたターゲットの全ての色変換を削除する時は、my_mc._colorReset=100;とします。)
_invertColor	色反転(写真のネガのような効果です。0-100の値をとり、0がノーマルです)
_size			サイズ(_width と _height を同じ値に設定します。(変換前など)縦横サイズが異なる場合はnullを返します。)
_scale			スケール(_xscale と _yscale を同じ値に設定します。(変換前など)縦横比率が異なる場合はnullを返します。)
_frame			タイムラインのフレーム(MovieClipだけに有効 - 現在のフレームを返します。設定したタイミングでgotoAndStopが実行されます。)
_bezier_		ベジェ({x:,y:,controlX:,controlY:})
_colorTransform	カラートランスフォーム(Flash7のcolorTransformと同様の設定ができます。{ra:,rb:,etc.})

多くの追加プロパティを利用してフィルタをトゥイーンさせる事もできます。
FuseFMPが登録されているとき、次のような感じで利用できます。:
Blur_blurX		(shortened_filter_name + "_" + filterprop)

* @param endvals		目的値や、複数目的値を格納した配列に対してトゥイーン設定できます
125
"125" (引用符で囲まれている値は、現在位置からの相対値として算出されます。)
[125, "100", 85] (例:"_x,_y,_brightness"に対してこのように値を渡せます)
90 ("_x,_y,_brightness"に対してこのような値を渡した時は、全プロパティが90にトゥイーンします。)

* @param seconds		トゥイーンの継続時間
1.5
null (ZigoEngine.DURATIONで設定されたデフォルト値が設定されます。)
0 (0秒でのトゥイーンは
0-second tweens are recommended for setting properties that are
handled by the engine at any time in your program, because they
interrupt any running tween. skipLevelプロパティを使って、
「0秒トゥイーン」や「変化なしトゥイーン」のコールバックを無効にすることができます。下の記述をご覧下さい。)

* @param ease			function, shortcut-string, custom-easing-panel object

空欄だとデフォルト値で実行されます(ZigoEngine.EASINGの部分でデフォルト値を設定しておけます。)

1. Pennerイージングのフォーマットやmx.transitions.easing.Strong.easeOutといった、
あらゆるイージング関数が利用できます。

2. 以下のようなショートカット指定を使うには、PennerEasingクラスの登録が必要です
"linear",
"easeInQuad","easeOutQuad","easeInOutQuad","easeOutInQuad"
"easeInCubic","easeOutCubic","easeInOutCubic","easeOutInCubic"
"easeInQuart","easeOutQuart","easeInOutQuart","easeOutInQuart"
"easeInQuint","easeOutQuint","easeInOutQuint","easeOutInQuint"
"easeInSine","easeOutSine","easeInOutSine","easeOutInSine"
"easeInExpo","easeOutExpo","easeInOutExpo","easeOutInExpo"
"easeInCirc","easeOutCirc","easeInOutCirc","easeOutInCirc"
"easeInElastic","easeOutElastic","easeInOutElastic","easeOutInElastic"
"easeInBack","easeOutBack","easeInOutBack","easeOutInBack"
"easeInBounce","easeOutBounce","easeInOutBounce""easeOutInBounce"

3. カスタムイージングパネルで生成されたオブジェクト

* @param delay			トゥイーンを実行するまでの待機時間(秒)。以下のような指定が使えます。
1.5
null
0

* @param callback		function, string, objectを指定できます。

1. function
myFunc (スコープを通す必要のない関数)
mx.utils.Delegate.create(myScope, myFunc)

2. String
"myFunc" (スコープを通す必要のない関数)
"trace('done');" (easyfuncストリング指定 - Shortcutsクラスが登録されている必要があります。)

3. Callback Object - いろんなパラメーターを利用できます。:
{ scope:this, func:"trace", args:"トゥイーン完了!" }
{ scope:this, func:"myFunc", args:[1,2,3,true] }

トゥイーン終了時に実行される: func / scope / args
トゥイーン開始時に実行される: startfunc / startscope / startargs
トゥイーン更新時に実行される: updfunc / updscope / updargs

その他の追加パラメーター:
-cycles (0=無限ループ, 1=デフォルト, 2+ = 数値に応じて往復(ヨーヨートゥイーン))
-skipLevel: 0 (デフォルト:トゥイーン時間と待機時間の全てをスケジュール通り実行)
1 (見かけ上変化のないトゥイーン時間と待機時間はスキップ)
2 (見かけ上変化のないトゥイーン時間と待機時間はスキップし、イベントやコールバックも実行しない)
skipLevelに関する詳細は"2d general.fla"をご覧下さい。
-extra1,extra2 (elastic と back easing用の追加パラメーター)

* @return				comma-delimited string of props successfully added
"_x,_y,_brightness"

or pipe-delimited series of such, if multiple targets tweened,
so you can verify each target. 例えば、mc1のalphaが100で、
mc2のalphaが0の状態で、skipLevelが0以上に設定されている時は、最初のトゥイーンはスキップされます:
ZigoEngine.doTween([mc1,mc2],"_alpha,_x",100,1,'',0,{ skipLevel:1 });
returns "_x|_alpha,_x", 第1ターゲット(mc1)では_xのトゥイーンのみが実行されたということになります。

*/

/*MEMO by tera(2006.11.19)---------------------------------------- <a href="http://www.trick7.com" >http://www.trick7.com</a>
doTweenには第7パラメーターまであり、それぞれ上のリストの順に設定していく、
設定しない箇所もカンマで区切っておき、空欄にしておくこと。

トゥイーン時間とリターンの項が訳せませんでした。トゥイーン時間の方は、他のサンプルを見てもらったら、言わんとしていることは理解できるかと思います。
リターンに関しては、どうやって検証したら良いのか分からず、結果翻訳できずです。すみません。

イージングパラメーターの項の「カスタムイージングパネルで生成されたオブジェクト」がなんなのか分かりません。
*/

source