Fix: Improved mirror shader fade effect animation

This commit is contained in:
Dejvino
2025-11-20 12:25:47 +01:00
parent c48581379c
commit dceb37a8dd
3 changed files with 7 additions and 27 deletions
+5 -7
View File
@@ -8,10 +8,10 @@ import { updateFire } from '../scene/fireplace.js';
function updateCamera() {
const globalTime = Date.now() * 0.00003;
const lookAtTime = Date.now() * 0.0002;
const lookAtTime = Date.now() * 0.00005;
const camAmplitude = 0.2;
const lookAmplitude = 0.1;
const lookAmplitude = 0.4;
// Base Camera Position in front of the TV
const baseX = -0.5;
@@ -19,7 +19,7 @@ function updateCamera() {
const baseZ = 2.2;
// Base LookAt target (Center of the screen)
const baseTargetX = -0.7;
const baseTargetX = -0.2;
const baseTargetY = 1.7;
const baseTargetZ = -0.3;
@@ -33,7 +33,7 @@ function updateCamera() {
state.camera.position.z = baseZ + camOffsetZ;
// LookAt Target Offsets (Subtle Gaze Shift)
const lookOffsetX = Math.sin(lookAtTime * 1.5) * lookAmplitude * 3;
const lookOffsetX = Math.sin(lookAtTime * 1.5) * lookAmplitude * 4;
const lookOffsetY = Math.cos(lookAtTime * 1.2) * lookAmplitude;
// Apply lookAt to the subtly shifted target
@@ -70,9 +70,7 @@ function updateScreenLight() {
function updateShaderTime() {
if (state.tvScreen && state.tvScreen.material.uniforms && state.tvScreen.material.uniforms.u_time) {
if (state.tvScreenPowered) {
state.tvScreen.material.uniforms.u_time.value = state.clock.getElapsedTime();
}
state.tvScreen.material.uniforms.u_time.value = state.clock.getElapsedTime();
}
}