var amplitude = 100; var period = 2000; // in ms var centerX = stage.width() / 2;
// we have animation that do nothing in some cases var anim = new Konva.Animation(function(frame){ if (frame.time % (period * 2) < period) { // regular update hexagon.x( amplitude * Math.cos((frame.time * 2 * Math.PI) / period) + centerX ); } else { // this is "pause" phase // we don't need update layer in this case // so return false and Konva will skip layer draw returnfalse; } }, layer);