简体   繁体   English

捕捉SVG路径动画

[英]Snap SVG path animation

I'm getting to grips with Snap SVG and have a path animation almost how I want it with the help of tutorials. 我将开始学习Snap SVG,并在教程的帮助下制作几乎我想要的路径动画。 How do I: 我如何:

a.) Incorporate scale into the animation? a。)将比例尺加入动画中吗? add something like s0.7 to the transform: 将类似s0.7的内容添加到转换中:

 planeGroup.transform( 't' + parseInt(movePoint.x - 40) + ',' + parseInt( movePoint.y - 200) + 'r' + (movePoint.alpha - 180) + s0.7);

...it breaks it. ...它打破了。 I want the plane to start at original scale and then get smaller over the duration of the animation. 我希望飞机以原始比例开始,然后在动画过程中逐渐变小。

b.) Get the plane positioned so it matches its trail(path) ie the trail appears to come from the plane? b。)确定飞机的位置,使其与其轨迹(路径)匹配,即轨迹似乎来自飞机吗?

https://jsfiddle.net/d0L8fbux/2/ https://jsfiddle.net/d0L8fbux/2/

Thanks in advance. 提前致谢。

Its just a case of fiddling about to figure out where the rotation point of the image needs to be. 只是想弄清楚图像的旋转点在哪里的一种情况。 So does it need to rotate on its centre, tail or front, and the x and y offets depending on the image visual centre to line up at the end of the path. 它也需要在其中心,尾部或前面旋转,并且x和y偏移取决于图像视觉中心以在路径的末端对齐。 It can be a bit fiddly to line up though. 排队可能有点麻烦。

So I have added a centre of rotation on the plane 所以我在飞机上增加了旋转中心

'r' + (movePoint.alpha - 180) + ',80,80'

Thats just a bit of guesswork without really knowing the image. 只是有点猜测而没有真正了解图像。

Scale can just have 's0.7' added to the end. Scale可以在末尾添加“ s0.7”。 So transform would look like this... 所以转换看起来像这样...

planeGroup.transform( 't' + parseInt(movePoint.x-80) + ',' + parseInt( movePoint.y-80) + 'r' + (movePoint.alpha - 180) + ',80,80s0.5');

jsfiddle 的jsfiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM