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. 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.
There is a strength in madness which only madmen know.
it is a very good idea to use Firebug which shows and shortly describes every error
use [code]YOUR CODE GOES HERE[/code] or burn in Hell
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread