Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Tilt.js | 3,554 | 52 | 8 months ago | 24 | November 09, 2017 | 47 | mit | JavaScript | ||
A tiny 60+fps parallax tilt hover effect for jQuery. | ||||||||||
React Scroll Parallax | 2,393 | 152 | 26 | 2 months ago | 103 | August 09, 2022 | 3 | mit | TypeScript | |
🔮 React hooks and components to create parallax scroll effects for banners, images or any other DOM elements. | ||||||||||
React Native Dribbble App | 2,014 | 2 years ago | 19 | mit | JavaScript | |||||
Dribbble app built with React Native | ||||||||||
Atropos | 1,529 | a year ago | 17 | February 17, 2022 | 4 | mit | JavaScript | |||
Stunning touch-friendly 3D parallax hover effects | ||||||||||
Sticky Parallax Header | 1,514 | 17 days ago | 72 | July 06, 2022 | 21 | mit | TypeScript | |||
A simple React Native library, enabling the creation of fully customized header for your iOS and Android apps. | ||||||||||
Gatsby Starter Portfolio Cara | 1,351 | 5 days ago | 0bsd | TypeScript | ||||||
Playful and Colorful One-Page portfolio featuring Parallax effects and animations. Especially designers and/or photographers will love this theme! Built with MDX and Theme UI. | ||||||||||
React Springy Parallax | 1,324 | 24 | 6 | 5 years ago | 15 | March 20, 2018 | 4 | mit | JavaScript | |
🌊 A springy, composable parallax-scroller for React - deprecated | ||||||||||
React Parallax Tilt | 731 | 2 | 8 | 2 days ago | 220 | July 15, 2022 | mit | TypeScript | ||
👀 Easily apply tilt hover effect on React components - lightweight/zero dependencies (3kB) | ||||||||||
React Plx | 631 | 35 | 4 | a month ago | 55 | June 19, 2022 | 2 | mit | TypeScript | |
React parallax component, powerful and lightweight | ||||||||||
Reactnativematerials | 629 | 3 years ago | 1 | |||||||
React Native的中文参考资料,包括开源库,文字/视频资料,相关工具等 |
_ Easily apply tilt hover effect on React components_
npm install react-parallax-tilt
import React from 'react';
import ReactDOM from 'react-dom';
import Tilt from 'react-parallax-tilt';
const App = () => {
return (
<Tilt>
<div style={{ height: '300px', backgroundColor: 'darkgreen' }}>
<h1>React Parallax Tilt </h1>
</div>
</Tilt>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
All of the props are optional.
Below is the complete list of possible props and their options:
indicates the default value if there's one
tiltEnable: boolean true
Boolean to enable/disable tilt effect.
tiltReverse: boolean false
Reverse the tilt direction.
tiltAngleXInitial: number 0
Initial tilt value (degrees) on x axis.
tiltAngleYInitial: number 0
Initial tilt value (degrees) on y axis.
tiltMaxAngleX: number 20
Max tilt rotation (degrees) on x axis (range: 0-90
).
tiltMaxAngleY: number 20
Max tilt rotation (degrees) on y axis (range: 0-90
).
tiltAxis: 'x' | 'y' undefined
Enable tilt on single axis.
tiltAngleXManual: number | null} null
Manual tilt rotation (degrees) on x axis.
tiltAngleYManual: number | null} null
Manual tilt rotation (degrees) on y axis.
glareEnable: boolean false
Boolean to enable/disable glare effect.
glareMaxOpacity: number 0.7
The maximum glare opacity (range: 0-1
).
glareColor: string #ffffff
Set color of glare effect.
glareBorderRadius: string 0
Accepts any standard CSS border radius. Useful if the glare color is different to the page color.
glarePosition: 'top' | 'right' | 'bottom' | 'left' | 'all' bottom
Set position of glare effect.
glareReverse: boolean false
Reverse the glare direction.
scale: number 1
Scale of the component (1.5 = 150%, 2 = 200%, etc.).
perspective: number 1000
The perspective property defines how far the object (wrapped/child component) is away from the user. The lower the more extreme the tilt gets.
flipVertically: boolean false
Boolean to enable/disable vertical flip of component.
flipHorizontally: boolean false
Boolean to enable/disable horizontal flip of component.
reset: boolean true
If the effects has to be reset on onLeave
event.
transitionEasing: string cubic-bezier(.03,.98,.52,.99)
Easing of the transition when manipulating the component.
transitionSpeed: number 400
Speed of the transition when manipulating the component.
trackOnWindow: boolean false
Track mouse and touch events on the whole window.
gyroscope: boolean false
Boolean to enable/disable device orientation detection.
onMove: Function => ({ tiltAngleX: number, tiltAngleY: number, tiltAngleXPercentage: number, tiltAngleYPercentage: number, glareAngle: number, glareOpacity: number, eventType: string }) => void
Gets triggered when user moves on the component.
onEnter: Function => (eventType: string) => void
Gets triggered when user enters the component.
onLeave: Function => (eventType: string) => void
Gets triggered when user leaves the component.
Please keep in mind that detecting device orientation is currently experimental technology.
Check the browser compatibility before using this in production.
A few takeaways when using device orientation event:
https
)<iframe>
elementApple decided turning device motion and orientation off by default since iOS 12.2.
With iOS 13+ permission API can be used to gain access to device orientation event.
When using gyroscope feature:
<Tilt gyroscope={true}>
<h1>React Parallax Tilt </h1>
</Tilt>
it will present a permission dialog prompting the user to allow motion and orientation access at domain level:
Note that user needs to take some action (like tapping a button) to be able to display the dialog (invoking dialog on page load is not possible).
Easily set up a local development environment!
Build project and start storybook on localhost:
npm install
npm start
Start coding!
npm install
npm link # link your local repo to your global packages
npm run build:watch # build the files and watch for changes
Clone project repo that you wish to test with react-parallax-tilt library and run:
npm install
npm link react-parallax-tilt # link your local copy into this project's node_modules
npm start
All contributions are welcome!
Please take a moment to review guidelines PR | Issues