Skip to content

Commit

Permalink
changed trigger and release so they wont run if image is not yet done…
Browse files Browse the repository at this point in the history
… processing
  • Loading branch information
chrisantonellis committed Feb 7, 2016
1 parent 3e5d782 commit 1732010
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 69 deletions.
57 changes: 34 additions & 23 deletions build/js/freezeframe.js
@@ -1,5 +1,6 @@

// pass references around in a cleaner way

var freezeframe = (function($) {

var images, options, is_touch_device;
Expand Down Expand Up @@ -261,49 +262,59 @@ var freezeframe = (function($) {
return this;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Freeze Images //
// //
//////////////////////////////////////////////////////////////////////////////
freezeframe.prototype.freeze = function() {
this.capture().setup().attach(); // ✨ tada ✨
return this;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Trigger Animation //
// //
//////////////////////////////////////////////////////////////////////////////

// return false if image not done processing yet
// save references in a better way

freezeframe.prototype.trigger = function(_selector) {
var ff = this;
var ff = this,
errors = 0;

filter.call(ff, _selector).each(function(e) {
$(this).attr('src', $(this)[0].src);
$(this).siblings('canvas').removeClass('ff-canvas-ready').addClass('ff-canvas-active');

if($(this).hasClass('ff-image-ready')) {
$(this).attr('src', $(this)[0].src);
$(this).siblings('canvas').removeClass('ff-canvas-ready').addClass('ff-canvas-active');
} else {
warn("image not done processing ! " + $(this).attr("src"));
errors ++;
}

});

return errors == 0 ? true : false;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Release Animation //
// //
//////////////////////////////////////////////////////////////////////////////

// return false if image not done processing yet
// save references in a better way

freezeframe.prototype.release = function(_selector) {
var ff = this;
var ff = this,
errors = 0;

filter.call(ff, _selector).each(function(e) {
$(this).siblings('canvas').removeClass('ff-canvas-active').addClass('ff-canvas-ready');
if($(this).hasClass('ff-image-ready')) {
$(this).siblings('canvas').removeClass('ff-canvas-active').addClass('ff-canvas-ready');
} else {
warn("image not done processing ! " + $(this).attr("src"));
errors ++;
}
});

return errors == 0 ? true : false;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Freeze Images //
// //
//////////////////////////////////////////////////////////////////////////////
freezeframe.prototype.freeze = function() {
this.capture().setup().attach(); // ✨ tada ✨
return this;
}

return freezeframe;
Expand Down
57 changes: 34 additions & 23 deletions build/js/freezeframe.pkgd.js
Expand Up @@ -10062,6 +10062,7 @@ return ImagesLoaded;


// pass references around in a cleaner way

var freezeframe = (function($) {

var images, options, is_touch_device;
Expand Down Expand Up @@ -10323,49 +10324,59 @@ var freezeframe = (function($) {
return this;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Freeze Images //
// //
//////////////////////////////////////////////////////////////////////////////
freezeframe.prototype.freeze = function() {
this.capture().setup().attach(); // ✨ tada ✨
return this;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Trigger Animation //
// //
//////////////////////////////////////////////////////////////////////////////

// return false if image not done processing yet
// save references in a better way

freezeframe.prototype.trigger = function(_selector) {
var ff = this;
var ff = this,
errors = 0;

filter.call(ff, _selector).each(function(e) {
$(this).attr('src', $(this)[0].src);
$(this).siblings('canvas').removeClass('ff-canvas-ready').addClass('ff-canvas-active');

if($(this).hasClass('ff-image-ready')) {
$(this).attr('src', $(this)[0].src);
$(this).siblings('canvas').removeClass('ff-canvas-ready').addClass('ff-canvas-active');
} else {
warn("image not done processing ! " + $(this).attr("src"));
errors ++;
}

});

return errors == 0 ? true : false;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Release Animation //
// //
//////////////////////////////////////////////////////////////////////////////

// return false if image not done processing yet
// save references in a better way

freezeframe.prototype.release = function(_selector) {
var ff = this;
var ff = this,
errors = 0;

filter.call(ff, _selector).each(function(e) {
$(this).siblings('canvas').removeClass('ff-canvas-active').addClass('ff-canvas-ready');
if($(this).hasClass('ff-image-ready')) {
$(this).siblings('canvas').removeClass('ff-canvas-active').addClass('ff-canvas-ready');
} else {
warn("image not done processing ! " + $(this).attr("src"));
errors ++;
}
});

return errors == 0 ? true : false;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Freeze Images //
// //
//////////////////////////////////////////////////////////////////////////////
freezeframe.prototype.freeze = function() {
this.capture().setup().attach(); // ✨ tada ✨
return this;
}

return freezeframe;
Expand Down
57 changes: 34 additions & 23 deletions src/js/freezeframe.js
@@ -1,5 +1,6 @@

// pass references around in a cleaner way

var freezeframe = (function($) {

var images, options, is_touch_device;
Expand Down Expand Up @@ -261,49 +262,59 @@ var freezeframe = (function($) {
return this;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Freeze Images //
// //
//////////////////////////////////////////////////////////////////////////////
freezeframe.prototype.freeze = function() {
this.capture().setup().attach(); // ✨ tada ✨
return this;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Trigger Animation //
// //
//////////////////////////////////////////////////////////////////////////////

// return false if image not done processing yet
// save references in a better way

freezeframe.prototype.trigger = function(_selector) {
var ff = this;
var ff = this,
errors = 0;

filter.call(ff, _selector).each(function(e) {
$(this).attr('src', $(this)[0].src);
$(this).siblings('canvas').removeClass('ff-canvas-ready').addClass('ff-canvas-active');

if($(this).hasClass('ff-image-ready')) {
$(this).attr('src', $(this)[0].src);
$(this).siblings('canvas').removeClass('ff-canvas-ready').addClass('ff-canvas-active');
} else {
warn("image not done processing ! " + $(this).attr("src"));
errors ++;
}

});

return errors == 0 ? true : false;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Release Animation //
// //
//////////////////////////////////////////////////////////////////////////////

// return false if image not done processing yet
// save references in a better way

freezeframe.prototype.release = function(_selector) {
var ff = this;
var ff = this,
errors = 0;

filter.call(ff, _selector).each(function(e) {
$(this).siblings('canvas').removeClass('ff-canvas-active').addClass('ff-canvas-ready');
if($(this).hasClass('ff-image-ready')) {
$(this).siblings('canvas').removeClass('ff-canvas-active').addClass('ff-canvas-ready');
} else {
warn("image not done processing ! " + $(this).attr("src"));
errors ++;
}
});

return errors == 0 ? true : false;
}

//////////////////////////////////////////////////////////////////////////////
// //
// Freeze Images //
// //
//////////////////////////////////////////////////////////////////////////////
freezeframe.prototype.freeze = function() {
this.capture().setup().attach(); // ✨ tada ✨
return this;
}

return freezeframe;
Expand Down

0 comments on commit 1732010

Please sign in to comment.