简体   繁体   English

Konva动画结束后如何采取行动?

[英]How do I take an action when a Konva animation ends?

This question is specific to the wheel of fortune example. 这个问题是特定于命运之轮的例子。 As a total newbie to javascript, I have managed to change the number of wedges, their colors and labels, but I could not figure out to bind a function to the ending event of the rotation animation. 作为javascript的新手,我设法更改了楔形的数量,颜色和标签,但是我不知道将函数绑定到旋转动画的结束事件。 This will be for a small psychology experiment on risk taking behavior and I need to way to determine which wedge came up to the mark at the end of the rotation. 这将是一个关于冒险行为的小型心理学实验,我需要确定在轮换结束时哪个楔形达到目标的方法。

This is directly from the Konva JS documentation ... 这直接来自Konva JS文档...

// the tween has to be created after the node has been added to the layer
var tween = new Konva.Tween({
    node: wheel,
    duration: 4,
    rotation: 360,
    easing: Konva.Easings.BackEaseOut,
    onFinish: function() {
        writeMessage('tween finished!');
    }
});

Konva JS Tween Finish event Konva JS Tween完成事件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM