AttrPlugin文档

优质
小牛编辑
126浏览
2023-12-01

TweenMax包含了AttrPlugin。

动画DOM元素的任何attr数字属性,例如你的DOM元素如下

<rect fill="none" height="400" id="rect" width="50%" x="0" y="0"></rect>

使用AttrPlugin的attr:{}对元素的 "x", "y", "width", "height"属性进行动画。

TweenLite.to("#rect", 1, {attr:{x:100, y:50, width:100%, height:100}, ease:Linear.easeNone});

AttrPlugin一般不处理与CSS相关的属性,因为CSSPlugin已经处理了这些。


  
TweenMax.to("#path", 1, {attr:{d:"M100,0 C20,100, 180,100, 100,200"}, repeat:-1, 
yoyo:true, ease: Elastic.easeInOut})
重播