-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
1 parent
ca1c5a7
commit 549f4e6
Showing
43 changed files
with
7,470 additions
and
15,546 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
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,20 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
- run: npm ci --include=dev | ||
- run: npm run lint | ||
- run: npm test | ||
- run: npm run build |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
node_modules | ||
build | ||
build | ||
build_tests |
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 |
---|---|---|
|
@@ -19,25 +19,29 @@ Examples: | |
- [WebGL + CSS 3D](http://acko.net/files/threestrap/multiple_renderers.html) | ||
- [VR + Controls](http://acko.net/files/threestrap/vr2.html) | ||
|
||
# Usage | ||
## Usage | ||
|
||
Install via npm: | ||
|
||
``` | ||
```sh | ||
npm install threestrap | ||
``` | ||
|
||
Add `build/threestrap.js` to your Three.js: | ||
|
||
```html | ||
<!-- | ||
Or use CDNs like | ||
https://cdn.jsdelivr.net/npm/[email protected]/build/three.js | ||
--> | ||
<script src="three.js"></script> | ||
<script src="threestrap.js"></script> | ||
``` | ||
|
||
Get a threestrap context: | ||
|
||
```javascript | ||
var three = new Threestrap.Bootstrap(); | ||
const three = new Threestrap.Bootstrap(); | ||
``` | ||
|
||
This will create a full-page Three.js WebGL canvas, initialize the scene and | ||
|
@@ -48,7 +52,7 @@ the `three` context: | |
|
||
```javascript | ||
// Insert a cube | ||
var mesh = new THREE.Mesh( | ||
const mesh = new THREE.Mesh( | ||
new THREE.CubeGeometry(0.5, 0.5, 0.5), | ||
new THREE.MeshNormalMaterial() | ||
); | ||
|
@@ -135,11 +139,6 @@ When `init` is set to false, initialization only happens when manually calling | |
Plugins can make objects and methods available on the threestrap context, like | ||
`three.Time.now` or `three.Loop.start()`. | ||
|
||
## Builds | ||
|
||
- threestrap.js: Full build (but still requires three.js) | ||
- threestrap-core.js: Core only, requires three.js + lodash | ||
- threestrap-extra.js: Extra plugins | ||
|
||
## Plugins | ||
|
||
|
@@ -149,7 +148,7 @@ installed in the given order. | |
Plug-in specific options are grouped under the plug-in's name: | ||
|
||
```javascript | ||
var three = new Threestrap.Bootstrap({ | ||
const three = new Threestrap.Bootstrap({ | ||
plugins: ["core", "stats"], | ||
size: { | ||
width: 1280, | ||
|
@@ -185,7 +184,7 @@ three.off("event", handler); | |
You can also bind events directly to object methods using `.bind`: | ||
|
||
```javascript | ||
var object = { | ||
const object = { | ||
render: function (event, three) {}, | ||
yup: function (event, three) {}, | ||
redraw: function (event, three) {}, | ||
|
Oops, something went wrong.