eye animation

This commit is contained in:
Daniel Kauss Serna 2026-03-12 15:31:02 +01:00
parent e4c9793d9a
commit f3a917bb3a
11 changed files with 2240 additions and 5 deletions

19
.direnv/bin/nix-direnv-reload Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
if [[ ! -d "/home/daniel/Documents/Webdev/Procanim" ]]; then
echo "Cannot find source directory; Did you move it?"
echo "(Looking for "/home/daniel/Documents/Webdev/Procanim")"
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
exit 1
fi
# rebuild the cache forcefully
_nix_direnv_force_reload=1 direnv exec "/home/daniel/Documents/Webdev/Procanim" true
# Update the mtime for .envrc.
# This will cause direnv to reload again - but without re-building.
touch "/home/daniel/Documents/Webdev/Procanim/.envrc"
# Also update the timestamp of whatever profile_rc we have.
# This makes sure that we know we are up to date.
touch -r "/home/daniel/Documents/Webdev/Procanim/.envrc" "/home/daniel/Documents/Webdev/Procanim/.direnv"/*.rc

View file

@ -0,0 +1 @@
/nix/store/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source

View file

@ -0,0 +1 @@
/nix/store/2160kicd344c1qjdz7gs7mgrvm0rghp9-source

View file

@ -0,0 +1 @@
/nix/store/w2jcgb8c6yph72nsksa6zmc8qdna8ys4-source

View file

@ -0,0 +1 @@
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source

View file

@ -0,0 +1 @@
/nix/store/fmx0hgmd7cm96cb9ns9iv84kgyhc9hbx-nix-shell-env

File diff suppressed because it is too large Load diff

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

View file

@ -80,7 +80,11 @@ function draw() {
} }
fill(255) fill(255)
drawPoints(points, sizes); // drawPoints(points, sizes);
for (let i = 0;i < sizes.length;i++) {
noFill();
circle(points[i].pos.x, points[i].pos.y, sizes[i] * 2)
}
let eye1 = points[0].getRel(HALF_PI / 2, 45) let eye1 = points[0].getRel(HALF_PI / 2, 45)
let eye2 = points[0].getRel(-HALF_PI / 2, 45) let eye2 = points[0].getRel(-HALF_PI / 2, 45)

View file

@ -176,8 +176,11 @@ const leg2 = new Leg();
const leg3 = new Leg(); const leg3 = new Leg();
const leg4 = new Leg(); const leg4 = new Leg();
let mouseInter = new vec(0, 0); let mouseInter = new vec(0, 0);
let baseColor; let baseColor;
let gillColor; let gillColor;
let lastBlinkTime = 0;
let nextBlinkDelay = 3000;
let blinkDuration = 150;
function setup() { function setup() {
createCanvas(displayWidth, displayHeight); createCanvas(displayWidth, displayHeight);
@ -268,7 +271,39 @@ function draw() {
let eye1 = bodyPoints[0].getRel(HALF_PI / 2, 45); let eye1 = bodyPoints[0].getRel(HALF_PI / 2, 45);
let eye2 = bodyPoints[0].getRel(-HALF_PI / 2, 45); let eye2 = bodyPoints[0].getRel(-HALF_PI / 2, 45);
fill(0);
circle(eye1.x, eye1.y, 12); if (time > lastBlinkTime + nextBlinkDelay) {
circle(eye2.x, eye2.y, 12); lastBlinkTime = time;
nextBlinkDelay = random(2000, 6000);
}
let isBlinking = time < lastBlinkTime + blinkDuration;
if (isBlinking) {
push();
stroke(0);
strokeWeight(4);
let headAngle = bodyPoints[0].forward.heading();
push();
translate(eye1.x, eye1.y);
rotate(headAngle + HALF_PI);
line(-6, 0, 6, 0);
pop();
push();
translate(eye2.x, eye2.y);
rotate(headAngle + HALF_PI);
line(-6, 0, 6, 0);
pop();
pop();
} else {
push();
fill(0);
noStroke();
circle(eye1.x, eye1.y, 12);
circle(eye2.x, eye2.y, 12);
pop();
}
} }

27
solar.js Normal file
View file

@ -0,0 +1,27 @@
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
let time = millis() / 1000;
translate(200, 200)
noFill();
stroke(255)
circle(0, 0, 240)
fill(255, 255, 30)
circle(0, 0, 50)
translate(cos(time) * 120, sin(time) * 120);
fill(24, 22, 234);
circle(0, 0, 20);
translate(cos(time * 3) * 60, sin(time * 3) * 60);
fill(222);
circle(0, 0, 10);
}