// Cloned by tom on 25 May 2018 from World "One Cube World" by Starter user
// Please leave this clone trail here.
const skycolor = 'Aqua'; // sky color
const objectsize = 450; // size of object
const startRadius = 700; // distance from centre we start the camera at
const maxRadius = startRadius * 10; // maximum distance from camera we render things
const skycolorObject = new THREE.Color ( skycolor.toLowerCase() );
function World()
{
// the object is a cube (each dimension equal):
var shape = new THREE.BoxGeometry ( 500, 500, 10 );
var theobject = new THREE.Mesh ( shape );
this.newRun = function()
{
// start a 3D scene:
threeworld.init3d ( startRadius, maxRadius, skycolorObject );
// add the object to the scene:
threeworld.scene.add(theobject);
const texturefile = "/uploads/tus/big_1487118622_image.jpg";
var texture = new THREE.ImageUtils.loadTexture ( texturefile );
texture.minFilter = THREE.LinearFilter;
theobject.material = new THREE.MeshBasicMaterial ( { map: texture } );
};
function randomAtoB ( A, B ) // function to return random number from A to B
{
return ( A + ( Math.random() * (B-A) ) ); // Math.random() gives random real number from 0 to 1
}
this.nextStep = function()
{
theobject.position.x = theobject.position.x + randomAtoB ( 3, 3 );
};
}
const themusic = '/uploads/tus/Chad_Crouch_-_De_Facto.mp3';
var a = new Audio ( themusic );
a.loop = true; // loop the music forever
a.play();