zoukankan      html  css  js  c++  java
  • 使用百度zrender, demo抛砖引玉.

    http://www.just.org.cn/zrender/index.html

    https://github.com/ecomfe/zrender

    目录结构:

    |-project
        |-demo
            |-js
                |-main.js
            |-index.html
        |-libs
            |-requirejs
                |-require.js
            |-zrender
                |-src
                    |-zrender.js
                    ...

    src下面省略了很多, 其实就是将"https://github.com/ecomfe/zrender"中src下面所有文件夹和文件.

    自己写的就是 main.js 和 index.html

    main.js

    require.config({
    	packages: [
    		{
    			name: 'zrender',
    			location: '../../libs/zrender/src',
    			main: 'zrender'
    		}
    	]
    });
    require(
    	[
    		'zrender',
    		'zrender/animation/animation',
    		'zrender/shape/Circle'
    	],
    	function(zrender, Animation, CircleShape){
    		//
    		var zr = zrender.init( document.getElementById('Main') );
    		var circle = new CircleShape({
    			position: [100, 100],
    			scale: [1, 1],
    			style: {
    				x: 0,
    				y: 0,
    				r: 50,
    				brushType: 'fill',
    				color: 'rgba(33, 222, 10, 0.8)',
    				lineWidth: 5,
    				text: 'circle',
    				textPosition: 'inside'
    			},
    			draggable: true
    		});
    		zr.addShape(circle);
    		zr.render();
    	}
    );
    

    index.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>zRender demo</title>
    	<script type="text/javascript" src="../libs/requirejs/require.js" data-main="./js/main.js"></script>
    </head>
    <body>
    	 <div id="Main" style="600px;height:400px;"></div>
    </body>
    </html>
    

    效果如下:

  • 相关阅读:
    使用Ansible安装部署nginx+php+mysql之安装php(2)
    使用Ansible安装部署nginx+php+mysql之安装nginx(1)
    Ansible常见问题处理
    4.2、Ansible常用模块
    3.2、Ansible单命令测试
    2、Ansible配置文件详解
    4.1、Ansible模块
    3.3、Ansible命令参数详解
    3.1、Ansible命令简要说明及初步使用
    1、Ansible初识简要介绍及安装
  • 原文地址:https://www.cnblogs.com/juedui0769/p/5084993.html
Copyright © 2011-2022 走看看