1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Pen Example</title>
- <!-- 正式发布的时候, 只需替换掉相应的脚本文件即可 -->
- <!-- dev 版本 示例所需脚本文件 start -->
- <script src="../dev-lib/sea.js"></script>
- <script>
- seajs.config({
- base: '../src'
- });
- </script>
- <script src="../dev-lib/exports.js"></script>
- <script src="../dev-lib/dev-start.js"></script>
- <!-- dev 版本 示例所需脚本文件 end -->
- <!-- 正式版本 示例所需脚本文件 start -->
- <!--<script src="../dist/kitygraph.all.min.js"></script>-->
- <!-- 正式版本 示例所需脚本文件 end -->
- <script>
- window.onload = function () {
- var paper = new kity.Paper(document.body);
- paper.setWidth(600).setHeight(400);
- var Curve2 = kity.createClass({
- base: kity.Group,
- constructor: function(x, y, s) {
- this.callBase();
- var points = [
- new kity.ShapePoint(15, 100),
- new kity.ShapePoint(105, 10),
- new kity.ShapePoint(195, 190),
- new kity.ShapePoint(285, 100)
- ];
- var curve = new kity.Curve(points).fill('none').stroke('black').setSmoothFactor(s);
- this.addShape(curve);
- for(var i = 0; i < points.length; i++) {
- var p = points[i];
- this.addShape(new kity.Rect(6, 6, p.getX() - 3, p.getY() - 3).fill('red'));
- }
- this.addShape(new kity.Text('k = ' + s).setX(180).setY(50).fill('blue'));
- this.scale(0.8).translate(x, y);
- }
- });
- paper.addShapes([
- new Curve2(0, 0, 0),
- new Curve2(300, 0, 0.5),
- new Curve2(0, 200, 1),
- new Curve2(300, 200, 5)
- ]);
- };
- </script>
- </head>
- <body>
-
- </body>
- </html>
|