@@ -37,12 +37,25 @@ function update() {
3737 renderer.render(scene, camera);
3838 }
3939
40+function randomColor () {
41+ var hex = "0123456789abcdef",
42+ color = "0x",
43+ key;
44+
45+ while (color.length !== 8) {
46+ key = Math.floor(Math.random() * hex.length);
47+ color += hex[key];
48+ }
49+
50+ return color;
51+}
52+
4053 function makeParticles () {
4154 var particle, material;
4255
4356 for (var zpos = 1000; zpos > -1000; zpos -= 20) {
4457 material = new THREE.ParticleCanvasMaterial({
45- color: 0xffffff,
58+ color: randomColor(),
4659 program: particleRender
4760 });
4861
@@ -61,11 +74,18 @@ function makeParticles () {
6174 }
6275 }
6376
64-function particleRender (context) {
65- context.beginPath();
77+function particleRender (ctx) {
78+ ctx.beginPath();
79+
80+ ctx.moveTo(3, 0); // 3,0 top point
81+
82+ ctx.lineTo(5, 6); // 5,6 bottom right point
83+ ctx.lineTo(0, 2); // 0,2 top left point
84+ ctx.lineTo(6, 2); // 6,2 top right point
85+ ctx.lineTo(1, 6); // 1,6 bottom left point
86+ ctx.lineTo(3, 0); // connect to the top point
6687
67- context.arc(0, 0, 1, 0, Math.PI * 2, true);
68- context.fill();
88+ ctx.fill();
6989 }
7090
7191 function updateParticles () {