Cube Image

Click here for the starter code. Make sure to fork the project to create your own version!

This example shows how to make a cube (or box) in 3D! The code in the script.js file adds an image as the texture for the box, and a background image as well.

Try changing all the variables to make this project your own! Here are the variables you can change:

  • CANVAS_WIDTH: number, horizontal size of the canvas
  • CANVAS_HEIGHT: number, vertical size of the canvas
  • BOX_IMAGE_URL: string (between quotes), image for the cube
  • BACKGROUND_IMAGE_URL: string (between quotes), image for the background
  • BOX_SIZE: number, how big the cube is
  • BOX_ROTATION_SPEED: number, how fast the cube spins

As an added challenge, try to change the position of the cube...

results matching ""

    No results matching ""