Animation元件的屬性和方法介紹

2021-09-21 17:25:54 字數 2888 閱讀 1560

// animation

animation.addclip(new animationclip(), "newanimname");

animation.addclip(new animationclip(), "newanimname", 1/*首幀*/, 2/*尾幀*/);

animation.addclip(new animationclip(), "newanimname", 1, 2, true/*是否應該在最後插入乙個額外的幀匹配第一幀?如果你在製作乙個迴圈的動畫,那麼可以開啟這個選項*/);

animation.clip = null; // 預設動畫

// 淡入淡出

animation.crossfade("animname");

animation.crossfade("animname", 1f/*混合時長*/);

animation.crossfade("animname", 1f, playmode.stopsamelayer/*停止相同動畫層級的動畫*/);

animation.crossfadequeued("animname");

animation.crossfadequeued("animname", 1f/*混合時長*/);

animation.crossfadequeued("animname", 1f, queuemode.completeothers/*等待其它動畫停止後淡入淡出*/);

animation.crossfadequeued("animname", 1f, queuemode.completeothers, playmode.stopsamelayer/*停止相同動畫層級的動畫*/);

animation.crossfadequeued("animname", 1f, queuemode.playnow, playmode.stopall);

animation.crossfadequeued("animname", 1f, queuemode.playnow, playmode.stopsamelayer);

animation.enabled = false;

animation.getclip("animname");

animation.getclipcount();

animation.isplaying("animname");

bool bisplaying = animation.isplaying;

bounds bounds = animation.localbounds;

animation.play("animname");

animation.play("animname", playmode.stopall/*停止其它*/);

animation.play("animname", playmode.stopsamelayer/*停止相同動畫層級的動畫*/);

animation.playqueued("animname");

animation.playqueued("animname", queuemode.completeothers/*等待其它動畫停止後淡入淡出*/);

animation.removeclip("animname");

animation.rewind(); // 倒播所有動畫

animation.rewind("animname"); // 倒播名為name的動畫

animation.wrapmode = wrapmode.clamp;/*停在尾幀*/

animation.wrapmode = wrapmode.default/*從動畫剪輯中讀取迴圈模式(預設是once)*/;

animation.wrapmode = wrapmode.once/*播完停止*/;

animationstate myanimationstate = animation["animname"];

animationclip myanimationclip = animationstate.clip;

animationclip myanimationclip2 = animation.getclip("animname");

animationstate.addmixingtransform(transform, true/*是否影響子節點*/);

animationstate.removemixingtransform(transform);

animationstate.blendmode = animationblendmode.additive; // 疊加混合

animationstate.blendmode = animationblendmode.blend; // 混合

animationstate.enabled = false;

animationstate.layer = 1; // 動畫層級高代表權重高

float flength = animationstate.length; // 時長(秒)

animationstate.name = "animstatename";

animationstate.normalizedtime = 1f; // 把時間標準化為0f ~ 1f

animationstate.speed = 1f;

animationstate.time = 1f; // 當前時間

animationstate.weight = 1f; // 權重

// 結束方式

animationstate.wrapmode = wrapmode.clamp;/*停在尾幀*/

animationstate.wrapmode = wrapmode.default;/*從動畫剪輯中讀取迴圈模式(預設是once)*/

animationstate.wrapmode = wrapmode.once;/*播完停止*/

animation的屬性值

animation在不需要觸發任何事件的情況下也可以隨著時間變化來改變元素css的屬性值,從而達到一種動畫的效果.實現動畫需要給其新增屬性值 1 animation name 動畫名稱 指定要繫結到選擇器的關鍵幀的名稱。必須與規則 keyframes 關鍵幀 配合使用,這個不用多說 name值自己設...

animation的屬性值

在逆戰班學習的第4周 animation的屬性值 1 animation name 檢索或設定物件所應用的動畫名稱 必須與規則 keyframes配合使用,eg keyframes mymove animation name mymove 2 animation duration 檢索或設定物件動畫...

用animation的steps屬性製作幀動畫

臥槽真是個神奇的ui boy。於是我順著他的思路,用上了animation在timing function中的steps屬性。先來看看ui給的圖吧,是這樣的 注 寬度1200px x,y正數值越大,背景圖越向右下角偏移。所以動畫的 如下 但是這都不是我們需要的效果,因為幀動畫的關鍵在於 瞬變 在an...