HTML5又一个点:Canvas KineticJS文本教程!
来源:互联网 发布:淘宝支付宝登录 编辑:程序博客网 时间:2024/05/17 05:08
与KineticJS创建文本,我们可以实例化一个动态Text()对象。列出了完整的属性和方法,看看动能。文本文档。
<!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.2.min.js"></script> <script defer="defer"> var stage = new Kinetic.Stage({ container: 'container', width: 578, height: 220 }); var layer = new Kinetic.Layer(); var simpleText = new Kinetic.Text({ x: stage.getWidth() / 2, y: 15, text: 'Simple Text', fontSize: 30, fontFamily: 'Calibri', fill: 'green' }); // to align text in the middle of the screen, we can set the // shape offset to the center of the text shape after instantiating it simpleText.setOffset({ x: simpleText.getWidth() / 2 }); // since this text is inside of a defined area, we can center it using // align: 'center' var complexText = new Kinetic.Text({ x: 100, y: 60, text: 'COMPLEX TEXT\n\nAll the world\'s a stage, and all the men and women merely players. They have their exits and their entrances.', fontSize: 18, fontFamily: 'Calibri', fill: '#555', width: 380, padding: 20, align: 'center' }); var rect = new Kinetic.Rect({ x: 100, y: 60, stroke: '#555', strokeWidth: 5, fill: '#ddd', width: 380, height: complexText.getHeight(), shadowColor: 'black', shadowBlur: 10, shadowOffset: [10, 10], shadowOpacity: 0.2, cornerRadius: 10 }); // add the shapes to the layer layer.add(simpleText); layer.add(rect); layer.add(complexText); stage.add(layer); </script> </body></html>
- HTML5又一个点:Canvas KineticJS文本教程!
- HTML5心得:Canvas KineticJS正多边形教程
- HTML5 Canvas KineticJS线教程,挺好的一个代码!
- HTML5:Canvas复杂的拖拽和KineticJS界限教程
- HTML5新的东西:Canvas KineticJS五角星教程
- HTML5那些故事:Canvas的KineticJS图片教程!
- HTML5里面的知识:Canvas的KineticJS多边形教程
- 推荐的html5知识:Canvas KineticJS图片教程!
- HTML5里面,关于Canvas的KineticJS圆教程!
- HTML5画布kineticjs教程
- HTML5画布kineticjs BLOB教程
- HTML5画布kineticjs花键教程
- 推荐一个html5 canvas的插件kineticjs
- html5知识:Canvas的KineticJS事件委托!
- HTML5 Canvas KineticJS 学习笔记1
- HTML5画布kineticjs灰度图像教程
- HTML5画布kineticjs模糊滤镜教程
- HTML5画布kineticjs路径文字教程
- Uva624(记录路径的01背包)
- HTML5里面的东西:Canvas KineticJS规模动画教程!
- 在创业型软件公司的收获
- lower_bound()返回值
- 分析ssologin.js
- HTML5又一个点:Canvas KineticJS文本教程!
- 预定义 #define
- _com_error at memory location / 对象关闭时,不允许操作。
- sqlnet.ora文件详解
- 使用关键代码段实现线程同步
- ADO操控数据库SqlBulkCopy批量数据插入
- error opening trace file: No such file or directory (2)解决办法之一
- iOS面试经常用到的问题
- HDU1528 Card Game Cheater 二分匹配最大点覆盖问题