Closed bostondevin closed 11 years ago
There are two ways you can access the Caman object. You can either store the result from the Caman
function or call the Caman function on the same element.
// Calling Caman() on an uninitialized image or canvas will initialize it.
// It will also return a reference to the initialized Caman object.
var image = Caman("#my-image");
image.revert(); // Revert any changes to the image
image.brightness(10).render(); // Adjust the brightness and re-render (this is async!)
// If you call Caman() on the same element
var image2 = Caman("#my-image"); // image == image2
// This will not re-initialize Caman, but will load the already
// existing reference.
Caman("#my-image", function () {
this.revert();
this.brightness(10);
this.render();
});
I hope that clears things up! Let me know if you're still confused.
Is there a way to update the properties of a caman object that's already been created? I'd like to attach a slider ui to contrast and brightness and cause the image to change accordingly- not sure how to update the brightness without recreating a whole new object... maybe i'm missing something.