threex module to get a nyancat in three.js. It is made out of the nyancat anonymous webgl demo. It is released under MIT license.
You can install it manually or with
bower.
for the manual version, first include threex.nyancat.js
with the usual
<script src='threex.nyancat.js'></script>
<script src='threex.nyancatrainbow.js'></script>
<script src='threex.nyancatsound.js'></script>
<script src='threex.nyancatstars.js'></script>
or with bower you type the following to install the package.
bower install -s threex.nyancat=https://github.com/jeromeetienne/threex.nyancat/archive/master.zip
then you add that in your html
<script src="bower_components/threex.nyancat/threex.nyancat.js"></script>
<script src="bower_components/threex.nyancat/threex.nyancatrainbow.js"></script>
<script src="bower_components/threex.nyancat/threex.nyancatsound.js"></script>
<script src="bower_components/threex.nyancat/threex.nyancatstars.js"></script>
You can find running code in examples/basic.html
.
demo live
To get poptart, the cat itself, include threex.nyancat.js
and do
var nyanCat = new THREEx.NyanCat()
scene.add( nyanCat.container )
updateFcts.push(function(delta, now){
if( paused ) return
nyanCat.update(delta, now)
})
To get music, include threex.nyancatsound.js
and do
var sound = new THREEx.NyanCatSound()
var paused = false;
document.body.addEventListener('mousedown', function(){
paused = paused ? false : true
sound.toggle()
})
To get the stars, include threex.nyancatstars.js
and do
var nyanStars = new THREEx.NyanCatStars()
scene.add( nyanStars.container )
updateFcts.push(function(delta, now){
if( paused ) return
nyanStars.update(delta, now)
})
To get the stars, include threex.nyancatrainbow.js
and do
var nyanRainbow = new THREEx.NyanCatRainbow()
scene.add( nyanRainbow.container )
updateFcts.push(function(delta, now){
if( paused ) return
nyanRainbow.update(delta, now)
})