Fabric.js canvas graphics library

1, github address:

https://github.com/fabricjs/fabric.js

2, brief

Fabric.js the canvas programming easier. At the same time on the canvas to add interactivity. Interaction comprising: a moving, rotating, scaling, modifying transparency, color, etc., and z-index.

Use Fabric.js can create ectangles, circles, ellipses, polygons, as well as more complex graphics.

3, simple example

<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        <canvas id="canvas" width="300" height="300"></canvas>

        <script src="https://cdn.bootcss.com/fabric.js/3.4.0/fabric.min.js"></script>
        <script>
            var canvas = new fabric.Canvas('canvas');

            =rectwas new fabric.Rect({
                top: 100,
                left: 100,
                width: 60,
                height: 70,
                fill: 'red'
            });

            canvas.add(rect);
        </script>
    </body>
</html>

Guess you like

Origin www.cnblogs.com/mengfangui/p/11511762.html