【发布时间】:2016-01-25 10:05:09
【问题描述】:
我正在使用 scrollmagic 和 GSAP 制作一个小型交互式网站来为 SVG 元素设置动画。
但是,当为具有 rotate() 变换的元素的 y 值设置动画时,该变换被移除。
将旋转添加到动画中并没有产生正确的结果;旋转已从动画中移除,然后再次动画化。
有谁知道在 GSAP 中为其他属性设置动画时如何保持 SVG 元素的旋转?
示例代码:
html:
<svg height='300px' width='500px' style='position: absolute;'>
<rect id='rect' width='200' height='75' style='fill:#888;stroke-width:2;stroke:#000' y='0' x='120' transform='rotate(45)' />
</svg>
js:
TweenMax.to('#rect', 1, {x: 100})
【问题讨论】:
-
你能准备一把小提琴吗?
-
已添加小提琴
标签: javascript animation svg gsap