cdf
Version:
A library for creating oldschool demo-like animations with JavaScript
14 lines (13 loc) • 770 B
JavaScript
var utils = require('utils');
var shapes = require('inc/shapes');
module.exports = function (xyPair, rPair, fillStyle, rotInDeg, lineWidth, strokeColor, sa, ea, closePath) {
xyPair = utils.coordPair(xyPair);
rPair = utils.coordPair(rPair,[1,1]);
sa = sa || 0; r2 = r2 || r; ea = ea !== undefined ? ea : 360; if(ea<sa)return this;
if(this.ctx.ellipse) {
this.ctx.beginPath();
this.ctx.ellipse(xyPair[0], xyPair[1], rPair[0], rPair[1], (rotInDeg || 0) * utils.DEG_TO_RAD, sa * utils.DEG_TO_RAD, ea * utils.DEG_TO_RAD);
return utils.strokeFill(this, fillStyle, lineWidth, strokeColor, closePath);
}
return this.poly(shapes.circle(ea - sa).rotate(sa).scale(rPair).rotate(rotInDeg).translate(xyPair), fillStyle, lineWidth, strokeColor, closePath);
};