js库为汽车制作动画'It’在jpg格式的地图上移动
js library to animate car's moving on a map in jpg format
我有一张jpg格式的地图图像(而不是svg),以及一系列(x,y)点,表示汽车在地图上的移动位置。
我想创建一个html页面来动画这辆车在地图上的移动。
你能推荐一个可以轻松实现这一点的js库吗?
非常感谢!
虽然我会用css3来防止不必要的http请求,但您可以使用此javascript库来使用html5 canvas kinetickJS
您不一定需要JavaScript来实现这一点。查看CSS动画。产生这种效果的确切CSS将与用于显示图像和汽车的HTML相结合。
如果你有一些HTML,比如:
<div class="wrapper">
<img class="car" src="/car.jpg" />
<img src="/map.jpg" />
</div>
还有一些CSS:
.wrapper {
position: relative;
}
.wrapper .car {
position: absolute;
top: #; // initial top offset
left: #; // initial left offset
animation: car-path 5s 0s 1 normal forwards; // shorthand
}
// define keyframes for the car animation.
// add as many intermediate states as you want.
// in each state simply define the position and
// rotation of the car to simulate turning/acceleration
// change "0%" with the position you want the car in
@keyframes car-path {
0% {
top: 0%;
left: 0%;
transform: rotate(0deg);
}
// add as many intermediate positions as you want
100% {
top: 0%;
left: 0%;
transform: rotate(0deg);
}
}
你可以通过这种方式获得一些有趣的结果。
相关文章:
- 如何使用javascript或html下载PDF格式的填写表单
- 货币代码为欧元-金额的格式不应包含小数
- Json数据包含日期和时间格式
- Javascript日期格式类似于ISO,但本地
- 更改angularjs中的日期-时间格式
- 将日期时间从json转换为可读格式
- NodeJS日期格式不起作用
- 我能得到正确的格式吗
- PHP:显示sqlite数据库中的html格式数据,使用tinymce保存
- 使用正则表达式将输入格式设置为单字符逗号、单字符逗号等
- 将日期和时间转换为UTC格式的日期-Javascript
- Javascript格式UTC日期
- 元素的内容必须由格式正确的字符数据或标记组成
- 您如何制作典型格式的照片,例如PNG,JPG等,用于像素级样式和脚本的HTML画布元素
- AngularJS以JPG格式下载SVG
- Mapbox webservice:将贴图的格式从PNG更改为JPG
- 从JPG格式切换到YouTube视频
- 如何在javascript文件阅读器中将.png格式的图像转换为.jpg格式
- js库为汽车制作动画'It’在jpg格式的地图上移动
- 如何使浏览文件上传窗口只显示.jpg格式的图片?