mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 15:05:25 +00:00
rfid update
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user