// R3F.tsx
import React, { useRef, useState } from 'react'
import { Canvas, useFrame } from '@react-three/fiber'
function Box(props) {
// This reference will give us direct access to the mesh
const meshRef = useRef()
// Set up state for the hovered and active state
const [hovered, setHover] = useState(false)
const [active, setActive] = useState(false)
// Subscribe this component to the render-loop, rotate the mesh every frame
useFrame((state, delta) => (meshRef.current.rotation.x += delta))
// Return view, these are regular three.js elements expressed in JSX
return (
<mesh
{...props}
ref={meshRef}
scale={active ? 1.5 : 1}
onClick={(event) => setActive(!active)}
onPointerOver={(event) => setHover(true)}
onPointerOut={(event) => setHover(false)}>
<boxGeometry args={[1, 1, 1]} />
<meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} />
</mesh>
)
}
function App() {
return (
<Canvas linear={false} flat={false} gl={{ useLegacyLights: true }}>
<ambientLight intensity={1} />
<pointLight position={[10, 10, 10]} intensity={1} />
<Box position={[-1.2, 0, 0]} />
<Box position={[1.2, 0, 0]} />
</Canvas>
);
}
export default App
MathJax Blog Post
Welcome
Docusaurus blogging features are powered by the blog plugin.
Simply add Markdown files (or folders) to the blog
directory.
Regular blog authors can be added to authors.yml
.
The blog post date can be extracted from filenames, such as:
2019-05-30-welcome.md
2019-05-30-welcome/index.md
A blog post folder can be convenient to co-locate blog post images:
The blog supports tags as well!
And if you don't want a blog: just delete this directory, and use blog: false
in your Docusaurus config.
MDX Blog Post
Blog posts support Docusaurus Markdown features, such as MDX.
Use the power of React to create interactive blog posts.
<button onClick={() => alert('button clicked!')}>Click me!</button>
Long Blog Post
This is the summary of a very long blog post,
Use a <!--
truncate
-->
comment to limit blog post size in the list view.
First Blog Post
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet