import * as THREE from 'three/webgpu';
import { BrandStage } from './look';
import type { ScrollState } from 'three-blocks/app';
export const sceneKey = 'text';
export class Experience extends THREE.Group {
readonly hot = { spin: new THREE.Euler() };
private readonly stage = new BrandStage();
private readonly accent: THREE.Mesh<THREE.IcosahedronGeometry, THREE.MeshStandardMaterial>;
constructor() {
super();
const material = new THREE.MeshStandardMaterial( { color: 0xdd4c33, metalness: 0.18, roughness: 0.25 } );
this.accent = new THREE.Mesh( new THREE.IcosahedronGeometry( 0.5, 2 ), material );
this.accent.position.set( 2.05, - 0.62, - 0.35 );
this.accent.castShadow = true;
this.add( this.accent, this.stage );
}
update( delta: number, scroll: ScrollState ): void {
this.hot.spin.x += delta * 0.16;
this.hot.spin.y += delta * 0.24;
this.accent.rotation.copy( this.hot.spin );
this.accent.position.x = 2.05 - scroll.progress * 4.1;
this.accent.position.y = - 0.62 + Math.sin( scroll.progress * Math.PI ) * 0.7;
}
dispose(): void {
this.stage.dispose();
this.accent.geometry.dispose();
this.accent.material.dispose();
}
}
export function createScene(): Experience {
return new Experience();
}