-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework examples (cra -> vite), enable glitch by default, remove defau…
…lt for buffer type
- Loading branch information
v1rtl
committed
Apr 1, 2021
1 parent
f24928d
commit 6e9afbb
Showing
38 changed files
with
225 additions
and
476 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
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
File renamed without changes
File renamed without changes
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
File renamed without changes
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 |
---|---|---|
@@ -1,41 +1,44 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import { HashRouter as Router, Switch, Route, Redirect } from 'react-router-dom' | ||
import demos from './demos' | ||
import { DemoWrapper, DemoPanel, Spot } from './styles' | ||
import React, { Fragment } from 'react' | ||
import { Route, Link, Redirect, useLocation } from 'wouter' | ||
import EvilCube from './demos/EvilCube' | ||
import TakeControl from './demos/TakeControl' | ||
import Bubbles from './demos/Bubbles' | ||
|
||
const demos = [EvilCube, TakeControl, Bubbles] | ||
|
||
const App = () => { | ||
const [loc] = useLocation() | ||
|
||
const demo = demos.find((d) => d.path === loc) | ||
|
||
const demosEntries = Object.entries(demos) | ||
const [defaultDemoName] = demosEntries[0] | ||
export default function App() { | ||
return ( | ||
<Router> | ||
<Switch> | ||
<Route | ||
path={`/demo/:name`} | ||
exact | ||
render={({ match }) => { | ||
const ActiveDemo = demos[match.params.name] | ||
return ( | ||
<DemoWrapper className={cx({ bright: ActiveDemo?.bright })}> | ||
{!!ActiveDemo ? ( | ||
<React.Suspense fallback={null}> | ||
<ActiveDemo.Component /> | ||
</React.Suspense> | ||
) : ( | ||
<Redirect to={`/demo/${defaultDemoName}`} /> | ||
)} | ||
</DemoWrapper> | ||
) | ||
}} | ||
/> | ||
<> | ||
<Route path="/"> | ||
<Redirect to="/evil-cube" /> | ||
</Route> | ||
|
||
<Redirect to={`/demo/${defaultDemoName}`} /> | ||
</Switch> | ||
<DemoPanel> | ||
{demosEntries.map(([name, { bright }]) => ( | ||
<Spot key={name} to={`/demo/${name}`} title={name} activeClassName="active" className={cx({ bright })} /> | ||
{demo && ( | ||
<> | ||
<Route path={demo.path}> | ||
<demo.component /> | ||
</Route> | ||
<div id="desc"> | ||
<h1>{demo.name}</h1> | ||
<p>{demo.description}</p> | ||
</div> | ||
</> | ||
)} | ||
<div id="controls"> | ||
{demos.map((demo) => ( | ||
<Link href={demo.path} key={demo.name}> | ||
<a> | ||
<div></div> | ||
</a> | ||
</Link> | ||
))} | ||
</DemoPanel> | ||
</Router> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default App |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,33 @@ | ||
import React from 'react' | ||
import { EffectComposer, Vignette, Noise, Glitch } from '@react-three/postprocessing' | ||
import { Canvas } from '@react-three/fiber' | ||
import { Box, OrbitControls } from '@react-three/drei' | ||
import * as THREE from 'three' | ||
|
||
const EvilCube = () => { | ||
return ( | ||
<Canvas | ||
onCreated={({ scene }) => { | ||
scene.background = new THREE.Color('red') | ||
}} | ||
> | ||
<OrbitControls /> | ||
<Box rotation={[0, 1, 2]}> | ||
<meshBasicMaterial attach="material" color="red" /> | ||
</Box> | ||
<ambientLight intensity={0.3} /> | ||
<EffectComposer multisampling={0}> | ||
<Glitch delay={[1, 2]} /> | ||
<Vignette eskil={false} offset={0.1} darkness={1.1} /> | ||
<Noise /> | ||
</EffectComposer> | ||
</Canvas> | ||
) | ||
} | ||
|
||
export default { | ||
component: EvilCube, | ||
description: 'Glitch + Vignette + Noise', | ||
name: 'Evil Cube', | ||
path: '/evil-cube', | ||
} |
Oops, something went wrong.