Feature: TV screen CRT has a warm up and power down sequence

This commit is contained in:
Dejvino
2025-11-17 14:38:06 +01:00
parent 1a7b93bc7c
commit 293834b704
5 changed files with 99 additions and 10 deletions
+3 -2
View File
@@ -1,8 +1,8 @@
import * as THREE from 'three';
import { updateVcrDisplay } from '../scene/vcr-display.js';
import { updateDoor } from '../scene/door.js';
import { updateVcrDisplay } from '../scene/vcr-display.js';
import { state } from '../state.js';
import { updateScreenEffect } from '../scene/tv-set.js'
function updateCamera() {
const globalTime = Date.now() * 0.00003;
@@ -166,6 +166,7 @@ export function animate() {
updateBooks();
updateDoor();
updatePictureFrame();
updateScreenEffect();
// RENDER!
state.renderer.render(state.scene, state.camera);
+7 -4
View File
@@ -1,6 +1,6 @@
import * as THREE from 'three';
import { state } from '../state.js';
import { turnTvScreenOff, turnTvScreenOn } from '../scene/tv-set.js';
import { turnTvScreenOff, turnTvScreenOn, setScreenEffect } from '../scene/tv-set.js';
// --- Play video by index ---
export function playVideoByIndex(index) {
@@ -15,8 +15,10 @@ export function playVideoByIndex(index) {
if (index < 0 || index >= state.videoUrls.length) {
console.info('End of playlist reached. Reload tapes to start again.');
state.screenLight.intensity = 0.0;
turnTvScreenOff();
setScreenEffect(2, () => { // Power-down effect
state.screenLight.intensity = 0.0;
turnTvScreenOff();
});
state.isVideoLoaded = false;
state.lastUpdateTime = -1; // force VCR to redraw
return;
@@ -41,7 +43,8 @@ export function playVideoByIndex(index) {
// 2. Apply the video texture to the screen mesh
turnTvScreenOn();
// 3. Start playback
// 3. Start playback and trigger the warm-up effect simultaneously
setScreenEffect(1); // Trigger warm-up
state.videoElement.play().then(() => {
state.isVideoLoaded = true;
// Use the defined base intensity for screen glow