关键帧
在同一个可动画属性上创建一系列动画。
属性值关键帧
特定于某个动画属性,这些关键帧直接传递给属性值
animate('.square', {
┌───────────────────┐
│ x: [0, 100, 200], ├─ Tween Values Array
│ y: [0, 100, 200], │
└───────────────────┘
duration: 3000,
}
animate('.square', {
┌────────────────────────────┐
│ x: [{to: 100}, {to: 200}], ├─ Tween Parameters Array
│ y: [{to: 100}, {to: 200}], │
└────────────────────────────┘
duration: 3000,
}
动画关键帧
定义在动画层级,这些关键帧可以在每个关键帧中为多个属性设置动画
animate('.square', {
┌───────────────────────┐
│ keyframes: [ │
│ { x: 100, y: 100 }, ├─ Duration Based
│ { x: 200, y: 200 }, │
│ ], │
└───────────────────────┘
duration: 3000,
}
animate('.square', {
┌───────────────────────────────┐
│ keyframes: { │
│ '0%' : { x: 0, y: 0 }, │
│ '50%' : { x: 100, y: 100 }, ├─ Percentage Based
│ '100%': { x: 200, y: 200 }, │
│ }, │
└───────────────────────────────┘
duration: 3000,
}
本节内容