I am making my first steps coding with JavaScript and playing with Three.js.
I was exploring and I found an amazing tutorial of Paul Lewis to make an interactive liquid sphere. Here is the codepen that I made http://codepen.io/gnazoa/pen/ZQzEqX
I am trying to change the code to animate an external model that I am loading using the Binary Loader. I have the following code but it doesn't work http://codepen.io/gnazoa/pen/MKgWxE.
The google chrome JavaScript console tells that there is a syntax error in this function
function createObjects() {
var numberOfImages = 46,
images = [];
for (var i = 1; i <= numberOfImages; i++) {
images.push('sources/instagram2/image' + i + ".jpg");
}
var urls = images.sort(function () {
return .6 - Math.random()
}).slice(0, 6);
textureCube = THREE.ImageUtils.loadTextureCube(urls);
var loader = new THREE.BinaryLoader();
loader.load("https://raw.githubusercontent.com/mrdoob/three.js/master/examples/obj/walt/WaltHead_bin.js", function ( Geometry ) {
var Material = new THREE.MeshLambertMaterial({
color: 0xEEEEEE,
envMap: textureCube,
shininess: 200,
shading: THREE.SmoothShading,
});
sphere = new THREE.Mesh(Geometry, Material);
sphere.geometry.dynamic = true;
sphere.position.y = 0;
scene.add(sphere);
});
lightFront = new THREE.PointLight(0xFFFFFF, 1.5);
lightFront.position.y = 400;
scene.add(lightFront);
// and another from the bottom
lightBottom = new THREE.DirectionalLight(0xFFFFFF, 1.3);
lightBottom.position.y = -240;
scene.add(lightBottom);
}
I have one week watching tutorials and reading books to solve this problem and I can't do it. I know that maybe is something really easy for an experimented person so if you can give me a conseil it would be amazing.
Thank you very much