Sha256: ac81f8e94163d9390371c0426955c18a8d95d55d40739ae23db9b40f78b105cb

Contents?: true

Size: 655 Bytes

Versions: 85

Compression:

Stored size: 655 Bytes

Contents

pageflow.volumeFade = {
  fadeSound: function(media, endVolume, fadeTime) {
    var fadeResolution = 10;
    var startVolume = media.volume();
    var steps = fadeTime / fadeResolution;
    var leap = (endVolume - startVolume) / steps;

    clearInterval(this.fadeInterval);

    if(endVolume != startVolume) {
      var fade = this.fadeInterval = setInterval(_.bind(function() {
        media.volume(media.volume() + leap);
        if ((media.volume() >= endVolume && endVolume >= startVolume) ||
          (media.volume() <= endVolume && endVolume <= startVolume)) {
          clearInterval(fade);
        }
      }, this), fadeResolution);
    }
  }
};

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
pageflow-0.0.5 app/assets/javascripts/pageflow/page_types/mixins/volume_fade.js
pageflow-0.0.4 app/assets/javascripts/pageflow/page_types/mixins/volume_fade.js
pageflow-0.0.3 app/assets/javascripts/pageflow/page_types/mixins/volume_fade.js
pageflow-0.0.2 app/assets/javascripts/pageflow/page_types/mixins/volume_fade.js
pageflow-0.0.1 app/assets/javascripts/pageflow/page_types/mixins/volume_fade.js