src/components/LandingZone.js
/** This component rotates a bunch of Octahedrons */
This component rotates a bunch of Octahedrons
This component rotates a bunch of Octahedrons
function Octahedrons({ position, color }) {
  let group = useRef()
  let theta = 0
  useRender(() => {
    if(group.current){
      const r = 5 * Math.sin(ThreeMath.degToRad((theta += 0.01)))
      const s = Math.cos(ThreeMath.degToRad(theta * 2))
      group.current.rotation.set(r, r, r)
      group.current.scale.set(s, s, s)
    }
  })
  const [geo, mat, coords] = useMemo(() => {
    const geo = new OctahedronBufferGeometry(2)
    const mat = new MeshBasicMaterial({ transparent: true, wireframe: true })
    const coords = new Array(500).fill().map(i => [Math.random() * 800 - 400, Math.random() * 800 - 400, Math.random() * 800 - 400])
    return [geo, mat, coords]
  }, [])
  return (
    <a.group ref={group} position={position}>
      {coords.map(([p1, p2, p3], i) => (
        <mesh key={i} geometry={geo} material={mat} position={[p1, p2, p3]} />
      ))}
    </a.group>
  )
}
function Octahedrons ( { position , color } ) { let group = useRef ( ) let theta = 0 useRender ( ( ) => { if ( group . current ) { const r = 5 * Math . sin ( ThreeMath . degToRad ( ( theta += 0.01 ) ) ) const s = Math . cos ( ThreeMath . degToRad ( theta * 2 ) ) group . current . rotation . set ( r , r , r ) group . current . scale . set ( s , s , s ) } } ) const [ geo , mat , coords ] = useMemo ( ( ) => { const geo = new OctahedronBufferGeometry ( 2 ) const mat = new MeshBasicMaterial ( { transparent : true , wireframe : true } ) const coords = new Array ( 500 ) . fill ( ) . map ( i => [ Math . random ( ) * 800 - 400 , Math . random ( ) * 800 - 400 , Math . random ( ) * 800 - 400 ] ) return [ geo , mat , coords ] } , [ ] ) return ( < a . group ref = { group } position = { position } > { coords . map ( ( [ p1 , p2 , p3 ] , i ) => ( < mesh key = { i } geometry = { geo } material = { mat } position = { [ p1 , p2 , p3 ] } / > ) ) } < / a . group > ) }
This component rotates a bunch of Octahedrons
This component rotates a bunch of Octahedrons