Skip to content
this plugin will draw simple universe in canvas with three.js
JavaScript HTML
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build
src
.babelrc
.eslintignore
.gitignore
.npmignore
LICENSE
README.md
package-lock.json
package.json

README.md

universe-bg

a simple universe bg plugin build with three.js

demo

http://html5beta.com/apps/universe.html

install

npm i universe-bg

use

<script src='//unpkg.com/three/build/three.min.js'></script>
<script src='//unpkg.com/universe-bg/dist/universe.min.js'></script>
<script>
// instantiate a loader
var loader = new THREE.TextureLoader()
var Universe = window.Universe.default
// load a resource
loader.load(
  // resource URL
  '//unpkg.com/universe-bg/dist/star.png',
  // Function when resource is loaded
  function ( texture ) {

    let uni = new Universe({
      size: 5, //star size
      id: null, //id
      starNumber: 10000,
      color: 0xffffff,
      width: null,
      height: null,
      background: '#000000',
      container: document.getElementById('wrapper'),
      map: texture
    })

  }
)

</script>

or

import Universe from 'universe-bg'
// instantiate a loader
var loader = new THREE.TextureLoader()
// load a resource
loader.load(
  // resource URL
  '//unpkg.com/universe-bg/dist/star.png',
  // Function when resource is loaded
  function ( texture ) {

    let uni = new Universe({
      size: 5 //star size
      ,id: null //id
      ,starNumber: 10000
      ,color: 0xffffff
      ,width: null
      ,height: null
      ,container: document.getElementById('wrapper')
      ,map: texture
    })

  }
)

LICENCE

MIT

You can’t perform that action at this time.