1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
tween(variable, value, time*, tweentype*, donecall*, updatecall*) tween可以用于由指定时间过渡的动态效果过渡,可以用于演示渐变、元素动画形式移动等. 参数: •variable ◦渐变效果的目标变量,一般为某个元素的属性. ◦可以使用 | 符合分隔,同时设置多个变量. •value ◦变量最终到达的目标变量值. ◦如果源变量的值是百分比,目标值也需要加%符号,例如width的百分比. ◦可以使用 | 符合分隔,同时设置多个目标变量. ◦注意 - 目标变量值是从一个变量获取时,需要先用get获取变量的值. •time (可选) ◦渐变过程所需的时间 (默认不填,则0.5秒). •tweentype (可选) ◦渐变的类型(easeOutQuad为默认). ◦看更多的类型: 下文tweentypes. 以下列出全部支持的渐变类型. Linear Ease: •linear(均速线性) Ease Out: •easeOutQuad •easeOutQuart •easeOutQuint •easeOutSine •easeOutBounce •easeOutCirc •easeOutCubic •easeOutExpo •easeOutBack Ease In: •easeInQuad •easeInQuart •easeInQuint •easeInSine •easeInBounce •easeInCirc •easeInCubic •easeInExpo •easeInBack Ease Out and In: •easeOutInQuad •easeOutInQuart * •easeOutInQuint * •easeOutInSine * •easeOutInBounce * •easeOutInCirc * •easeOutInCubic * •easeOutInExpo * Ease In and Out: •easeInOutQuad * •easeInOutQuart * •easeInOutQuint * •easeInOutSine * •easeInOutBounce * •easeInOutCirc * •easeInOutCubic * •easeInOutExpo * •donecall (可选) ◦渐变过程完成后执行的动作. •updatecall (可选) ◦当每帧刷新时执行的动作,这个要慎用,不然刷新台频繁会crash哦。 样例: tween(scale,2); tween(rotate,90); tween(width,50%); onover="tween(alpha,0.7,distance(0.3,0.2));" onout="tween(alpha,1.0,distance(0.3,0.2));" set(alpha,0); set(visible,true); tween(alpha, 1.0 ,0.3); tween(layer[logo].width, get(destwidth)); set(layer[image].enabled,false); tween(layer[image].alpha,0.0,0.5,default,removeplugin(image)); set(view.stereographic,true); tween(view.vlookat, 90.0, 2.0); tween(view.fisheye, 1.0, 2.0); tween(view.fov, 150.0, 2.0); |
领主提醒:tween可以控制渐变和动画等多种效果,进阶必修!