Skip to content

Instantly share code, notes, and snippets.

@pavelvasev
Created May 27, 2015 18:04
Show Gist options
  • Save pavelvasev/119b78009294e63c0df5 to your computer and use it in GitHub Desktop.
Save pavelvasev/119b78009294e63c0df5 to your computer and use it in GitHub Desktop.
Scene {
text: "Подключение ThreeJS-объекта + параметры"
Param {
id: c1
text: "count 1"
value: 500
max: 10000
}
MyPointCloud {
color: 0xffff00
radius: 5
data: makeRand(c1.value)
}
Param {
id: c2
text: "count 2"
value: 500
max: 10000
}
MyPointCloud {
color: 0xff0000
radius: 5
data: makeRand(c2.value)
id: cube2
}
/*
RenderTick {
onAction: cube2.color = [Math.sin(time),Math.cos(time),0];
}
*/
function makeRand( n ) {
var acc = [];
var r = 100;
for (var i=0; i<n; i++) {
acc.push( r*(Math.random()-0.5) ); //x
acc.push( r*(Math.random()-0.5) ); //y
acc.push( r*(Math.random()-0.5) ); //z
}
return acc;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment