R3F Flashcards

(18 cards)

1
Q

Como inicializar uma cena com <Canvas>?</Canvas>

A

import { Canvas } from ‘@react-three/fiber’;

<Canvas
camera={{ fov: 45, near: 0.1, far: 100, position: [1, 2, 6] }}
>

<Experience></Experience>

</Canvas>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Como adicionar controles de câmera com Drei?

A

import { OrbitControls } from ‘@react-three/drei’;

<OrbitControls></OrbitControls>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Como mover/rotacionar/escalar um objeto com gizmo de controle?

A

import { TransformControls } from ‘@react-three/drei’;

<TransformControls>
<mesh>{/* ... */}</mesh>
</TransformControls>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Como adicionar um gizmo estético para mover objetos com controle de posição relativa?

A

import { PivotControls } from ‘@react-three/drei’;

<PivotControls anchor={[0, 0, 0]} depthTest={false}>

<mesh>{/* ... */}</mesh>

</PivotControls>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Como adicionar um elemento HTML preso a um objeto 3D?

A

import { Html } from ‘@react-three/drei’;

<mesh>
<Html position={[1, 1, 0]} wrapperClass="label" center>
That's a sphere 👍
</Html>
</mesh>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Como renderizar texto 3D leve e nítido?

A

import { Text } from ‘@react-three/drei’;

<Text
font=”./bangers-v20-latin-regular.woff”
fontSize={1}
color=”salmon”
maxWidth={2}
textAlign=”center”
>
I LOVE R3F
</Text>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Como fazer um objeto flutuar como um balão?

A

import { Float } from ‘@react-three/drei’;

<Float speed={5} floatIntensity={2}>

<Text>I LOVE R3F</Text>

</Float>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Como adicionar reflexos a um plano?

A

import { MeshReflectorMaterial } from ‘@react-three/drei’;

<mesh>
<planeGeometry></planeGeometry>
<MeshReflectorMaterial
resolution={512}
blur={[1000, 1000]}
mixBlur={1}
mirror={0.5}
color="greenyellow"
/>
</mesh>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Como usar Leva para adicionar controles no UI?

A

import { useControls } from ‘leva’;

const { position, color } = useControls(‘sphere’, {
position: { value: { x: 0, y: 0 }, step: 0.01, joystick: ‘invertY’ },
color: ‘#ff0000’
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Como monitorar FPS, draw calls e memória com Drei?

A

import { Perf } from ‘r3f-perf’;

<Perf></Perf>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Como adicionar um céu físico realista?

A

import { Sky } from ‘@react-three/drei’;

<Sky sunPosition={[1, 2, 3]} />

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Como aplicar sombras suaves do tipo PCSS?

A

import { SoftShadows } from ‘@react-three/drei’;

<SoftShadows size={25} samples={10} focus={0} />

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Como criar sombras realistas acumulativas com luzes aleatórias?

A

import { AccumulativeShadows, RandomizedLight } from ‘@react-three/drei’;

<AccumulativeShadows frames={100} blend={100} temporal>
<RandomizedLight position={[1, 2, 3]} amount={8} radius={1} intensity={3} />
</AccumulativeShadows>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Como criar sombras suaves de contato no chão?

A

import { ContactShadows } from ‘@react-three/drei’;

<ContactShadows
position={[0, -0.99, 0]}
scale={10}
resolution={512}
color=”#1d8f75”
opacity={0.4}
blur={2.8}
frames={1}
/>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Como usar um mapa HDRI ou CubeMap para iluminação global?

A

import { Environment } from ‘@react-three/drei’;

<Environment></Environment>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Como usar um HDRI customizado?

A

<Environment></Environment>

17
Q

Como adicionar elementos personalizados na iluminação da cena?

A

<Environment>
<Lightformer position-z={-5} scale={5} color="red" intensity={10} form="ring" />
</Environment>

18
Q

Como configurar rapidamente uma cena com luz, ambiente e sombra?

A

import { Stage } from ‘@react-three/drei’;

<Stage
shadows={{ type: ‘contact’, opacity: 0.2, blur: 3 }}
environment=”sunset”
preset=”portrait”
intensity={3.5}
>

<mesh>{/* ... */}</mesh>

</Stage>