Code viewer for World: One Cube World (Three.js) ...

// Cloned by kanish r on 29 Sep 2022 from World "One Cube World (Three.js)" by Starter user 
// Please leave this clone trail here.
 

const skycolor          = 'white';           
const boxcolor          = 'white';

const objectsize    = 300;                  // size of object   

const startRadius   = 1000;                 // distance from centre we start the camera at

const maxRadius     = startRadius * 10;     // maximum distance from camera we render things 

const texture = new THREE.TextureLoader().load( '/uploads/kanish1/ezgif.com-gif-maker.jpg' );
const material = new THREE.MeshBasicMaterial( { map: texture } );

const texture1 = new THREE.TextureLoader().load( '/uploads/kanish1/400px-HATT-004.jpg' );
const material1 = new THREE.MeshBasicMaterial( { map: texture1 } );

// the object is a cube (each dimension equal): 
  
var shape       = new THREE.SphereGeometry ( objectsize, objectsize, objectsize );
var shape1       = new THREE.SphereGeometry ( objectsize, objectsize, objectsize );
// var material    = new THREE.MeshBasicMaterial ( { color: boxcolor.toLowerCase() } );
var theobject   = new THREE.Mesh ( shape, material );

var theobject1   = new THREE.Mesh ( shape1, material1 );


// Define what the World does at the start of a run: 

AB.world.newRun = function() 
{
    // start a 3D scene: 
    ABWorld.init3d ( startRadius, maxRadius, skycolor ); 

    // add the object to the scene:
    ABWorld.scene.add ( theobject );
    ABWorld.scene.add ( theobject1 );
};

AB.world.nextStep = function()
{
    theobject.position.x = theobject.position.x + AB.randomIntAtoB ( -30, 30 );        
    theobject1.position.x = theobject1.position.x + AB.randomIntAtoB ( -150, 150 );        
};