• Stars
    star
    1,328
  • Rank 35,391 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌊 A springy, composable parallax-scroller for React - deprecated

*** This project has been merged into react-spring: https://github.com/drcmda/react-spring

*** Changes and bugfixes will go there instead.

--

A springy, composable parallax-scroller for React.

npm install react-springy-parallax --save

Demo: http://react-springy-parallax.surge.sh

Simple example: http://react-springy-parallax-simple.surge.sh

Example source: https://github.com/drcmda/react-springy-parallax/blob/master/example/index.js

More complex example: https://github.com/drcmda/awv3node-homepage (the one in the thumbnail)

intro

How to use

import Parallax from 'react-springy-parallax'

// Pages determines the total height of the inner content container
// Each page takes 100% height of the visible outer container by default
<Parallax ref='parallax' pages={3}>

    // Add as many layers as you like
    <Parallax.Layer
        // Page offset, or where the layer will be at when scrolled to
        // 0 means start, 1 second page, 1.5 second and half, and so on ...
        offset={0}
 Β  Β  Β  Β // Parallax factor, allows for positive and negative values
        // Shifts the layer up or down in accordance to its offset
        speed={0.5}>

        <span>Layers can contain anything</span>

    </Parallax.Layer>

</Parallax>

Can the effect be configured or muted?

Yes, you can use anything the Animated library offers: http://browniefed.com/react-native-animation-book

import Animated from 'animated/lib/targets/react-dom'
import Easing from 'animated/lib/Easing'

<Parallax
    effect={(animation, toValue) =>
        Animated.timing(animation, { toValue, duration: 200, easing: Easing.elastic(2) })}
    ... >

Or a zero timer for a tame, old-school parallax:

effect={(animation, toValue) =>
    Animated.timing(animation, { toValue, duration: 0 })}

Is it possible disable the scroll bar for custom page navigation?

Yes. In this mode it will also make sure window-resize retains the last page seen.

You can always use scrollTo, scroll bar or not, there is no restriction.

<Parallax
    ref={ref => this.parallax = ref}
    scrolling={false}
    ... >
    <Parallax.Layer>
        <div onClick={() => this.parallax.scrollTo(1)}>
            Click to get to the next page

Does it scroll horizontally as well?

Sure does.

<Parallax horizontal ... >

More Repositories

1

mauerwerk

βš’ A react-spring driven masonry-like grid with enter/exit and shared element transitions
JavaScript
831
star
2

react-animated-tree

🌲Simple to use, configurable tree view with full support for drop-in animations
JavaScript
815
star
3

react-contextual

πŸš€ react-contextual is a small (less than 1KB) helper around React 16s new context api
JavaScript
643
star
4

the-substance

Scroll, Refraction and Shader Effects in Three.js and React
JavaScript
371
star
5

poimandres-theme

⚫️ poimandres vsc theme
JavaScript
218
star
6

floating-shoe

JavaScript
171
star
7

immer-wieder

✨ React 16 context wrap with redux semantics powered by immer
JavaScript
167
star
8

learnwithjason

Learn how to use theejs in react using react-three-fiber πŸŽ‰
JavaScript
121
star
9

reactanoid

JavaScript
98
star
10

testlighting

JavaScript
93
star
11

scheduler-test

JavaScript
56
star
12

r3fv4

Created with CodeSandbox
JavaScript
34
star
13

r3f-aesop

JavaScript
21
star
14

nft-gallery

Created with CodeSandbox
JavaScript
17
star
15

react-higher-order

β˜”οΈ Maps render props to a higher order component
JavaScript
16
star
16

splats

TypeScript
15
star
17

untitled-game

Created with CodeSandbox
JavaScript
14
star
18

arc-x-pmndrs

JavaScript
12
star
19

projects

projects
JavaScript
7
star
20

react-spring-numerical

πŸ™Œ React-springs leaner doppelgΓ₯nger
JavaScript
7
star
21

awv3node-homepage

JavaScript
5
star
22

scroll-template

JavaScript
4
star
23

dom-resize

JavaScript
3
star
24

threeparcel

JavaScript
3
star
25

reacteurope

JavaScript
3
star
26

testsvg

2
star
27

plugs-draft

JavaScript
1
star
28

meshtransmissionmaterial

JavaScript
1
star
29

vite-three-js

JavaScript
1
star
30

zustand-website

CSS
1
star