React Scene.js
About Scene.js / API / Features / CodeSandbox Demo
Installation
$ npm install react-scenejsMake scene
import { Scene, SceneItem } from "react-scenejs";
const keyframes = {
".circles .circle": (i: number) => ({
0: {
"border-width": "150px",
"opacity": 1,
"transform": "translate(-50%, -50%) scale(0)",
},
1.5: {
"border-width": "0px",
"opacity": 0.3,
"transform": "scale(0.7)",
},
options: {
delay: i * 0.4,
},
}),
};
render() {
return (<Scene
keyframes={this.keyframes}
easing="ease-in-out"
fillMode="forwards"
direcition="normal"
iterationCount={1}
playSpeed={1}
delay={0}
time={0}
css={false}
autoplay={false}
ready={true}
onPlay={e => { console.log(e); }}
onPaused={e => { console.log(e); }}
onAnimate={e => { console.log(e); }}
onTimeUpdate={e => { console.log(e); }}
onIteration={e => { console.log(e); }}
onEnded={e => { console.log(e); }}
>
<div className="circles">
<div className="circle circle1"></div>
<div className="circle circle2"></div>
<div className="circle circle3"></div>
</div>
</Scene>);
}Props
| name | type | default | description |
|---|---|---|---|
| css | boolean | false | Check to play with CSS |
| autoplay | boolean | false | Check to play automatically |
| keyframes | object | {} | Specify properties by time. |
| ready | boolean | true | Check if you are ready to init and play. |
| ...options | Check out the options | ||
| ...events | Check out Scene's events Check out SceneItem's events |
Development
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
License
MIT License
Copyright (c) 2016 Daybrush
