// version: 2.2 last update: 13.03.2012 /* * 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); } if (this._parameters.step) { this._parameters.step(this._angle); } 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);