<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<!-- <link
rel="stylesheet"
href="https://unpkg.com/swiper@4.4.6/dist/css/swiper.min.css"
/> -->
<title>Document</title>
<style>
.target {
width: 20px;
height: 20px;
background-color: red;
}
</style>
</head>
<body>
<div id="app"><div class="target"></div></div>
<script src="https://unpkg.com/vue@2.0.1/dist/vue.min.js"></script>
<script src="https://unpkg.com/animejs@3.0.1/lib/anime.min.js"></script>
<!-- <script src="https://unpkg.com/swiper@4.4.6/dist/js/swiper.min.js"></script> -->
<script>
new Vue({
el: '#app',
data() {
return {};
}, mounted() {
// 为每种属性提供特定的动画参数 https://animejs.com/documentation/#specificPropParameters // 为动画的每个目标和属性获取不同的值 https://animejs.com/documentation/#functionBasedParameters // 添加,减去或乘以原始值。 https://animejs.com/documentation/#relativeValues // 帧动画 https://animejs.com/documentation/#animationKeyframes // 播放/暂停 https://animejs.com/documentation/#playPause // 回调函数,监听动画周期 https://animejs.com/documentation/#update
var playPauseAnim = anime({
targets: '.target',
autoplay: true, // 定义动画是否应自动启动。
// translateX: 250,
// translateX: [-20, 20], // 强制动画以指定值开始。 [from, to] translateX: [
{ value: -20, duration: 0 },
{ value: 0, duration: 1000 },
{ value: 20, duration: 1000, delay: 2000 },
], opacity: [
{ value: 0, duration: 0 },
{ value: 1, duration: 1000 },
{ value: 0, duration: 1000, delay: 2000 },
], duration: 3000, // 动画的持续时间(以毫秒为单位)
delay: 1000, // 动画的延迟(以毫秒为单位)
// endDelay: 1000, // 动画结束时以毫秒为单位添加一些额外时间
easing: 'linear', // 和css一样的动画曲线 https://animejs.com/documentation/#linearEasing
// direction: 'alternate', // 定义动画的方向。 https://animejs.com/documentation/#direction
loop: true, // 定义动画的迭代次数。 // innerHTML: [0, 10000],
// round: 10, // 将值向上舍入为x小数。 //每帧都会触发回调,包括延迟时
update: function() {
// console.log('update');
},
begin: function(anim) {
console.log('begin');
}, // 每次循环开始时都会触发一次loopBegin
loopBegin() {
console.log('loopBegin');
}, // 每次动画开始更改时都会触发changeBegin
changeBegin: function(anim) {
console.log('changeBegin');
}, //每次循环完成时都会触发一次loopComplete
loopComplete: function(anim) {
console.log('loopComplete');
}, // 每次动画停止更改时都会触发changeComplete
changeComplete: function(anim) {
console.log('changeComplete');
}, // 在延迟之后触发
change: function() {
console.log('change');
}, complete: function(anim) {
console.log('结束');
},
});
}, methods: {},
});
</script>
</body>
</html>

最新文章

  1. js操作数组
  2. 导出csv文件示例
  3. Unity3D&ndash;RectTransfrom 记录笔记
  4. gcc【数学几何】
  5. Linux进程切换代码分析
  6. linux下的三种解压文件的命令?
  7. android 项目学习随笔二十(屏幕适配)
  8. PHP上传图片如何防止图片木马?
  9. JavaScript--匿名函数和闭包(16)
  10. Swift学习笔记七
  11. Splay入门题目 [HNOI2002]营业额统计
  12. dbg调试
  13. Singleton(单例)模式
  14. web开发|如何选择合适的webui框架
  15. 【cpp】chap 8
  16. Python-视图 触发器 事务 存储过程
  17. SpringBoot+Mybatis+Pagehelper分页
  18. So you want to be a 2n-aire? UVA - 10900(概率)
  19. Hive 常用优化参数
  20. shell脚本函数

热门文章

  1. WPF学习里程(二) XAML基础
  2. 系列trick - bitmask
  3. 一文打尽端口复用 VS Haproxy端口复用
  4. Spring MVC—模型数据,转发重定向,静态资源处理方式
  5. vagrant虚拟化之多网卡网络配置
  6. 2020第十一届蓝桥杯第二场JavaB组
  7. Educational Codeforces Round 30
  8. 【uva 12219】Common Subexpression Elimination(图论--树+自定义比较器+映射+递归)
  9. hdu5407CRB and Candies (逆元+数学公式)
  10. 使用 Typecho 搭建博客