eye update

This commit is contained in:
Sam 2023-05-04 17:29:04 +12:00
parent bc01c0e0c9
commit 4a91b98d4c
1 changed files with 17 additions and 8 deletions

View File

@ -448,6 +448,14 @@ class EyePrototype extends BaseShape {
} }
draw(rotation) { draw(rotation) {
let speedMult = 50
let waitTime = 3
let cap = 200
let d = waitTime * speedMult * 10
let a = cap * 2 + d
let outputRotation = Math.min(Math.abs((Math.floor(rotation * speedMult) % a) - a / 2 - d / 2), cap)
// console.log("Rot: "+ rotation + " | " +Math.floor(rotation)%a)
console.log(outputRotation)
// console.log(this.counter) // console.log(this.counter)
ctx.strokeStyle = "orange"; ctx.strokeStyle = "orange";
ctx.fillStyle = "black"; ctx.fillStyle = "black";
@ -461,11 +469,12 @@ class EyePrototype extends BaseShape {
// ctx.rect(centerX-300/2, centerY-300/2, 300, 300); // ctx.rect(centerX-300/2, centerY-300/2, 300, 300);
// ctx.stroke(); // ctx.stroke();
this.drawEyelid(this.step); // this.drawEyelid(this.step);
this.drawEyelid(outputRotation);
ctx.save(); ctx.save();
// squareCut(); // squareCut();
this.eyelidCut(this.step); this.eyelidCut(outputRotation);
if (this.counter % 100 == 0) { if (this.counter % 100 == 0) {
this.counter = 0; this.counter = 0;
} }
@ -480,8 +489,8 @@ class EyePrototype extends BaseShape {
ctx.restore(); ctx.restore();
this.stepFunc(); // this.stepFunc();
this.counter++; // this.counter++;
} }
} }