Tween in Kinetic js

<html>
<body>
<div id=”ok”></div>
<script src=”http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v5.0.1.min.js”></script&gt;
<script defer=”defer”>
var stage=new Kinetic.Stage({
container:’ok’,
width:500,
height:500
});
var layer=new Kinetic.Layer();
var rect=new Kinetic.Rect({
x:100,
y:100,
width:100,
height:50,
fill:’green’,
stroke:’black’,
strokeWidth:2,
opacity:0.2
});
layer.add(rect);
stage.add(layer);
var tween=new Kinetic.Tween({
node:rect,
duration:1,
x:400,
y:30,
rotation:720,
opacity:1,
strokeWidth: 6,
scaleX: 1.5
});
setTimeout(function(){
tween.play();
},200);
</script>
</body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s