From 59a293e5779736bfc14d3787c47aa21f4b879a97 Mon Sep 17 00:00:00 2001 From: Eyal Gruss Date: Tue, 15 Oct 2024 14:51:16 +0300 Subject: [PATCH] fix ruttetra mouse+animation interaction; fix splitrgb scale --- models/ruttetraizer.js | 22 +++++++++------------- script.js | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/models/ruttetraizer.js b/models/ruttetraizer.js index 57bdbf9..3365b6a 100644 --- a/models/ruttetraizer.js +++ b/models/ruttetraizer.js @@ -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) diff --git a/script.js b/script.js index 2ba1b7a..5db945c 100644 --- a/script.js +++ b/script.js @@ -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++)