HTML5里面的一个知识:Canvas二层与KineticJS完成事件!
2013-09-25 19:52
567 查看
触发一个用户定义函数当二层与KineticJS结束,我们可以设置onFinish进行。
代码的确写得挺好的,下面呢,我也不说其它的啦,直接上代码给大家看:
代码的确写得挺好的,下面呢,我也不说其它的啦,直接上代码给大家看:
<!DOCTYPE HTML> <html> <head> <style> body { margin: 0px; padding: 0px; } </style> </head> <body> <div id="container"></div> <script src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.7.1.min.js"></script> <script defer="defer"> function writeMessage(message) { text.setText(message); layer.draw(); } var stage = new Kinetic.Stage({ container: 'container', width: 578, height: 200 }); var layer = new Kinetic.Layer(); var text = new Kinetic.Text({ x: 10, y: 10, fontFamily: 'Calibri', fontSize: 24, text: '', fill: 'black' }); var wheel = new Kinetic.Star({ x: stage.getWidth() / 2, y: stage.getHeight() / 2, numPoints: 50, outerRadius: 70, innerRadius: 50, fill: 'purple', stroke: 'black', strokeWidth: 5, lineJoin: 'bevel' }); layer.add(wheel); layer.add(text); stage.add(layer); var tween = new Kinetic.Tween({ node: wheel, duration: 4, rotation: Math.PI * 2, easing: Kinetic.Easings.BackEaseOut, onFinish: function() { writeMessage('tween finished!'); } }); setTimeout(function() { tween.play(); }, 1000); </script> </body> </html>
相关文章推荐
- HTML5知识:KineticJS里面Canvas形象的事件!
- HTML5知识:Canvas取消事件泡沫与KineticJS传播!
- HTML5知识:KineticJS里面的Canvas tango形状!
- html5知识:Canvas的KineticJS事件委托!
- 怎么保证html5的canvas里面image对象加载完成可以执行后面的代码
- 发现一个全部用html5写的网站,里面还有很多知识
- 一个不错的HTML5 Canvas多层点击事件监听实例
- HTML5里面的知识:Canvas的KineticJS多边形教程
- 使用HTML5 canvas完成的一个网页白板
- 一个不错的HTML5 Canvas多层点击事件监听实例
- <html5 canvas>一个简单的矩形,clearRect(), strokeRect(), fillRect(), 鼠标事件onmousedown
- 推荐一个html5 canvas的插件kineticjs
- HTML5新的东西:Canvas里面KineticJS补间动画教程!
- HTML5里面的知识:Canvas简单与KineticJS滚动条!
- HTML5知识:Canvas简单形状与KineticJS的Easings类!
- [HTML5-Canvas] 使用HTML5 canvas完成的一个网页白板
- 如何开发一个简单的HTML5 Canvas 小游戏
- HTML5 Canvas实践(一)Canvas 基础知识
- 玩转html5(四)----使用canvas画一个时钟(可以动的哦!)
- listview请求数据源,会加载很多数据,需求就是在listview下面有一个button点击事件,当数据完成一个下面紧接着跟着button点击事件,进行点击跳转