Ancient Brain
  
Drag the background!
 

Step 8. Paint the cube

The cube is "painted" with a solid color. It would be nice to paint it with a JPEG or PNG image.

Insert the following code at the top of the program:

var img;

function preload() 
{
   img = loadImage ( '/uploads/starter/earth.1.jpg' );
}

Put the following code inside the "draw" function. Remove the line that makes the cube a solid color, and insert this line instead:

texture(img);        	

You will now get something like the following:


The background is a program, showing the JavaScript graphics used on this site.
The globes light up when you log in. Drag the background to move the camera.
Customise background:  
Font:

Website © Ancient Brain 2025.
Users retain ownership of user content.

Platforms      Stats      The name      Terms and conditions

Call for partners      Contact

Call for partners!
Ancient Brain is looking for a partner to co-write a JavaScript coding book for schools, to be used worldwide. This would be a course for students in learning to code from scratch. The book and course will be integrated into the Ancient Brain site. This is an opportunity for someone looking to develop a course and textbook to partner with a site to promote it. Read more.