HTML5 Canvas Tweening Tutorial

To tween properties with Konva, we can instantiate a Konva.Tween object
and then start the tween by calling play(). Any numeric property of a Shape,
Group, Layer, or Stage can be transitioned, such as x, y, rotation,
width, height, radius, strokeWidth, opacity, scaleX, offsetX, etc.

For a full list of attributes and methods, check out the Konva.Tween documentation.

Konva Tweening Demoview raw
<!DOCTYPE html>
<script src=""></script>
<meta charset="utf-8">
<title>Konva Linear Easing Demo</title>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #F0F0F0;
<div id="container"></div>
var width = window.innerWidth;
var height = window.innerHeight;

var stage = new Konva.Stage({
container: 'container',
width: width,
height: height

var layer = new Konva.Layer();

var rect = new Konva.Rect({
x: 50,
y: 20,
width: 100,
height: 50,
fill: 'green',
stroke: 'black',
strokeWidth: 2,
opacity: 0.2


// the tween has to be created after the node has been added to the layer
var tween = new Konva.Tween({
node: rect,
duration: 1,
x: 140,
y: 90,
fill : 'red',
rotation: Math.PI * 2,
opacity: 1,
strokeWidth: 6,
scaleX: 1.5

// start tween after 2 seconds
setTimeout(function() {;
}, 2000);