说明:旋转鼠标的星星:
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<div id="container"></div>
<script src="http://www.html5canvastutorials.com/libraries/kinetic-v5.0.0-beta.js"></script>
<script>
function animate(animatedLayer, star, frame) {
// 20% slow down per second
var angularFriction = 0.2;
var angularVelocityChange = star.angularVelocity * frame.timeDiff * (1 - angularFriction) / 1000;
star.angularVelocity -= angularVelocityChange;
if(star.controlled) {
star.angularVelocity = (star.rotation() - star.lastRotation) * 1000 / frame.timeDiff;
}
else {
star.rotate(frame.timeDiff * star.angularVelocity / 1000);
}
star.lastRota