如何使用TweenMax(Greensock)水平翻转SVG?

时间:2015-12-02 04:21:29

标签: javascript svg css-transforms greensock tweenmax

我正在尝试使用Greensock做一些动画,其余的都没问题,除了我不知道如何以我喜欢的方式翻转SVG。

我这样做了代码:

.to($tri_yellowgreen, 0.25, {rotationY:180, transformOrigin:"left top"})

..但箭头移动到底部而不是在同一位置翻转。

CODEPEN DEMO: http://codepen.io/anon/pen/eJOBma

我想离开这个:

enter image description here

......对此(黄绿色箭头翻转):

enter image description here

1 个答案:

答案 0 :(得分:1)

我认为解决方案可以取代这个:

.to($tri_yellowgreen, 0.25, {rotationY:180, transformOrigin:"left top"})

与此:

.fromTo($tri_yellowgreen, 0.25, {transformOrigin:'right top'}, {rotationY: 180})

基本上,必须在补间开始之前应用transformOrigin,因此使用 .fromTo() 方法而不是.to()来电。