Steven

Steven


  • Name: [not set]
  • Favorite Languages: [not set]
  • Website: [not set]
  • Location: [not set]
  • About Me: [not set]

Recent Comments

  • Javascript Tutorial - Generic Animation V2.0
    08/07/2009 - 09:22

    Excellent Tutorial. Really well explained.

    I've made the 'AnimationFrame' function a private member of the 'AnimationObject'. I also instantiated the AnimationFrame object from within the 'AddFrame' privileged function.

    So the AddFrame function becomes:

    this.AddFrame = function(left, top, width, height, time){
            frames.push(new AnimationFrame(left, top, width, height, time));
      }

    This makes the code cleaner when you come to use the object; instead of having to write:

    var example = new AnimationObject('examplePanel');
    example.AddFrame(new AnimationFrame(0, 20, 150, 130, 500));

    You can simply write:

    var example = new AnimationObject('examplePanel');
    example.AddFrame(0, 20, 150, 130, 500);

    I'm no JavaScript expert so I'd be interested to know if my slight modification has any drawbacks?