<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Altmint Blog &#187; javascript image rotator</title>
	<atom:link href="http://blog.altmint.com/tag/javascript-image-rotator/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.altmint.com</link>
	<description></description>
	<lastBuildDate>Mon, 24 Oct 2011 09:11:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>JavaScript Image Rotator</title>
		<link>http://blog.altmint.com/javascript-image-rotator</link>
		<comments>http://blog.altmint.com/javascript-image-rotator#comments</comments>
		<pubDate>Tue, 09 Mar 2010 07:40:50 +0000</pubDate>
		<dc:creator>Kongoti</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[abitary angle]]></category>
		<category><![CDATA[angle]]></category>
		<category><![CDATA[image rotator]]></category>
		<category><![CDATA[javascript image rotator]]></category>
		<category><![CDATA[rotator]]></category>

		<guid isPermaLink="false">http://blog.altmint.com/?p=16</guid>
		<description><![CDATA[We can rotate the image by angle.here is a source code for it ..( rotate an image by an arbitrary angle, it works in IE7 &#38; FF3 &#60;html&#62; &#60;head&#62; &#60;!-- **** Universal JavaScript Image Rotator v1.1 (16-03-2009) //--&#62; &#60;script type=&#34;text/javascript&#34;&#62; &#60;!-- //******************** Image parameters ******************* imagename=&#039;kk.jpg&#039; xsize=180 ysize=240 //*********** nothing to configure below this line <a href="http://blog.altmint.com/javascript-image-rotator">Continue Reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>We can rotate the image by angle.here is a source code for it ..( rotate an image by an arbitrary angle, it works in IE7 &amp; FF3</p>
<pre class="brush: html">
&lt;html&gt;
&lt;head&gt;
&lt;!--
**** Universal JavaScript Image Rotator v1.1 (16-03-2009)
//--&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
//******************** Image parameters *******************
imagename=&#039;kk.jpg&#039;
xsize=180
ysize=240
//*********** nothing to configure below this line ********
//--&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body style=&quot;margin:20px&quot;&gt;
&lt;H1&gt;Universal JavaScript Image Rotator v1.0 (14-03-2009)&lt;/H1&gt;
&lt;div id=&quot;container&quot; style=&quot;overflow:hidden&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
    canvsize=Math.round(Math.sqrt(xsize*xsize+ysize*ysize)); //I need a square canvas for complete rotation
    document.write(&#039;&lt;canvas id=canvas width=&#039;+canvsize+&#039; height=&#039;+canvsize+&#039;&gt;&lt;/canvas&gt;&#039;)
    document.write(&#039;&lt;div id=&quot;canvas2&quot;&gt;&lt;img id=im width=&#039;+xsize+&#039; height=&#039;+ysize+&#039;&gt;&lt;/div&gt;&#039;)
//--&gt;
&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
ie=0
var browser=navigator.appName;
if (browser==&#039;Microsoft Internet Explorer&#039;) ie=1;

document.getElementById(&quot;container&quot;).style.width=canvsize+&#039;px&#039;
document.getElementById(&quot;container&quot;).style.height=canvsize+&#039;px&#039;
//document.getElementById(&quot;canvas&quot;).style.width=canvsize+&#039;px&#039;
//document.getElementById(&quot;canvas&quot;).style.height=canvsize+&#039;px&#039;
document.getElementById(&quot;canvas2&quot;).style.width=xsize+&#039;px&#039;
document.getElementById(&quot;canvas2&quot;).style.height=ysize+&#039;px&#039;
document.getElementById(&quot;canvas2&quot;).style.marginLeft=(canvsize-xsize)/2+&#039;px&#039;
document.getElementById(&quot;canvas2&quot;).style.marginTop=(canvsize-ysize)/2+&#039;px&#039;

var browser=navigator.appName;
if (ie==1) {
    document.getElementById(&#039;im&#039;).src=imagename;
    var canvas2=document.getElementById(&#039;canvas2&#039;);
    canvas2.style.filter=&quot;progid:DXImageTransform.Microsoft.Matrix(M11=&#039;1.0&#039;, sizingmethod=&#039;auto expand&#039;)&quot;;
    }
else {
    var canvas = document.getElementById(&#039;canvas&#039;);
    var ctx = canvas.getContext(&#039;2d&#039;);
    var img1 = new Image();
    img1.src = imagename;
    img1.onload=function() { ctx.drawImage(img1, (canvsize-xsize)/2, (canvsize-ysize)/2, xsize, ysize);}
}

function rotate(deg){
    rad = deg*Math.PI/180
    if (ie==1) rotate_ie(rad,deg)
    else rotate_ff(rad)
}

function rotate_ff(rad) {
    ctx.clearRect(0,0,canvsize,canvsize);
    ctx.save();
    ctx.translate(canvsize/2,canvsize/2);
    ctx.rotate(rad);
    ctx.drawImage(img1, -xsize/2, -ysize/2, xsize, ysize);
    ctx.restore();
}

function rotate_ie(rad)
{
    canvas2.filters.item(0).M11 = Math.cos(rad);
    canvas2.filters.item(0).M12 = -Math.sin(rad);
    canvas2.filters.item(0).M21 = Math.sin(rad);
    canvas2.filters.item(0).M22 = Math.cos(rad);
    canvas2.style.marginLeft=((canvsize-canvas2.offsetWidth)/2)+&#039;px&#039;
    canvas2.style.marginTop=((canvsize-canvas2.offsetHeight)/2)+&#039;px&#039;
}
//--&gt;
&lt;/script&gt;
&lt;/div&gt;

&lt;p&gt;
Enter the number of degrees (positive or negative) you want to rotate the image:&lt;BR&gt;
&lt;input type=&quot;text&quot; id=&quot;rotation&quot;&gt;
&lt;input type=&quot;button&quot; value=&quot;Rotate&quot; onclick=&quot;rotate(document.getElementById(&#039;rotation&#039;).value);&quot;&gt;
&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.altmint.com/javascript-image-rotator/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

