- Upgrade
@studio-freight/lenis
tov1.0.23
SmoothScrollbar
Passing in children is now obsolete and not needed. The only reason was to setpointer-events: none
on the children while scrolling. We now do this directly ondoucment.documentElement
. This change makes it easier to dynamically import and conditionally render the scrollbar to split the bundle.
- Upgrade
@studio-freight/lenis
tov1.0.16
-
Upgrade
@studio-freight/lenis
tov1.0.10
-
GlobalCanvas
- Add back:
as
props to allow changing the default R3F Canvas component. Prep work for supporting custom tree shaked canvas or perhaps react-three-offscreen in the future
- Add back:
Simplify render logic and improve camera controls.
-
ViewportScrollScene
- Feat: now uses portal state enclave for camera so you can use OrbitControls or pass in a custom camera as a child.
- Feat: No longer clears depth by default
- Feat: added
hud
prop to clear depth - Feat: aadded
camera
prop to allow overriding default camera settings- specifying
fov
will calculate distance to match the DOM
- specifying
- Removed
renderOrder
- can be set manually on children instead
-
ScrollScene
- Removed
renderOrder
- can be set manually on children instead
- Removed
-
GlobalCanvas
- Fix: make sure
viewport
is correct after resize when using default perspective camera - Feat:
camera
prop now allows overridingfov
. Iffov
is specified, the camera distance will be calculated to match DOM size. - Feat: Default camera FoV now set to 50
- Removed:
globalClearAlpha
- can be controlled by other useFrames with higher or lower priority instead - Removed:
as
- always renders as a default R3F Canvas.react-xr
no longer uses VRCanvas and ARCanvas.
- Fix: make sure
-
useImageAsTexture
- Fix: better support for next/image loading="lazy"
-
SmoothScrollbar
- Fix: make sure binding an onScroll callback fires an initial scroll event
Added some properties to help support having multiple SmoothScrollbar on the page at the same time. The usecase is to open a Modal on top of the current page which also needs to be smooth scrolled.
-
useTracker
- Added
wrapper
option to get initial scroll offset from DOM element instead of the window object. - Added
scroll
prop toupdate({ scroll })
to update tracker with custom scroll state. Useful when having a secondary scrollbar mounted.
- Added
-
SmoothScrollbar
- Added
onScroll
prop to register a scroll event callback. - Added
updateGlobalState
prop. True by default. Set it to false to disable updating the global scroll state. Useful when having a secondary scrollbar mounted.
- Added
-
scrollInContainer
- Feat: Added experimental
scrollInContainer
prop which scrolls inside the body element instead of the default window. This can be used to avoid scrolling away the URL bar on mobile. It also enables thesmoothTouch
setting in Lenis which emulates scroll using touch events.
- Feat: Added experimental
-
useTracker
- Fix: Matches height of canvas element instead of window.innerHeight if possible. (Fixes position problems on mobile where canvas is 100vh)
- All files converted to TypeScript
-
Fixed SSR warnings by replacing
uesLayoutEffect
withuseIsomorphicLayoutEffect
-
GlobalCanvas
- removed
loadingFallback
- children can now be a render function (optional). It accepts the global canvas children from useCanvas as a single parameter. This can be used to add suspense boundaries.
<GlobalCanvas> {(globalChildren) => ( <Suspense fallback={null}> {globalChildren} <AnotherPersistentComponent /> </Suspense> )} </GlobalCanvas>
- removed
-
useImageAsTexture
- Added WebP Accept header to fetch request if supported by brower
- Notifies the DefaultLoadingManager that something is loading while waiting for the DOM image load.
-
Added global css with classes that can hide DOM elements when canvas is active
import "@14islands/r3f-scroll-rig/css";
-
Global export
styles
added to access CSS class names from Javascript.
import { styles } from '@14islands/r3f-scroll-rig'
function Component() {
return <div className={styles.hidden}>I will be `visibility: hidden` if WebGL is supported</div>
}
-
Removed
useCanvasRef
- use exported classnames and global CSS to hide elements via SSR instead to avoid FOUC -
SmoothScrollbar
- Replaced global html classname
js-has-smooth-scrollbar
with two classes:js-smooth-scrollbar-enabled
andjs-smooth-scrollbar-disabled
- Replaced global html classname
-
useCanvas
- improved optiondispose:false
to keep unused meshes mounted. Now passes aninactive
prop to the component which is true if no hook is using the mesh. -
useTracker
- new call signature- first argument is always the DOM ref
- second argument is the optional config settings for the IntersectionObserver
GlobalCanvas
children
can now be a render function which accepts all global children as a single argument. Can be used if you need to wrap all canvas children with a parent.
-
useTracker
hook- Added
autoUpdate
configuration which decides if the tracker automatically updates on scroll events. True by default. - The
update
callback will now always recalculate positions even if element is outside viewport in case user wants to turn off autUpdate and take control.
- Added
-
SmoothScrollbar
- Added
horizontal
prop
- Added
-
useTracker
hook- Added
threshold
prop which can used to customize the underlying Intersection Observer of the tracked DOM element
- Added
-
ScrollScene
andViewportScrollScene
- Added
inViewportThreshold
prop which is passed touseTracker
asthreshold
- Added
Complete refactor with focus on reducing complexity.
Now uses mostly R3F defaults and <GlobalCanvas>
accepts all R3F Canvas props.
Advanced use-cases are enabled only when setting frameloop="demand"
- so most users won't have to worry about this.
- @react-three/fiber
">=8.0.0"
- Three.js
>=0.139.0
is now required for colorManagement
- Started adding typescript
- Uses
https://github.com/studio-freight/lenis
scrollbar - New hook
useTracker
that tracks DOM elements - refactoredScrollScene
andViewportScrollScene
to use this internally. - New hook
useCanvasRef
which can be used to hide tracked DOM elements when the canvas is active. - New hook
useImageAsTexture
which loads images from the DOM and suspends via useLoader. Replaces the olduseImgTagAsTexture
which did not suspend properly and was more of a hack.
-
Removed
useImgTagAsTexture
. UseuseImageAsTexture
instead. -
ScrollScene
andViewportScrollScene
- Renamed
el
prop totrack
inViewportMargin
is now a string and maps to IntersectionObserverrootMargin
- Removed
lerp
,lerpOffset
. Uses the SmoothScrollbar position directly. - Removed
setInViewportProp
prop. Instead uses IntersectionObserver to always setinViewport
prop. - Removed
updateLayout
- relac position using thereflow()
method fromuseSrcollRig()
instead. - Removed
positionFixed
- suggest implementing manually in some other way usinguseTracker
. - Removed
autoRender
- suggest implementing manually in a custom component usinguseTracker
. - Removed
resizeDelay
- Removed
hiddenStyle
- useuseCanvasRef
instead to control how tracked DOM elements are hidden.
- Renamed
-
VirtualScrollbar
andHijackedScrollbar
removed. UseSmoothScrollbar
instead which is similar to the old hijacked version. -
GlobalCanvas
- Removed
config
prop and added individual props instead:- Added
debug
to turn on shader compile errors and show console.logs - Added
scaleMultiplier
to control viewport units scaling - Added
globalRender
- enable/disable built-in render loop - Added
globalPriority
- enable/disable built-in render loop - Added
globalAutoClear?: boolean
to control ifgl.clearDepth()
is called before render in global render loop. Defaultfalse
- render as HUD on top of viewports without clearing them. - Added
globalClearDepth?: boolean
to controlgl.autoClear
in global render loop. Defaulttrue
.
- Added
- Renamed
fallback
property toloadingFallback
for global Suspense fallback as R3F Canvas already has a prop with this name
- Removed
-
examples/ folder removed
-
added new import target
@14islands/r3f-scroll-rig/powerups
with useful helpers - might become separate repo later
- update to R3f v7
- Enables autoRender by default if frameloop="always"
- Updated to R3F v6 api.
lerpOffset
is now a factor that is multiplied with the lerp instead of added. Default value is now1
instead of0
.
Breaking upgrade. Simplify and remove as much as possible.
requestFrame
is now removed. please useinvalidate
to trigger useFrame- global render pass now run with priority
1000
renderFullscreen
has been renamed torequestRender
- use this to trigger a global render pass.renderScissor
andrenderViewport
now renders immediately. useuseFrame() priority
to render before or after global renderpreloadScene
now runs with priority0
ScrollScene
andViewportScrollScene
runs with priority1
by defaultScrollScene
andViewportScrollScene
now accepts apriority
prop to change theuseFrame
priority.- all
pause
andsuspend
logic has been removed
Added stdlib
export target with the following reusable components:
- WebGLText
- WebGLImage
- ParallaxScrollScene
- StickyScrollScene
E.g. import { StickyScrollScene } from '@14islands/r3f-scroll-rig/stdlib
- Added back Stats component.
fps
config and querystring now works again
- New experimental scrollbar with animates
window.scrollTo
instead of translating sections with CSS.
- Removed. Consider using
ScrollPortal
or usedrei
'sHTML
component instead.
- Removed
framer-motion
dependency.
- Removed
framer-motion
dependency.
- Removed
framer-motion
dependency.
- Removed experimental
softDirection
- Removed
framer-motion
dependency.
- Added config option
subpixelScrolling
that affects ScrollScene. If false, the scroll poition will be rounded to an integer (browsers usually do this with normal scroll)
portalEl
now needs to be passed as an argument. GlobalCanvas no longer provides a default portal.
antialias
anddepth
are nowtrue
by default.VirtualScrolbar
now uses same lerp & restDelta as Canvas components
- No more automatic switching between global vs scissor renders. To make it more predictable, scissor passes are always rendered if requested.
scissor
is now false by default
- New prop
scrollToTop
(false by default) to automatically scroll to top of page when scrollbar mounts. (used to be true by default)
gl.autoClear
is now only turned off if we have viewports renderering before main global render call. This fixes background alpha glitch on Oculus browser and WebXR clearing issues.
- New property
as
to support rendering the global canvas as aVRCanvas
for instance.
PerspectiveCameraScene
renamed toViewportScrollScene
with optional propertyorthographic
to switch between orthographic and perspective cameras. Both are scaled to fit the viewport exactly.
- Uses custom cameras for global
scaleMultiplier
to work properly. Bypasses all built-in @react-three/fiber camera logic. Propertyorthogonal
is used to select which camera. - added
fps
setting to theconfig
propery which overrides scroll-rig config Querystring value forfps
anddebug
override this config. - Default pixelRatio scaling can now be turned off with
config={{autoPixelRatio: false}}
- turned stencil buffer on by default (not sure disabling did anything good for perf anyway)
- removed gl properties
preserveDrawingBuffer: false
andpremultipliedAlpha: true
that are default in threejs anyway to simplify
- Deprecated
layoutOffset
andlayoutLerp
. Should be implemented by child component.
- Deprecated
state
prop passed to child. Replaced byscrollState
- Deprecated
state
prop passed to child. Replaced byscrollState
- Accepts
scaleMultiplier
prop which overrides global setting
config
propery which overrides scroll-rig config. Props that might be useful to change aredebug
,scaleMultiplier
,scrollLerp
.scaleMultiplier
config added which affects PerspectiveCameraScene and ScrollScene scaling. Used to scale pixels vs viewport units (1 by default, i.e. 1px = 1 viewport unit). Suggest using0.001
for perspective scenes to avoid depth buffer sorting issues etc. (1000px == 1 viewport unit)
- Scale scene using global
config.scaleMultiplier
- Scale scene using global
config.scaleMultiplier
- Fix broken resize logic under some race conditions
- Viewport scenes can now renderOnTop to render after global queue
- depth is no longer disabled
- config.fbo is removed, implement in your app instead
renderScissor
is deprecated
- Uses
createPortal
instead of nested scene and all of its problems (sweet!) - New prop
renderOnTop
to render after global render
- WebGL 2.0 by default
resizeOnHeight
added to GlobalCanvas (default true)
live
flag is now calledupdateLayout
getOffset
->layoutOffset
scene
prop passed to children is no longer a ref
- Uses
createPortal
instead of nested scene and all of its problems (sweet!)
GlobalRenderer
- colorManagement=true + gl.toneMapping = NoToneMapping to match hex with DOM
resizeOnWebFontLoaded
added to ResizeManager