var mypic command confusion
Firstly massive thanks to those that have helped over the past week to help resolve some other posts. This query is still related to the same mini project.
In a nutshell l am using a kaleidoscope built in HTML for the intro of my site. Using the canvas function and some clever maths it works beautifully. My problem: I want to have a different image every time the browser is refreshed.
At the moment the code line involved reads:
kscope = new Kaleidoscope('canvas', 'kaleidoscope.jpg', 16);
I have been advised my a friend that the following would work:
var mypic = 'kaleidoscope.jpg';
kscope = new Kaleidoscope('canvas', mypic, 16);
To go further:
var mypic = ['a.jpg', 'b.jpg', 'c.jpg];
kscope = new Kaleidoscope('canvas', mypic[Math.floor(Math.random() * mypic.length))], 16);
Neither of these work.:confused: Am l doing something wrong or is there a fault in the code above? The simpler the explanation the better. I am a very quick learner but these commands are all new for me!
Thanks in advance.