当前位置: 首页 > 文档资料 > Pile.js 中文文档 >

CssTransform css3 过渡动画

优质
小牛编辑
131浏览
2023-12-01

定义

基于animejs封装的React组件。

图片展示

代码演示


import Anime from 'pile/dist/components/anime'
const {CssTransform} = Anime
let moveAlone = {
  targets: '.anime-move-demo-alone',
  left: '240px',
  backgroundColor: '#5EF3FB',
  borderRadius: 40,
  loop: false,
  delay: 300,
  autoplay: true,
  easing: 'easeInOutQuad'
},
moveMore = {
  targets: '.anime-move-demo',
  translateX: 250,
  direction: 'alternate',
  loop: false,
  delay: 500,
  autoplay: true,
  elasticity: (el, i, l) => {
return (200 + i * 200);
  }
}
<CssTransform {...moveAlone}>
  <div className="anime-move-demo-alone"></div>
</CssTransform>
<CssTransform {...moveMore}>
  <div className="anime-move-demo"></div>
  <div className="anime-move-demo"></div>
  <div className="anime-move-demo"></div>
</CssTransform>

属性

参数描述数据类型默认值
targetsCSS Selectorsstring
(CSS 属性名,驼峰式命名)CSS 属性名string
duration持续的时间number,function
delay延迟number, function0
easing动画运行轨迹string
loop次数number, boolean
autoplay是否自动播放booleantrue
............
点击查看详细参数说明