// I want to explain for loop
// by printing things out to screen each time round loop
// problem where to print things out
// use console
// secret place on web pages
// see errors, messages
// ctrl-shift-J
const MUSICFILE = '/uploads/starter/SuspenseStrings.mp3';
AB.backgroundMusic ( MUSICFILE );
// show how random no works
var x = AB.randomIntAtoB ( -200, 200 );
// write x to header so I can see what it is
AB.msg ( x );
var img;
function preload()
{
img = loadImage ( '/uploads/test2/1608477756.png' );
}
const objectsize = 70; // size of object
const anglechange = .0; // how much the rotate angle changes each step
var angle = 0.0; // rotate angle starts at 0
function setup() // "setup" is called once at start of run
{
// console.log ( "setup is called!");
createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(), WEBGL );
}
function draw() // "draw" is called every timestep during run
{
// console.log ( "draw is called!");
texture(img);
background('darkgrey'); // background color
// fill("navy"); // paint box with this color
rotateX(angle); // set each dimension rotation angle to "angle"
rotateY(angle);
rotateZ(angle);
// console.log ( "start of for loop");
// a "for loop" does an instruction n times
//for ( var i = 10; i <= 100 ; i = i + 10 )
// for ( start instruction, so long as test to end the loop is true, instruction at end of the following block )
//{
translate ( 0, 0, 0 ); box(objectsize);
translate ( x, 0, 0 ); box(objectsize);
translate ( x, 0, 0 ); box(objectsize);
translate ( x, 0, 0 ); box(objectsize);
translate ( x, 0, 0 ); box(objectsize);
translate ( x, 0, 0 ); box(objectsize);
// console.log ( "value of i = " + i );
//}
//console.log ( "end of for loop");
// angle = angle + anglechange ; // change angle each step to get rotate movement
}