Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clean up.

  • Loading branch information...
commit b6ff1bbc32c86cfdcd481f4640d903876c1aea08 1 parent 1b4c0ae
@uxder authored
Showing with 14 additions and 14 deletions.
  1. +2 −0  samples/samples.html
  2. +12 −14 src/vivid.js
View
2  samples/samples.html
@@ -26,6 +26,8 @@
<script src="js/jquery-1.7.1.min.js"></script>
<script src="../src/vivid.js"></script>
<script>
+
+
$('.vivid').vivid({
filter: 'blackWhite',
blackWhite: {
View
26 src/vivid.js
@@ -66,12 +66,12 @@ Vivid.core = (function( window, document, $){
$elem,
imgW,
imgH,
+ img,
$canvas,
ctx,
- effect,
//default options
options = {
- effect: 'blackWhite'
+ filter: 'blackWhite'
};
/**
@@ -86,12 +86,16 @@ Vivid.core = (function( window, document, $){
elem = el;
$elem = $(elem);
-
+
build();
+ transferStyles();
+ transferClassAndId();
draw();
-
- //create filter
- applyFilter(options.effect);
+ applyFilter(options.filter);
+
+ //remove the image
+ $elem.remove();
+
// for chaining
return this;
@@ -141,12 +145,6 @@ Vivid.core = (function( window, document, $){
//save and create canvas context
$canvas = $elem.next('canvas');
ctx = $canvas[0].getContext('2d');
-
- transferStyles();
- transferClassAndId();
-
- //remove the image
- $elem.remove();
}
/**
@@ -193,10 +191,10 @@ Vivid.core = (function( window, document, $){
/**
- * Draw the image onto the canvas
+ * Draw the image onto the canvas after the image has been loaded
*/
var draw = function() {
- ctx.drawImage($elem[0], 0, 0, imgW, imgH);
+ ctx.drawImage($elem[0], 0, 0, imgW, imgH);
}
return n;
Please sign in to comment.
Something went wrong with that request. Please try again.