javascript - 沿路径为足迹设置动画
问题描述
我从这支有动画脚印的笔中获得灵感。我的问题是如何将它与给定的轨迹结合起来,以便脚印只会跟随路径?我的路径将是这样的:
<svg id="svg" width="800" height="800">
<path id="path" d="M130 20 L230 80 L200 100 L170 200"/>
<image id="footprint" xlink:href="http://icons.veryicon.com/png/System/Icons8%20Metro%20Style/Tracks%20Footprints%20Left%20shoe.png" x="0" y="0" height="50px" width="50px"/>
</svg>
非常感谢您的帮助!
解决方案
为此,我建议您使用GREENSOCK,重量轻,易于使用且充满动画,无论您在场景中需要什么
可能这会帮助你
<img src="https://res.cloudinary.com/dwr6mqx2g/image/upload/v1489592258/leftfoot_hjajqj.svg" id="leftfoot">
<img src="https://res.cloudinary.com/dwr6mqx2g/image/upload/v1489592258/rightfoot_fthak3.svg" id="rightfoot">
一些JS
var $rightfoot = $("#rightfoot"),
$leftfoot = $("#leftfoot");
var tl = new TimelineMax({repeat:-1})
var ease = SteppedEase.config(5);
tl
.to($rightfoot, 0.25, {autoAlpha:1,},1)
.to($leftfoot, 0.25, {autoAlpha:1,},1)
.to($leftfoot, 3,
{bezier:{ curviness: 1, values:[{x:0, y:0},{x:52, y:-25}, {x:97, y:-39}, {x:136, y:-54}, {x:172, y:-83}, {x:197, y:-117},{x:200, y:-163,}],
autoRotate:90}, ease:ease},1)
.to($rightfoot, 3,
{bezier:{ curviness: 1, values:[{x:0, y:0}, {x:44, y:-13}, {x:97, y:-28,}, {x:134, y:-49,}, {x:166, y:-83,}, {x:182, y:-126,}, {x:176, y:-163,}],
autoRotate:100}, ease:ease},1.25)
参考
学分珍娜
推荐阅读
- node.js - Nginx 提供与 VueJS 应用程序分开的登录页面
- python - Aioredis 不支持 3.5 之前的 python 版本
- python - 我有两个矩阵已转换为灰度图像,我想找到它们之间的平均 SSIM 值(python)
- ios - UITextView - 启用听写警报很快消失
- gcc - 可以将 gcc 配置为编译代码的位置无关代码但数据的位置相关代码吗?
- python - Python - 需要帮助将字典字典写入 CSV 文件
- typescript - componentDidMount() 中的 Async Await API 调用突然失败/超过超时?反应原生。还原。打字稿
- python - 根据列值复制行
- python - 使用 matplotlib 将 2D 直方图投影到一个轴
- php - 使用 jquery ajax 和 php 逐个加载部分