examples/sprite/sprite.js
function(options) {
  var self = this;

  self.sounds = [];

  // Setup the options to define this sprite display.
  self._width = options.width;
  self._left = options.left;
  self._spriteMap = options.spriteMap;
  self._sprite = options.sprite;
  self.setupListeners();

  // Create our audio sprite definition.
  self.sound = new Howl({
    src: options.src,
    sprite: options.sprite
  });

  // Setup a resize event and fire it to setup our sprite overlays.
  window.addEventListener('resize', function() {
    self.resize();
  }, false);
  self.resize();

  // Begin the progress step tick.
  requestAnimationFrame(self.step.bind(self));
}
function(options) {
  var self = this;

  self.sounds = [];

  // Setup the options to define this sprite display.
  self._width = options.width;
  self._left = options.left;
  self._spriteMap = options.spriteMap;
  self._sprite = options.sprite;
  self.setupListeners();

  // Create our audio sprite definition.
  self.sound = new Howl({
    src: options.src,
    sprite: options.sprite
  });

  // Setup a resize event and fire it to setup our sprite overlays.
  window.addEventListener('resize', function() {
    self.resize();
  }, false);
  self.resize();

  // Begin the progress step tick.
  requestAnimationFrame(self.step.bind(self));
}
function ( options ) { var self = this ; self . sounds = [ ] ; // Setup the options to define this sprite display. self . _width = options . width ; self . _left = options . left ; self . _spriteMap = options . spriteMap ; self . _sprite = options . sprite ; self . setupListeners ( ) ; // Create our audio sprite definition. self . sound = new Howl ( { src : options . src , sprite : options . sprite } ) ; // Setup a resize event and fire it to setup our sprite overlays. window . addEventListener ( 'resize' , function ( ) { self . resize ( ) ; } , false ) ; self . resize ( ) ; // Begin the progress step tick. requestAnimationFrame ( self . step . bind ( self ) ) ; }
Sprite class containing the state of our sprites to play and their progress.
@param {Object} options Settings to pass into and setup the sound and visuals.
Sprite class containing the state of our sprites to play and their progress .