Skip to content

Commit

Permalink
fix ruttetra mouse+animation interaction; fix splitrgb scale
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Oct 15, 2024
1 parent ded322d commit 59a293e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
22 changes: 9 additions & 13 deletions models/ruttetraizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,15 @@ export default class RuttEtraIzer {
this.lineGroup.add(new THREE.Line(geometry, this.material))
}
if (random_mode) {
const rand = Math.random()
if (rand > .5) {
pointer_x += rot_dir_x * rot_rate_x
if (pointer_x < min_rot || pointer_x > max_rot) {
pointer_x = Math.max(min_rot, Math.min(pointer_x, max_rot))
rot_dir_x *= -1
}
} else {
pointer_y += rot_dir_y * rot_rate_y
if (pointer_y < min_rot || pointer_y > max_rot) {
pointer_y = Math.max(min_rot, Math.min(pointer_y, max_rot))
rot_dir_y *= -1
}
pointer_x += rot_dir_x * rot_rate_x
if (pointer_x < min_rot || pointer_x > max_rot) {
pointer_x = Math.max(min_rot, Math.min(pointer_x, max_rot))
rot_dir_x *= -1
}
pointer_y += rot_dir_y * rot_rate_y
if (pointer_y < min_rot || pointer_y > max_rot) {
pointer_y = Math.max(min_rot, Math.min(pointer_y, max_rot))
rot_dir_y *= -1
}
}
this.lineGroup.scale.setScalar(scale)
Expand Down
4 changes: 2 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ const effect_funcs = {
},

rgb_split: (W, H, rgbx) => {
let shift_gx = devicePixelRatio * 4 | 0
let shift_gy = devicePixelRatio * 2 | 0
let shift_gx = W / 200 * devicePixelRatio | 0
let shift_gy = H / 200 * devicePixelRatio | 0
let shift_rx = 2 * shift_gx
let shift_ry = 2 * shift_gy
for (let y = 0; y < H; y++)
Expand Down

0 comments on commit 59a293e

Please sign in to comment.