mirror of
https://github.com/AtHeartEngineer/MetaFest2.git
synced 2026-01-08 20:47:54 -05:00
- glitch also has companion easteregg.
- easter egg glitch disabled on mobile to save eyes 😅
- adding alpha map for seed logo for better display
- small tweaks to 1440px displays
- it has been mentioned by some that the font sizes on 1440 were too small.
- also made some text heavier to improve readability.
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
import React, { useRef, useState } from "react";
|
|
import { useFrame } from '@react-three/fiber'
|
|
import { useGLTF } from "@react-three/drei";
|
|
import * as THREE from "three";
|
|
import gsap from "gsap";
|
|
import useStore from '@/helpers/store'
|
|
|
|
export default function BabyEarthVox(props) {
|
|
// const router = useStore((s) => s.router)
|
|
const group = useRef();
|
|
const material = useRef();
|
|
const [hovered, setHover] = useState(false)
|
|
const { nodes, materials } = useGLTF("/assets/models/babyearth-vox.glb");
|
|
const { animate } = props
|
|
const clock = new THREE.Clock();
|
|
let previousTime = 0;
|
|
|
|
useFrame(() => {
|
|
const elapsedTime = clock.getElapsedTime();
|
|
const deltaTime = elapsedTime - previousTime;
|
|
previousTime = elapsedTime;
|
|
|
|
if (group.current && animate) {
|
|
group.current.position.x = -2 + Math.sin(elapsedTime * 0.8) * Math.PI * 0.03;
|
|
group.current.position.y = -1 - Math.cos(elapsedTime * 0.1) * Math.PI * 0.5;
|
|
group.current.position.z = -0.25 - Math.cos(elapsedTime * 0.1) * Math.PI * 0.3;
|
|
group.current.rotation.y = elapsedTime * 0.3;
|
|
}
|
|
})
|
|
|
|
|
|
return (
|
|
<group ref={group} {...props} name="VoxelEarth" dispose={null}>
|
|
<mesh
|
|
castShadow
|
|
receiveShadow
|
|
geometry={nodes["voxel-earth"].geometry}
|
|
material={materials['palette.003']}
|
|
rotation={[Math.PI * 0.5, 0, 0]}
|
|
// onPointerOver={(e) => setHover(true)}
|
|
// onPointerOut={(e) => setHover(false)}
|
|
/>
|
|
|
|
<pointLight
|
|
intensity={6}
|
|
distance={3}
|
|
decay={2}
|
|
color={'cyan'}
|
|
castShadow
|
|
/>
|
|
</group>
|
|
);
|
|
}
|
|
|