Parallax Block

A reusable interpolated R3F scroll group with inherited section offsets and independent speed factors. Supply a ref through ScrollSceneProvider.

Exact preview of Parallax Block
Type
Component
Category
Scroll
Source license
MIT
Collection
Open Source Experiences

View source in the repository

Usage

// Place this example in vendor/experiences/substance/src/example.jsx.
// Use that project's isolated dependencies and Vite setup (see its README).
// Rebuild the included native runtimes with: npm run build:experiences

import { useRef } from 'react';
import { Canvas } from '@react-three/fiber';
import { ParallaxBlock, ScrollSceneProvider } from './parts/ParallaxBlock';

export function ScrollScene() {
  const scroll = useRef(0);
  return <div onWheel={event => { scroll.current += event.deltaY; }} style={{ height: 500 }}>
    <Canvas orthographic camera={{ zoom: 75, position: [0, 0, 20] }}>
      <ScrollSceneProvider scrollRef={scroll} pages={3} sections={3}>
        <ParallaxBlock factor={0.6} offset={0}>
          <mesh><planeGeometry args={[4, 3]} /><meshBasicMaterial color="#2fe8c3" /></mesh>
        </ParallaxBlock>
      </ScrollSceneProvider>
    </Canvas>
  </div>;
}

License and credits

The Substance by Paul Henschel. Original upstream source

Read the original MIT license

Credits and asset notices

Third-party assets and dependencies

Diamond by RBG_illustrations (https://sketchfab.com/StarkIndustries), CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Source: https://sketchfab.com/3d-models/diamond-7acd98d5c8df4e04a73ea5d5a81c8911. Original GLB retained; centered/scaled in runtime.

Photo credits: Barry Marsh (field-01/02), author-released public domain; Cornettesax (field-03), Kleseus (field-04), NonNerd (field-05), CC0. Source and license links: /experiences/substance/photo-credits.json.

Helvetiker Bold copyright 2004 MAGENTA Ltd.; full permissive font notice included at /experiences/substance/FONT-LICENSE.txt. Original MOONGET font and unclear photographs omitted.

Keep the original source and media notices with your copy.

Explore more

  • Liquid FormExact preview of Liquid Form

    A centered silver ray-marched liquid form with authored studio reflections and pointer-responsive camera drift.

  • Boarding PassExact preview of Boarding Pass

    A live flight pass whose changed gate and times roll over like a departures board.

  • Aurora TextExact preview of Aurora Text

    Multi-colour aurora motion within a large type specimen.

Frontfield homepage