Giant refactor. added layers. ui overhaul. added save/load and we now got presets
This commit is contained in:
Sam
2025-12-28 03:21:25 +13:00
parent f01076df57
commit 14ec23237f
90 changed files with 4971 additions and 22901 deletions

60
docs/js/shapes/Spiral1.js Normal file
View File

@@ -0,0 +1,60 @@
/**
* Spiral1 - Dual-direction spiral pattern
*/
class Spiral1 extends BaseShape {
static config = [
{ type: 'range', min: 1, max: 50, defaultValue: 20, property: 'sides' },
{ type: 'range', min: 1, max: 600, defaultValue: 240, property: 'width' },
{ type: 'color', defaultValue: '#4287f5', property: 'colour' },
];
constructor(sides, width, colour) {
super();
this.sides = sides;
this.width = width;
this.colour = colour;
}
draw(elapsed) {
this.updateFilters(elapsed);
const rotation = elapsed * (this.speedMultiplier / 100);
const rot = Math.round((this.sides - 2) * 180 / this.sides * 2);
const piv = 360 / this.sides;
let stt = 0.5 * Math.PI - rad(rot);
let end = 0;
const n = this.width / ((this.width / 10) * (this.width / 10));
for (let i = 1; i < this.sides + 1; i++) {
end = stt + rad(rot);
ctx.lineWidth = 5;
ctx.beginPath();
ctx.arc(
centerX + Math.cos(rad(90 + piv * i + rotation)) * this.width,
centerY + Math.sin(rad(90 + piv * i + rotation)) * this.width,
this.width,
stt + rad(rotation) - (stt - end) / 2,
end + rad(rotation) + rad(n),
0
);
ctx.strokeStyle = this.colour;
ctx.stroke();
ctx.beginPath();
ctx.arc(
centerX + Math.cos(rad(90 + piv * i - rotation)) * this.width,
centerY + Math.sin(rad(90 + piv * i - rotation)) * this.width,
this.width,
stt - rad(rotation),
end - (end - stt) / 2 + rad(n) - rad(rotation),
0
);
ctx.strokeStyle = this.colour;
ctx.stroke();
stt = end + -(rad(rot - piv));
}
}
}
shapeRegistry.register('Spiral1', Spiral1);