-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
820 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
|
||
<p align="middle"><img src="https://daybrush.com/scenejs/images/clapperboard.png" width="250"/></p> | ||
<h2 align="middle">React Scene.js</h2> | ||
|
||
|
||
<p align="middle"><a href="https://www.npmjs.com/package/react-scenejs" target="_blank"><img src="https://img.shields.io/npm/v/react-scenejs.svg?style=flat-square&color=007acc&label=version" alt="npm version" /></a> | ||
<img src="https://img.shields.io/badge/language-typescript-blue.svg?style=flat-square"/> | ||
<a href="https://github.com/daybrush/scenejs/blob/master/LICENSE" target="_blank"><img src="https://img.shields.io/github/license/daybrush/scenejs.svg?style=flat-square&label=license&color=08CE5D"/></a> | ||
</p> | ||
|
||
|
||
<p align="middle">🎬 A React Component that create JavaScript & CSS timeline-based animation with Scene.js.</p> | ||
|
||
<p align="middle"><a href="https://daybrush.com/scenejs"><strong>About Scene.js</strong></a> / <a href="https://daybrush.com/scenejs/release/latest/doc"><strong>API</strong></a> / <a href="https://daybrush.com/scenejs/features.html"><strong>Features</strong></a></p> | ||
<br/> | ||
|
||
## Demos | ||
* CodeSandbox 1 (Scene) | ||
* CodeSandbox 2 (Scene / SceneItem) | ||
|
||
## Installation | ||
```bash | ||
$ npm install react-scenejs | ||
``` | ||
|
||
|
||
## Make Scene | ||
```jsx | ||
import { | ||
useScene, | ||
useSceneItem, | ||
useFrame, | ||
useNowFrame, | ||
} from "react-scenejs"; | ||
|
||
|
||
function App() { | ||
const scene = new Scene({ | ||
"a1": { | ||
0: { | ||
left: "0px", | ||
top: "0px", | ||
transform: `translate(0px, 0px)`, | ||
}, | ||
1: { | ||
left: "100px", | ||
top: "100px", | ||
transform: `translate(100px, 0px)`, | ||
}, | ||
}, | ||
"a2": { | ||
0: { | ||
left: "0px", | ||
top: "0px", | ||
transform: `translate(0px, 0px)`, | ||
}, | ||
1: { | ||
left: "100px", | ||
top: "100px", | ||
transform: `translate(100px, 0px)`, | ||
}, | ||
} | ||
}); | ||
const a1Frame = useNowFrame(scene.getItem("a1")); | ||
const a2Frame = useNowFrame(scene.getItem("a2")); | ||
|
||
useEffect(() => { | ||
scene.play(); | ||
}, []); | ||
return <div className="container"> | ||
<div className="a1" style={a1.camelCasedCSSObject}></div> | ||
<div className="a2" style={a1.camelCasedCSSObject}></div> | ||
</div>; | ||
|
||
} | ||
|
||
``` | ||
|
||
|
||
|
||
## Development | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.<br> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br> | ||
You will also see any lint errors in the console. | ||
|
||
|
||
## ⭐️ Show Your Support | ||
Please give a ⭐️ if this project helped you! | ||
|
||
|
||
## 👏 Contributing | ||
|
||
If you have any questions or requests or want to contribute to `scenejs` or other packages, please write the [issue](https://github.com/daybrush/scenejs/issues) or give me a Pull Request freely. | ||
|
||
|
||
### Code Contributors | ||
|
||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. | ||
|
||
<a href="https://github.com/daybrush/scenejs/graphs/contributors"> | ||
<img src="https://contrib.rocks/image?repo=daybrush/scenejs" /> | ||
</a> | ||
|
||
|
||
## Sponsors | ||
<p align="center"> | ||
<a href="https://daybrush.com/sponsors/sponsors.svg"> | ||
<img src="https://daybrush.com/sponsors/sponsors.svg"/> | ||
</a> | ||
</p> | ||
|
||
|
||
## 🐞 Bug Report | ||
|
||
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/scenejs/issues) on GitHub. | ||
|
||
|
||
|
||
## 📝 License | ||
|
||
This project is [MIT](https://github.com/daybrush/scenejs/blob/master/LICENSE) licensed. | ||
|
||
|
||
## License | ||
|
||
``` | ||
MIT License | ||
Copyright (c) 2016 Daybrush | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"name": "react-scenejs", | ||
"version": "2.0.0-beta.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/daybrush/scenejs.git" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"reactive", | ||
"hooks", | ||
"use", | ||
"scene", | ||
"scene.js", | ||
"scenejs", | ||
"keyframes", | ||
"timeline", | ||
"animate", | ||
"animation", | ||
"css", | ||
"requestAnimationFrame", | ||
"motion" | ||
], | ||
"author": "Daybrush", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/daybrush/scenejs/issues" | ||
}, | ||
"homepage": "https://daybrush.com/scenejs", | ||
"files": [ | ||
"./*", | ||
"dist/*", | ||
"declaration/*" | ||
], | ||
"dependencies": { | ||
"@cfcs/react": "^0.0.9", | ||
"scenejs": "~1.7.1" | ||
}, | ||
"scripts": { | ||
"start": "rm -rf ./node_modules/.cache && react-scripts start", | ||
"build": "rollup -c", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@daybrush/builder": "^0.2.0", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@testing-library/user-event": "^13.5.0", | ||
"@types/jest": "^27.5.2", | ||
"@types/node": "^16.18.9", | ||
"@types/react": "^18.0.26", | ||
"@types/react-dom": "^18.0.9", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-scripts": "5.0.1", | ||
"typescript": "^4.5.0<4.6.0", | ||
"web-vitals": "^2.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const builder = require("@daybrush/builder"); | ||
|
||
const defaultOptions = { | ||
tsconfig: "tsconfig.build.json", | ||
}; | ||
|
||
module.exports = builder([ | ||
{ | ||
...defaultOptions, | ||
input: "src/react-scenejs/index.tsx", | ||
output: "./dist/scene.esm.js", | ||
visualizer: true, | ||
format: "es", | ||
exports: "named", | ||
}, | ||
{ | ||
...defaultOptions, | ||
input: "src/react-scenejs/index.tsx", | ||
output: "./dist/scene.cjs.js", | ||
format: "cjs", | ||
exports: "named", | ||
}, | ||
]); |
Oops, something went wrong.