The thing is that I made a reflection cube where each side image change randomly each time that I reload my site.
This is the code that I made:
var imgAr = [
'sources/instagram2/image1.jpg',
'sources/instagram2/image2.jpg',
'sources/instagram2/image3.jpg',
'sources/instagram2/image4.jpg',
'sources/instagram2/image5.jpg',
'sources/instagram2/image6.jpg',
'sources/instagram2/image7.jpg',
'sources/instagram2/image8.jpg',
'sources/instagram2/image9.jpg',
'sources/instagram2/image10.jpg'
];
var urls = imgAr.sort(function(){return .6 - Math.random()}).slice(0,6);
var reflectionCube = THREE.ImageUtils.loadTextureCube( urls, THREE.CubeReflectionMapping );
I have a lot of images with the same name style in the same folder (image1, image2, etc) so I tryied to find a way to write a code where I could specify that I want to use all the files which name ends with a number.
I made this code but it doesnt work :
var nrString = "000";
images = [
'sources/instagram2/image' + nrString + ".jpg",
'sources/instagram2/image' + nrString + ".jpg",
'sources/instagram2/image' + nrString + ".jpg",
'sources/instagram2/image' + nrString + ".jpg",
'sources/instagram2/image' + nrString + ".jpg",
'sources/instagram2/image' + nrString + ".jpg"
];
var urls = images.sort(function(){return .6 - Math.random()}).slice(0,6);
var reflectionCube = THREE.ImageUtils.loadTextureCube( urls, THREE.CubeReflectionMapping );
I hope that someone can help me. I have days trying to make it.