// VERSION: 1.8 LAST UPDATE: 9.03.2011 /* * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php * * Made by Wilq32, wilq32@gmail.com, Wroclaw, Poland, 01.2009 * Website: http://code.google.com/p/jqueryrotate/ */ // Documentation removed from script file (was kinda useless and outdated) (function($) { var supportedCSS,styles=document.getElementsByTagName("head")[0].style,toCheck="transformProperty WebkitTransform OTransform msTransform MozTransform".split(" "); for (var a=0;a this._parameters.duration; // TODO: Bug for animatedGif for static rotation ? (to test) if (checkEnd && !this._parameters.animatedGif) { clearTimeout(this._timer); } else { if (this._canvas||this._vimage||this._img) { var angle = this._parameters.easing(0, actualTime - this._animateStartTime, this._animateStartAngle, this._parameters.animateTo - this._animateStartAngle, this._parameters.duration); this._rotate((~~(angle*10))/10); } var self = this; this._timer = setTimeout(function() { self._animate.call(self); }, 10); } // To fix Bug that prevents using recursive function in callback I moved this function to back if (this._parameters.callback && checkEnd){ this._angle = this._parameters.animateTo; this._rotate(this._angle); this._parameters.callback.call(this._rootObj); } }, _rotate : (function() { var rad = Math.PI/180; if (IE) return function(angle) { this._angle = angle; this._container.style.rotation=(angle%360)+"deg"; } else if (supportedCSS) return function(angle){ this._angle = angle; this._img.style[supportedCSS]="rotate("+(angle%360)+"deg)"; } else return function(angle) { this._angle = angle; angle=(angle%360)* rad; // clear canvas this._canvas.width = this._width+this._widthAdd; this._canvas.height = this._height+this._heightAdd; // REMEMBER: all drawings are read from backwards.. so first function is translate, then rotate, then translate, translate.. this._cnv.translate(this._widthAddHalf,this._heightAddHalf); // at least center image on screen this._cnv.translate(this._widthHalf,this._heightHalf); // we move image back to its orginal this._cnv.rotate(angle); // rotate image this._cnv.translate(-this._widthHalf,-this._heightHalf); // move image to its center, so we can rotate around its center this._cnv.scale(this._aspectW,this._aspectH); // SCALE - if needed ;) this._cnv.drawImage(this._img, 0, 0); // First - we draw image } })() } if (IE) { Wilq32.PhotoEffect.prototype.createVMLNode=(function(){ document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)"); try { !document.namespaces.rvml && document.namespaces.add("rvml", "urn:schemas-microsoft-com:vml"); return function (tagName) { return document.createElement(''); }; } catch (e) { return function (tagName) { return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">'); }; } })(); } })(jQuery);