All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.assets.rjzjh.zrender.graphic.shape.Arc.js Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/**
 * 圆弧
 * @module zrender/graphic/shape/Arc
 */
 define(function (require) {

    return require('../Path').extend({

        type: 'arc',

        shape: {

            cx: 0,

            cy: 0,

            r: 0,

            startAngle: 0,

            endAngle: Math.PI * 2,

            clockwise: true
        },

        style: {

            stroke: '#000',

            fill: null
        },

        buildPath: function (ctx, shape) {

            var x = shape.cx;
            var y = shape.cy;
            var r = Math.max(shape.r, 0);
            var startAngle = shape.startAngle;
            var endAngle = shape.endAngle;
            var clockwise = shape.clockwise;

            var unitX = Math.cos(startAngle);
            var unitY = Math.sin(startAngle);

            ctx.moveTo(unitX * r + x, unitY * r + y);
            ctx.arc(x, y, r, startAngle, endAngle, !clockwise);
        }
    });
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy