TINA - bounce example

HTML

<script src="https://rawgit.com/Wizcorp/tina/master/build/tina.min.js"></script>
<script src="https://rawgit.com/Wizcorp/tina.js/master/examples/Sprite.js"></script>
<image id="image" src="https://raw.githubusercontent.com/Wizcorp/tina.js/master/examples/star.png" class="hidden">
<canvas id="canvas" width="400" height="400"></canvas>

CSS

body {
	background-color: #7F7F7F;
	text-align: center;
	font-family: verdana;
}

canvas {
	margin: 20px auto;
	border-radius: 5px;
	box-shadow: 1px 1px 10px #333;
	display: block;
}

.title {
	font-weight: bolder;
	font-size: 30px;
	text-shadow: 2px 2px 10px #000;
	color: #AAA;
}

.hidden {
	display: none;
}

JavaScript

var image   = document.getElementById('image');
var canvas  = document.getElementById('canvas');
var ctx     = canvas.getContext('2d');
var sprite  = new Sprite(image);

//▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

TINA.onUpdate(function update(t, dt) {
	// At this point, all my tweens are up to date for the current iteration
	ctx.clearRect(0, 0, 400, 400);
	sprite.draw(ctx);
});

//▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

var duration = 2000;
var bouncing = 4;

TINA.Tween(sprite, ['x', 'rotation'])
	.from({ x:   0, rotation: 0 })
	.to({   x: 500, rotation: 10 }, duration)
	.iterations(Infinity) // loop forever
	.start();

TINA.Tween(sprite, ['y'])
	.from({ y: -100 })
	.to({   y:  300 }, duration, TINA.easing.bounceOut, bouncing) // using bounce easing for y position
	.iterations(Infinity) // loop forever
	.start();