1. Mechanisme — kopieer 1-op-1, geen styling-keuzes
// Mechanisme: gallery-r3f-island-gallery
// Live demo: vanilla three.js voor lichte bundle.
// R3F-equivalent (educatief):
import { Canvas, useFrame } from '@react-three/fiber';
function Card({ index, texture }) {
const ref = useRef();
useFrame((s) => { ref.current.position.y = Math.sin(s.clock.elapsedTime + index) * 0.06; });
return (
<mesh ref={ref} position={[(index-2)*1.55, 0, -index*0.25]}>
<planeGeometry args={[1.4, 1.9]} />
<meshStandardMaterial map={texture} />
</mesh>
);
}
export default () => (
<Canvas camera={{ position:[0,0,6], fov:45 }}>
<ambientLight intensity={0.6}/>
<directionalLight position={[2,3,4]} intensity={0.9}/>
{[0,1,2,3,4].map(i => <Card key={i} index={i} texture={makeTex(i)} />)}
</Canvas>
);
// --- VANILLA THREE (LIVE) ---
import * as THREE from 'https://esm.sh/three@0.160.0';
const host = document.querySelector('.r3f-island-mount');
const renderer = new THREE.WebGLRenderer({ antialias:true, alpha:true });
host.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(45, 16/9, 0.1, 100);
camera.position.set(0,0,6);
scene.add(new THREE.AmbientLight(0xffffff, 0.7));
const dir = new THREE.DirectionalLight(0xffffff, 1); dir.position.set(2,3,4); scene.add(dir);
// 5 floating planes met canvas-gradient textures...