简体   繁体   English

使用snap.svg沿svg路径对对象进行动画处理和定向

[英]Animate & orientate object along svg path using snap.svg

I have an animated SVG path I can attach a polyline to the end of the path which works (commented out in the codepen) but when I attach a custom path the Matrix coordinates disappear below the page. 我有一个动画的SVG路径,我可以在工作的路径的末尾附加一条折线(在Codepen中注释),但是当我附加自定义路径时,矩阵坐标会在页面下方消失。

You can see this in chrome dev tools if you inspect the bottom blue dot and below that there is a 如果您检查底部的蓝色圆点,并且在下面的蓝色圆点下方,则可以在chrome开发工具中看到这一点
g transform="matrix(0.8351,0.5501 g transform =“ matrix(0.8351,0.5501
If you swap the first coordinates out with 'M246' the feet element will appear (at the end of the animation). 如果将第一个坐标替换为'M246',则会出现foot元素(在动画的结尾)。 So everthing is working apart from the coordinate mapping is off 所以一切都在工作,除了坐标映射已关闭

Does anyone have any suggestions, thanks in advance Michael 有人有任何建议吗,谢谢迈克尔

**Code Pen** http://codepen.io/michaelcockle/pen/eBCAv?editors=001 **代码笔** http://codepen.io/michaelcockle/pen/eBCAv?editors=001

Think you've already spotted an answer, but you need to account for the transform baked into the path itself, so 认为您已经找到答案了,但是您需要考虑到转换到路径本身中的转换,所以

meFeet.transform( 't' + parseInt(movePoint.x - 260) + ',' + parseInt( movePoint.y - 1750) + 'r' + (movePoint.alpha - 90));

example here 这里的例子

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

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