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