eye animation
This commit is contained in:
parent
e4c9793d9a
commit
f3a917bb3a
11 changed files with 2240 additions and 5 deletions
19
.direnv/bin/nix-direnv-reload
Executable file
19
.direnv/bin/nix-direnv-reload
Executable 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
|
||||||
1
.direnv/flake-inputs/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
Symbolic link
1
.direnv/flake-inputs/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/01x5k4nlxcpyd85nnr0b9gm89rm8ff4x-source
|
||||||
1
.direnv/flake-inputs/2160kicd344c1qjdz7gs7mgrvm0rghp9-source
Symbolic link
1
.direnv/flake-inputs/2160kicd344c1qjdz7gs7mgrvm0rghp9-source
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/2160kicd344c1qjdz7gs7mgrvm0rghp9-source
|
||||||
1
.direnv/flake-inputs/w2jcgb8c6yph72nsksa6zmc8qdna8ys4-source
Symbolic link
1
.direnv/flake-inputs/w2jcgb8c6yph72nsksa6zmc8qdna8ys4-source
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/w2jcgb8c6yph72nsksa6zmc8qdna8ys4-source
|
||||||
1
.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
Symbolic link
1
.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source
|
||||||
1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
Symbolic link
1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/fmx0hgmd7cm96cb9ns9iv84kgyhc9hbx-nix-shell-env
|
||||||
2144
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
Normal file
2144
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
Normal file
File diff suppressed because it is too large
Load diff
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
35
sketch.js
35
sketch.js
|
|
@ -178,6 +178,9 @@ 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);
|
||||||
|
|
||||||
|
if (time > lastBlinkTime + nextBlinkDelay) {
|
||||||
|
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);
|
fill(0);
|
||||||
|
noStroke();
|
||||||
circle(eye1.x, eye1.y, 12);
|
circle(eye1.x, eye1.y, 12);
|
||||||
circle(eye2.x, eye2.y, 12);
|
circle(eye2.x, eye2.y, 12);
|
||||||
|
pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
27
solar.js
Normal file
27
solar.js
Normal 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);
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue