码迷,mamicode.com
首页 > Web开发 > 详细

fabric.js 学习

时间:2018-02-28 17:34:25      阅读:377      评论:0      收藏:0      [点我收藏+]

标签:idt   lang   dash   ini   地址   new   ati   .com   char   

官网地址:http://fabricjs.com/    git     https://github.com/kangax/fabric.js/

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        canvas {
            border: 1px dashed black;
        }
    </style>
    <script src="fabric.min.js"></script>
</head>
<body>
    <canvas id="canvas" width="600" height="600"></canvas>
    <script>
        window.onload = function(){
            var canvas = new fabric.Canvas(‘canvas‘);
            var rect = new fabric.Rect({
                top : 50,
                left : 100,
                width : 100,
                height : 70,
                fill : ‘red‘
            });
            var circle = new fabric.Circle({
                radius:50,
                fill:‘green‘,
                left:200,
                top:200
            });
            var triangle = new fabric.Triangle({
                width: 80,
                height: 100,
                fill: ‘blue‘, 
                left: 50, 
                top: 50
            });
            canvas.add(rect, circle, triangle);
        }     
    </script>
</body>
</html>

  技术分享图片

 

fabric.js 学习

标签:idt   lang   dash   ini   地址   new   ati   .com   char   

原文地址:https://www.cnblogs.com/lfqcode/p/8484381.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!