mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
fix: don't repeat reveal animation on scroll for tank sandbox
This commit is contained in:
1 parent
e43231aa97
commit
2cdcf95822
1 file changed
+4
-4
+4
-4
@@ -38,19 +38,19 @@ export function Lighting() {
|
||||
draft.revealed = true;
|
||||
});
|
||||
|
||||
t0.current = clock.elapsedTime - REVEAL_ANIMATION_TIME;
|
||||
t0.current = performance.now() / 1000 - REVEAL_ANIMATION_TIME;
|
||||
}, []);
|
||||
|
||||
useFrame(({ invalidate }) => {
|
||||
if (transition.current) {
|
||||
transition.current = false;
|
||||
t0.current = clock.elapsedTime;
|
||||
t0.current = performance.now() / 1000;
|
||||
}
|
||||
|
||||
const x = clamp(
|
||||
(clock.elapsedTime - t0.current) / animationTime.current,
|
||||
(performance.now() / 1000 - t0.current) / animationTime.current,
|
||||
0,
|
||||
2
|
||||
2,
|
||||
);
|
||||
const t = (0.5 * Math.sin(Math.PI * (x + 0.5)) + 0.5) ** 2;
|
||||
|
||||
|
||||
Reference in new issue
Block a user