Skip to content

Commit 300cb50

Browse files
committed
fix docs examples
1 parent 7253e89 commit 300cb50

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

docs/getting-started/2-first-timeline.mdx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ This walks you through building the intro example from scratch.
1616
'@react-three/fiber': '<9',
1717
'@react-three/drei': '<10',
1818
'@react-three/timeline': 'latest',
19-
'@react-three/postprocessing': 'latest'
2019
},
2120
}}
2221
files={{
2322
'/App.tsx': `import { Canvas, useThree } from '@react-three/fiber'
2423
import { Text, Environment } from '@react-three/drei'
25-
import { Bloom, EffectComposer, Vignette } from '@react-three/postprocessing'
2624
import { useRef } from 'react'
2725
import { Mesh } from 'three'
2826
import { useTimeline, action, lookAt, spring, springPresets } from '@react-three/timeline'
@@ -57,10 +55,6 @@ function Scene() {
5755
export default function App() {
5856
return (
5957
<Canvas style={{ position: "absolute", inset: "0", touchAction: "none" }}>
60-
<EffectComposer>
61-
<Bloom luminanceThreshold={0} luminanceSmoothing={0.9} height={300} />
62-
<Vignette eskil={false} offset={0.1} darkness={1.1} />
63-
</EffectComposer>
6458
<Environment
6559
backgroundIntensity={0.1}
6660
backgroundRotation={[0, (90 / 180) * Math.PI, 0]}

docs/tutorials/5-graph.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ transitionTo: { red: { whenPromise: () => mouseOnSide('left') } },
5656
)
5757
5858
return (
59+
5960
<>
60-
<mesh ref={red} position-x={-2} position-y={-1} rotation-y={(-30 / 180) _ Math.PI} scale={[0.2, 0.2, 0.4]}>
61-
<sphereGeometry />
62-
<meshPhysicalMaterial emissive="red" emissiveIntensity={1.5} color="red" />
63-
</mesh>
64-
<mesh ref={blue} position-x={2} position-y={-1} rotation-y={(20 / 180) _ Math.PI} scale={[0.2, 0.2, 0.4]}>
65-
<sphereGeometry />
66-
<meshPhysicalMaterial emissive="blue" emissiveIntensity={5} color="blue" />
67-
</mesh>
68-
<ambientLight intensity={0.5} />
69-
<directionalLight position={[3,3,3]} intensity={1} />
61+
<mesh ref={red} position-x={-2} position-y={-1} rotation-y={(-30 / 180) * Math.PI} scale={[0.2, 0.2, 0.4]}>
62+
<sphereGeometry />
63+
<meshPhysicalMaterial emissive="red" emissiveIntensity={1.5} color="red" />
64+
</mesh>
65+
<mesh ref={blue} position-x={2} position-y={-1} rotation-y={(20 / 180) * Math.PI} scale={[0.2, 0.2, 0.4]}>
66+
<sphereGeometry />
67+
<meshPhysicalMaterial emissive="blue" emissiveIntensity={5} color="blue" />
68+
</mesh>
69+
<ambientLight intensity={0.5} />
70+
<directionalLight position={[3, 3, 3]} intensity={1} />
7071
</>
71-
)
72-
}
72+
) }
7373
7474
export default function App() {
7575
return (

docs/tutorials/6-vanilla.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const update = start(mainTimeline())
218218
```ts
219219
let last = performance.now()
220220
function onFrame(now: number) {
221-
const delta = Math.min(1/30, Math.max(0, (now - last) / 1000))
221+
const delta = Math.max(1e-6, Math.min(1/30, Math.max(0, (now - last) / 1000)))
222222
last = now
223223
update(undefined, delta)
224224
composer.render(delta)

packages/timeline/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function start<T>(timeline: Timeline<T>, abortSignal?: AbortSignal, onErr
8686
clock.actionTime += delta
8787
clock.timelineTime += delta
8888
clock.prevDelta = clock.delta
89-
clock.delta = Math.min(delta, 1 / 30)
89+
clock.delta = Math.max(1e-6, Math.min(delta, 1 / 30))
9090
ref.current?.(state, clock)
9191
}
9292
}

0 commit comments

Comments
 (0)