Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
draw (i) {
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 1, 'butt', 'miter', [5, 5], this.offset); // miter = crisp pixels at 1px line width stroke (+ see below)
// With a lineWidth of 1 (or any odd number) we need to -0.5 this to retain pixel clarity:
Rectangle(this.ctx, 32-0.5, 32-0.5);
Stroke(this.ctx, 255, 255, 0);
this.ctx.closePath();
this.ctx.restore();
}rect4 (ctx) {
// cap = butt, round or square
// join = bevel, round or miter
ctx.save();
ctx.beginPath();
Line(ctx, 12, 'round', 'round', [6, 24]);
Rectangle(ctx, 256, 256);
Stroke(ctx, 255, 255, 0);
ctx.closePath();
ctx.restore();
}Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 255, 0, 0, 0.5);
this.ctx.closePath();
this.ctx.restore();
// Green
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 12, 'round', 'round', [1, 32], this.offsetG);
Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 0, 255, 0, 0.5);
this.ctx.closePath();
this.ctx.restore();
// Blue
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 12, 'round', 'round', [1, 32], this.offsetB);
Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 0, 0, 255, 0.5);
this.ctx.closePath();draw (i) {
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 2);
// Rotate from center
Rectangle(this.ctx, 256, 256, 128, 128, DegToRad(this.angle), true);
Stroke(this.ctx, 255, 255, 0);
this.ctx.closePath();
this.ctx.restore();
}Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 0, 255, 0, 0.5);
this.ctx.closePath();
this.ctx.restore();
// Blue
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 12, 'round', 'round', [1, 32], this.offsetB);
Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 0, 0, 255, 0.5);
this.ctx.closePath();
this.ctx.restore();
}rect2 (ctx) {
// cap = butt, round or square
// join = bevel, round or miter
ctx.save();
ctx.beginPath();
Line(ctx, 4, 'square', 'miter', [4, 8]);
Rectangle(ctx, 256, 32);
Stroke(ctx, 255, 255, 0);
ctx.closePath();
ctx.restore();
}draw (i) {
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 12, 'round', 'round', [18, 32], this.offset);
Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 255, 255, 0);
this.ctx.closePath();
this.ctx.restore();
}draw (i) {
this.ctx.save();
this.ctx.beginPath();
Line(this.ctx, 12, 'round', 'round', [1, 32], this.offset);
Rectangle(this.ctx, 32, 32, 256, 256);
Stroke(this.ctx, 255, 255, 0);
this.ctx.closePath();
this.ctx.restore();
}