rfid update

This commit is contained in:
Sam
2023-11-15 19:40:50 +13:00
parent 095c16b01d
commit 82f05ff22a
4 changed files with 46 additions and 7 deletions

View File

@@ -678,3 +678,40 @@ class MaryFace extends BaseShape {
}
}
class NewWave extends BaseShape {
constructor(width,sides,step,lineWidth,limiter) {
super();
this.width = width
this.sides = sides;
this.step = step;
this.lineWidth = lineWidth;
this.limiter = limiter;
}
draw(rotation) {
rotation *= this.speedMultiplier/400
ctx.lineWidth = this.lineWidth
for (let j = 0; j < this.sides; j++) {
const radRotation = rad(360/this.sides*j)
const inverter = 1-(j%2)*2
let lastX = centerX
let lastY = centerY
for (let i = 0; i < this.width; i += this.step) {
ctx.beginPath();
ctx.moveTo(lastX, lastY);
ctx.strokeStyle = colourToText(lerpRGB([255,51,170],[51,170,255],i/this.width))
const x = i
const y = (Math.sin(-i*inverter / 30 + rotation*inverter) * i/(this.limiter/100))
const xRotated = x * Math.cos(radRotation) - y * Math.sin(radRotation)
const yRotated = x * Math.sin(radRotation) + y * Math.cos(radRotation)
lastX= centerX + xRotated;
lastY= centerY + yRotated;
ctx.lineTo(centerX + xRotated, centerY + yRotated);
ctx.stroke();
}
}
}
}