Results 1 to 2 of 2

Thread: var mypic command confusion

  1. #1
    Join Date
    Aug 2010

    Question var mypic command confusion

    Hello all,

    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.

  2. #2
    Join Date
    May 2006
    Somewhere behind your screen
    it is a very good idea to use Firebug which shows and shortly describes every error
    signature under construction

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center