Skip to content

kill ​

关键方法 ​

kill ( ) ​

强行完成并销毁动画。

归属 ​

Animate 类 ​

示例 ​

ts
// #动画 - 通过 kill() 方法完成并销毁动画
import { Leafer, Rect } from 'leafer-ui'
import { Animate } from '@leafer-in/animate' // 导入动画插件

const leafer = new Leafer({ view: window })

const rect = Rect.one({ fill: '#32cd79' }, 0, 100, 50, 50)

leafer.add(rect)

const animate = new Animate(
    rect,
    { x: 500 }, // style keyframe
    {
        duration: 2
    } // options
)

// 通过 kill() 方法完成并销毁动画
setTimeout(() => {

    animate.kill()

}, 500)

Released under the MIT License.