Skip to content

Commit

Permalink
update interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
yiwenl committed Jan 20, 2024
1 parent eebb791 commit 32279c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion experiments/ribbon01/dist/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions experiments/ribbon01/src/SceneApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class SceneApp extends Scene {
this.lengthScale.value = 1.0;
}, 2200 + delay);

setTimeout(() => this.pulse(), 2500 + delay);
setTimeout(() => this.pulse(), 3000 + delay);
}

_initTextures() {
Expand Down Expand Up @@ -245,7 +245,7 @@ class SceneApp extends Scene {
}

_initHit() {
const r = 12.5;
const r = 15;
const mesh = Geom.plane(r, r / GL.aspectRatio, 1);
// this._hitTestor = new HitTestor(Geom.sphere(3, 24), this.camera);
this._hitTestor = new HitTestor(mesh, this.camera);
Expand Down
9 changes: 6 additions & 3 deletions experiments/ribbon01/src/shaders/sim.frag
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ void main(void) {

// repel to touch
d = distance(pos, uTouch);
f = smoothstep(5.0, 3.0, d);
f = smoothstep(6.0, 3.0, d);
dir = normalize(pos - uTouch);

float t = extra.z + mix(1.0, 3.0, extra.x) * uTime * 0.1;
float t = extra.z + mix(1.0, 3.0, extra.x) * uTime * 0.2;
t = sin(t * PI);
t = smoothstep(-0.5, 1.0, t);
acc -= dir * f * 4.0/uSpeed * t;
// acc -= dir * f * 6.0/uSpeed * t * step(uSpeed, 2.0);
float fSpeed = smoothstep(4.0, 1.0, uSpeed);
fSpeed = mix(0.2, 1.0, fSpeed);
acc -= dir * f * 4.0/uSpeed * t * fSpeed;

float speed = mix(2.0, 3.0, extra.x);
// float speed = mix(2.0, 4.0, extra.x);
Expand Down

0 comments on commit 32279c3

Please sign in to comment.