larry babby and threejs for glsl

This commit is contained in:
Sam
2024-06-24 21:24:00 +12:00
parent 87d5dc634d
commit 907ebae4c0
6474 changed files with 1279596 additions and 8 deletions

View File

@@ -635,7 +635,7 @@ class MaryFace extends BaseShape {
}
}
class NewWave extends BaseShape {
constructor(width,sides,step,lineWidth,limiter) {
constructor(width, sides, step, lineWidth, limiter) {
super();
this.width = width
this.sides = sides;
@@ -645,25 +645,25 @@ class NewWave extends BaseShape {
}
draw(rotation) {
rotation *= this.speedMultiplier/400
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
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))
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 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;
lastX = centerX + xRotated;
lastY = centerY + yRotated;
ctx.lineTo(centerX + xRotated, centerY + yRotated);
ctx.stroke();
}