0.3.0 • Published 5 years ago

@electerm/electerm-bg v0.3.0

Weekly downloads
116
License
-
Repository
github
Last release
5 years ago

universe-bg

a simple universe bg plugin build with three.js

demo

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

install

npm i universe-bg
# or
bower install 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
      ,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