Basic animation
This commit is contained in:
parent
b2d2102779
commit
7431483bd0
10
src/app.js
10
src/app.js
@ -36,4 +36,14 @@ layer.add(circle);
|
||||
stage.add(layer);
|
||||
layer.draw();
|
||||
|
||||
const pointerAnim = new Konva.Animation((frame) => {
|
||||
//const pos = stage.getPointerPosition();
|
||||
|
||||
const centerX = stage.width() / 2;
|
||||
circle.x(50*Math.sin((frame.time * 2 * Math.PI) / 2000) + centerX);
|
||||
|
||||
}, layer);
|
||||
|
||||
pointerAnim.start();
|
||||
|
||||
console.log("Ended");
|
||||
|
Loading…
Reference in New Issue
Block a user