Skip to content

zxdong262/universe

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

this plugin will draw simple universe in canvas with three.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published