一个流行的网页动画JS库
animejs
https://animejs.com/
Anime.js (
/ˈæn.ə.meɪ/) is a lightweight JavaScript animation library with a simple, yet powerful API.
It works with CSS properties, SVG, DOM attributes and JavaScript Objects.此库是一个轻量级的JS动画库,带有简单和强大的API。
Anime's built-in staggering system makes complex follow through and overlapping animations simple. It can be used on both timings and properties.
Animate multiple CSS transforms properties with different timings simultaneously on a single HTML element.
Play, pause, control, reverse and trigger events in sync using the complete built-in callbacks and controls functions.
Anime.js works with anything web. CSS, SVG, DOM attributes and JavaScript Objects: animate everything with a single unified API.
GITHUB上有33K的favorites。
https://github.com/juliangarnier/anime/
例子
https://animejs.com/documentation/
物体沿着一条path行进, path的入参数,表示的DOM对象,可以是一个path, 也可以是任意的一个特殊图形, 如圆圈,抛物线。
https://animejs.com/documentation/#motionPath
var path = anime.path('.motion-path-demo path');
anime({
targets: '.motion-path-demo .el',
translateX: path('x'),
translateY: path('y'),
rotate: path('angle'),
easing: 'linear',
duration: 2000,
loop: true
});
教学库
https://github.com/joao-pratas/animejs-tut
https://github.com/joao-pratas/animejs-tut/tree/master/anime-master/documentation/examples
时间线接口,可以串起来每一个小步骤。
https://github.com/joao-pratas/animejs-tut/blob/master/anime-master/documentation/examples/anime-timeline.html
var noOffset = anime.timeline({
autoplay: true
});
noOffset
.add({
targets: '.no-offset',
translateX: -100,
translateY: -100,
scale: 2,
background: '#FF1461',
begin: function() { console.log('noOffset animation 1 began')},
complete: function() { console.log('noOffset animation 1 completed')}
})
.add({
targets: '.no-offset',
translateX: -100,
translateY: 100,
scale: 3,
background: '#18FF92',
begin: function() { console.log('noOffset animation 2 began')},
complete: function() { console.log('noOffset animation 2 completed')}
})
.add({
targets: '.no-offset',
translateX: 100,
translateY: 100,
rotate: 120,
scale: 4,
background: '#5A87FF',
begin: function() { console.log('noOffset animation 3 began')},
complete: function() { console.log('noOffset animation 3 completed')}
})
.add({
targets: '.no-offset',
translateX: 100,
translateY: -100,
scale: 5,
background: '#FBF38C',
begin: function() { console.log('noOffset animation 4 began')},
complete: function() { console.log('noOffset animation 4 completed')}
})
.add({
targets: '.no-offset',
translateX: 100,
translateY: -100,
scale: '+=8',
background: '#FBF38C',
begin: function() { console.log('noOffset animation 5 began')},
complete: function() { console.log('noOffset animation 5 completed')}
});
练练手
https://github.com/fanqingsong/sun_system
实现一个太阳系行星围绕太阳运转动画。

一个流行的网页动画JS库的更多相关文章
- impress.js 一个创建在线幻灯的js库
真的好奇怪,我居然会写前端技术的博客.没有办法的,最近实习,看的大多是前端.所以今天就用这个来练练手了. Impress.js 是一个非常棒的用来创建在线演示的Javascript库.它基于CSS3转 ...
- 安利一个绘制指引线的JS库leader-line
前言 之前看到一篇推荐Magi这个搜索引擎的新闻,对于这个搜索引擎是否好用咱们不予置评,但是我在这个搜索引擎上面发现了一个好玩的前端功能. 如上图,将鼠标浮动到学习来源上时,会展示一堆指引线. 本博客 ...
- 一个构建XML对象的js库
初学javascript,学习中用到在IE中建立XML对象,于是写了一个简单的“库”.因为水平所限,肯定会有不恰当的地方,欢迎指正. 如果大家有知道现存的更好的东西,非常希望大家能将它推荐给我. 代码 ...
- 利用moment为基础,基于DOM实现一个多个倒计时同时进行的js库方便使用
moment非常强大,提供了很多时间方法的封装,项目需要一个小倒计时的功能,网上找了很多不合适,决定自己写一个,直接上代码 //定义一个立即执行的函数(function () { var Ticts= ...
- 利用Bootstrap制作一个流行的网页
首先是html承载内容: <!DOCTYPE html> <html lang="zh_CN"> <head> <meta charset ...
- 分享:计算机图形学期末作业!!利用WebGL的第三方库three.js写一个简单的网页版“我的世界小游戏”
这几天一直在忙着期末考试,所以一直没有更新我的博客,今天刚把我的期末作业完成了,心情澎湃,所以晚上不管怎么样,我也要写一篇博客纪念一下我上课都没有听,还是通过强大的度娘完成了我的作业的经历.(当然作业 ...
- 12个值得关注的顶级可视化JS库 涉及图表、动画、时间处理,表格操作
本文是译文,原文是https://da-14.com/blog/top-11...我在原文的基础上加了百度的Echats图表库,这个也是毫不逊色其他图表库的.另外Handsontable电子表格库也是 ...
- Dynamics.js - 创建逼真的物理动画的 JS 库
Dynamics.js 是一个用来创建物理动画 JavaScript 库.你只需要把dynamics.js引入你的页面,然后就可以激活任何 DOM 元素的 CSS 属性动画,也可以用户 SVG 属性. ...
- 网页3D效果库Three.js初窥
网页3D效果库Three.js初窥 背景 一直想研究下web页面的3D效果,最后选择了一个比较的成熟的框架Three.js下手 ThreeJs官网 ThreeJs-github; 接下来我会陆续翻译 ...
随机推荐
- 我的GitHub:https://github.com/javaFesh?tab=repositories
https://github.com/javaFesh?tab=repositories
- C++学习(11)—— 友元
生活中你的家有客厅(Public),有你的卧室(Private) 客厅所有来的客人都可以过去,但是你的卧室是私有的,也就是说只有你能进去 但是呢,你也可以允许你的好闺蜜好基友进去 在程序里,有些私 ...
- Apache JMeter系列.1
最爱看统计 --01-- 简介 Apache JMeter Apache JMeter可用于测试静态和动态资源(文件,Servlet,Perl脚本,Java对象,数据库和查询,FTP服务器等)的性能. ...
- 不能走路(walk)
[题目背景] 小G 同学总是在树上走路.小S 看不下去了,决定阻止小G 同学. [题目描述] 有一棵 n 个点的树,树上有 m 条路径,每条路径为 x[i]到y[i] 的树上最短路径(不经过相同的边) ...
- test20191205 WC模拟赛
又是先开T3的做题顺序,搞我心态.以后我必须先看看题了. 整数拆分 定义 \(f_m(n)\) 表示将 \(n\) 表示为若干 \(m\) 的非负整数次幂的和的方案数.例如,当 \(m = 2\) 的 ...
- spark运行时加载配置文件(hive,hdfs)
文章为转载,如有版权问题,请联系,谢谢! 转自:https://blog.csdn.net/piduzi/article/details/81636253 适合场景:在运行时才确定用哪个数据源 imp ...
- webpack.config.js配置信息的说明
module.exports = { entry: "./src/main.js", output: { filename: "build/build.js" ...
- 最长公共上升子序列 O(n^2)
#include <bits/stdc++.h> using namespace std; const int MAXN = 5005; int A[MAXN], B[MAXN], N, ...
- 使用 ML.NET 对 K-Means 平均值聚类分析和分类
数据集 :https://en.wikipedia.org/wiki/Iris_flower_data_set 聚类分析 非监管式机器学习任务,用于将数据实例分组到包含类似特性的群集. 聚类分析还可用 ...
- 【CF241E】Flights
[CF241E]Flights 题面 洛谷 题解 对于原来的图,如果一条边不出现在\(1\)到\(n\)的路径上面,直接\(ban\)掉即可. 那么考虑一条边\(u\rightarrow v\),一定 ...