I am trying to create a website. The link for the website is:
http://www.eclectika.org/test3
I want the birds in the following link:
http://mrdoob.github.io/three.js/examples/canvas_geometry_birds.html
to be in my background. Please someone suggest me the way. I have tried many things. Still cant get it right.
Also please suggest a way to change the color of the birds.
its pretty easy to change colors to a material... In render function just remove the below mentioned line...you can view random colors of birds..
the below line coding does the material random coloring... {color:Math.random() *0xffffff} gives random color to all birds... just change it as color:0x000000... u can view the bird color in black....
it will do the trick...
Learning three.js will defiantly helps.
The
Renderer
function just creates a new DOM element and draws theScene
on it.So the easiest way you can achieve your goal is that you set the
z-index
css property of every other element on the ui higher than this Three.js DOM element.That is infact how the
Stats Element
(the one which shows you the current FPS ) is placed on top of the webGL element.Update 1:
If you look at the DOM or the threejs implementation of WebGLRenderer you will find ,it creates a canvas element if it doesn't finds one. so in your CSS you can set the z-index property of this element in negative to achieve your desired result
Update 2: Changing material color:
you can initialize the color in threejs like this.
or
official documentation here
then you just need to set this color in the material's color property by just removing the following lines of code from the
render
functionand adding these lines instead.