Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions frontend/src/components/react/PearlShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export default function PearlShell({

const upperShellRef = useRef<THREE.InstancedMesh | null>(null);
const lowerShellRef = useRef<THREE.InstancedMesh | null>(null);
const pearlRef = useRef<THREE.Mesh | null>(null);
const photoGroupRef = useRef<THREE.Group | null>(null);
const shellGroupRef = useRef<THREE.Group | null>(null);
const targetShellRotationRef = useRef({ x: 0, y: 0 });
Expand Down Expand Up @@ -243,33 +242,6 @@ export default function PearlShell({
scene.add(shellGroup);
shellGroupRef.current = shellGroup;

// Pearl
const pearlGeo = new THREE.SphereGeometry(1.5, 64, 64);
const pearlMat = new THREE.MeshPhysicalMaterial({
color: 0xfff5ee,
emissive: 0x22110a,
roughness: 0.1,
metalness: 0.1,
clearcoat: 1.0,
clearcoatRoughness: 0.1,
iridescence: 1.0,
iridescenceIOR: 1.5,
iridescenceThicknessRange: [100, 400],
transparent: true,
opacity: 1,
});
const pearl = new THREE.Mesh(pearlGeo, pearlMat);
pearl.position.set(0, -2, 0);
shellGroup.add(pearl);
pearlRef.current = pearl;

const pearlLight = new THREE.PointLight(0xffaa55, 2, 20);
pearlLight.position.copy(pearl.position);
shellGroup.add(pearlLight);

const pearlLightRef = { current: pearlLight };
const pearlMatRef = { current: pearlMat };

// Shells
const particleCount = 8000;
const scaleGeo = new THREE.PlaneGeometry(0.15, 0.15);
Expand Down Expand Up @@ -402,12 +374,6 @@ export default function PearlShell({
controls.update();
}

if (pearlLightRef.current && pearlMatRef.current) {
const pulse = stateRef.current.bloomIntensity;
pearlLightRef.current.intensity = 2 + pulse * 2;
pearlMatRef.current.emissiveIntensity = 1 + pulse;
}

shellMat.uniforms.time.value = time;
shellMat.uniforms.scatterProgress.value = stateRef.current.scatterProgress;

Expand Down Expand Up @@ -605,21 +571,12 @@ export default function PearlShell({

if (newState === 'CLOSED') {
const photosVisible = prevState === 'OPEN' || prevState === 'PHOTO_ZOOM';
const fromScattered = prevState === 'SCATTERED';
const shellDelay = photosVisible ? 1.5 : 0;
const pearlDelay = fromScattered ? 2 : shellDelay;

gsap.to(state, { shellOpenAngle: 0, duration: 1.5, delay: shellDelay, ease: 'power2.inOut' });
gsap.to(state, { scatterProgress: 0, duration: 2, ease: 'power2.inOut' });
gsap.to(state, { bloomIntensity: 0.2, duration: 1, delay: shellDelay });

if (pearlRef.current) {
gsap.killTweensOf(pearlRef.current.material, 'opacity');
pearlRef.current.visible = true;
(pearlRef.current.material as THREE.MeshPhysicalMaterial).opacity = 0;
gsap.to(pearlRef.current.material, { opacity: 1, duration: 1.5, delay: pearlDelay });
}

if (photoGroupRef.current) {
photoGroupRef.current.children.forEach((child) => {
const mat = (child as THREE.Mesh).material;
Expand All @@ -641,16 +598,6 @@ export default function PearlShell({
gsap.to(state, { scatterProgress: 0, duration: 2, ease: 'power2.inOut' });
gsap.to(state, { bloomIntensity: 0.8, duration: 2 });

if (pearlRef.current) {
gsap.killTweensOf(pearlRef.current.material, 'opacity');
gsap.to(pearlRef.current.material, {
opacity: 0, duration: 1.5,
onComplete: () => {
if (pearlRef.current) pearlRef.current.visible = false;
},
});
}

if (photoGroupRef.current) {
photoGroupRef.current.children.forEach((child) => {
gsap.to((child as THREE.Mesh).material, { opacity: 1, duration: 2, delay: 1.5 });
Expand All @@ -661,12 +608,6 @@ export default function PearlShell({
gsap.to(state, { scatterProgress: 1, duration: 3, ease: 'power2.inOut' });
gsap.to(state, { bloomIntensity: 0.3, duration: 2 });

if (pearlRef.current) {
gsap.killTweensOf(pearlRef.current.material, 'opacity');
(pearlRef.current.material as THREE.MeshPhysicalMaterial).opacity = 0;
pearlRef.current.visible = false;
}

if (photoGroupRef.current) {
photoGroupRef.current.children.forEach((child) => {
gsap.to((child as THREE.Mesh).material, { opacity: 0, duration: 1.5 });
Expand Down
Loading