-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6da867
commit b70dab5
Showing
35 changed files
with
5,278 additions
and
5,604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useRef, useState, useMemo } from 'react' | ||
import { useFrame } from '@react-three/fiber' | ||
import { Color } from 'three' | ||
|
||
export default function Box({ text, ...props }) { | ||
const ref = useRef() | ||
const black = useMemo(() => new Color('black'), []) | ||
const lime = useMemo(() => new Color('lime'), []) | ||
const [hovered, setHovered] = useState(false) | ||
|
||
useFrame(({ mouse, viewport }) => { | ||
const x = (mouse.x * viewport.width) / 2.5 | ||
const y = (mouse.y * viewport.height) / 2.5 | ||
ref.current.lookAt(x, y, 1) | ||
ref.current.material.color.lerp(hovered ? lime : black, 0.05) | ||
}) | ||
|
||
return ( | ||
<mesh | ||
{...props} | ||
ref={ref} | ||
onPointerOver={() => setHovered(true)} | ||
onPointerOut={() => setHovered(false)} | ||
> | ||
<boxGeometry /> | ||
<meshStandardMaterial color={lime} /> | ||
{props.children} | ||
</mesh> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.eye-canvas canvas { | ||
height: 400px; | ||
width: 400px; | ||
display: block; | ||
background: red; | ||
position: fixed; | ||
top: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React, { useEffect, useRef, useState } from "react"; | ||
import { Canvas, useFrame, useThree } from '@react-three/fiber'; | ||
import * as THREE from "three"; | ||
import { Vector3 } from 'three' | ||
import eyeIllustration from './eye_illustration.jpeg'; | ||
import './Eye.css'; | ||
import Box from "./Box"; | ||
|
||
function Rig() { | ||
const { camera, mouse } = useThree() | ||
const vec = new Vector3() | ||
|
||
return useFrame(() => { | ||
camera.position.lerp(vec.set(-mouse.x, -mouse.y, camera.position.z), 0.5) | ||
camera.lookAt(0, 0, 0) | ||
}) | ||
} | ||
|
||
const Sphere = () => { | ||
|
||
const ref = useRef() | ||
const base = new THREE.TextureLoader().load(eyeIllustration) | ||
|
||
// useFrame(() => console.log('executing')); | ||
|
||
return ( | ||
<mesh visible castShadow ref={ref} | ||
rotation={[0, 0.25, 0.25]} | ||
position={[0, 0, -1]} | ||
> | ||
<sphereGeometry attach="geometry" args={[3, 48, 48]} /> | ||
<meshPhongMaterial | ||
map={base} | ||
color="white" | ||
/> | ||
</mesh> | ||
); | ||
}; | ||
|
||
const Eye = () => { | ||
|
||
return ( | ||
<div className='BigEye'> | ||
<Canvas> | ||
<ambientLight intensity={0.5} castShadow={true} /> | ||
<directionalLight color="white" position={[-50, 0, -100]} castShadow={true} /> | ||
<directionalLight color="white" position={[-2000, 0, -200]} castShadow={true} /> | ||
<Sphere /> | ||
<Rig /> | ||
</Canvas> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Eye; |
Binary file added
BIN
+106 KB
...ar-website/src/components/Homepage/Eye/Screen Shot 2022-12-30 at 4.34.34 PM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.