12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>蒙板示例</title>
- <meta charset="utf-8">
- <!-- 正式发布的时候, 只需替换掉相应的脚本文件即可 -->
- <!-- 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 ),
- circle = new kity.Circle( 100, 200, 200 ),
- circleMask = new kity.Circle( 100, 200, 200 ),
- mask = new kity.Mask(),
- brush = new kity.LinearGradientBrush(),
- rect = new kity.Rect( 200, 100, 100, 100 );
- brush.addStop( '0', "white" );
- brush.addStop( '1', "black" );
- circleMask.fill( brush );
- mask.addShape( circleMask );
- circle.maskWith( mask );
- circle.fill( 'red' );
- paper.addResource( brush );
- paper.addResource( mask );
- paper.addShape( circle );
- };
- </script>
- </head>
- <body>
- </body>
- </html>
|