<?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>Raphael &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/raphael/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Looping Animation with JavaScript and Raphaël</title>
		<link>/2010/09/13/looping-animation-with-javascript-and-raphael/</link>
		<comments>/2010/09/13/looping-animation-with-javascript-and-raphael/#respond</comments>
		<pubDate>Mon, 13 Sep 2010 13:40:50 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Graphics file formats]]></category>
		<category><![CDATA[JavaScript library]]></category>
		<category><![CDATA[JavaScript programming language]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[Raphael]]></category>
		<category><![CDATA[Scalable Vector Graphics]]></category>
		<category><![CDATA[Vector graphics markup languages]]></category>
		<category><![CDATA[Vector Markup Language]]></category>

		<guid isPermaLink="false">/?p=1980</guid>
		<description><![CDATA[Raphael is a popular JavaScript library helping you to manage vectors via SVG or VML in your browser. It is extremely helpful and very easy to learn and use. The interesting thing is that in the browser you can do very powerful things with vectors, but they remain very less known. However with such libraries &#8230; <a href="/2010/09/13/looping-animation-with-javascript-and-raphael/" class="more-link">Continue reading <span class="screen-reader-text">Looping Animation with JavaScript and Raphaël</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/14/javascript-array-pop-get-the-last-item/" rel="bookmark" title="JavaScript array.pop() &#8211; Get The Last Item">JavaScript array.pop() &#8211; Get The Last Item </a></li>
<li><a href="/2010/09/27/jquery-setting-up-a-vector-path-fill-color/" rel="bookmark" title="jQuery: Setting Up a Vector Path Fill Color">jQuery: Setting Up a Vector Path Fill Color </a></li>
<li><a href="/2010/09/24/2xjquery-select-a-selector/" rel="bookmark" title="2xjQuery: Select a Selector">2xjQuery: Select a Selector </a></li>
<li><a href="/2010/02/02/profiling-javascript-with-firebug-console-profile-console-time/" rel="bookmark" title="Profiling JavaScript with Firebug. console.profile() &#038; console.time()!">Profiling JavaScript with Firebug. console.profile() &#038; console.time()! </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a title="Raphael.js" href="http://raphaeljs.com/index.html" target="_blank">Raphael</a> is a popular JavaScript library helping you to manage vectors via SVG or VML in your browser. It is extremely helpful and very easy to learn and use. The interesting thing is that in the browser you can do very powerful things with vectors, but they remain very less known. However with such libraries like Raphael the task is really simple.</p>
<h2>Animation</h2>
<p>As I said animating some vector properties is as simple as:</p>
<pre lang="javascript">var paper = Raphael('canvas', 1024, 500);
var c = paper.circle(50, 50, 6).attr({fill : '#f00'});
c.animate({r : 10, fill : '#00f'}, 1000);
</pre>
<p>Here we change the radius and the background color of the circle for 1000 milliseconds.</p>
<p>The same thing can be done with any property with any other JavaScript library as <a title="jQuery" href="http://jquery.com/" target="_blank">jQuery</a>. But as in jQuery, Raphael or whatever library the animation is not looping. That&#8217;s natural you can just change a property by animating it, but the looping animation suggests at least two animations. So it&#8217;s a developers job to implement this. Here&#8217;s a simple way to do this.</p>
<h2>Two Way Animation</h2>
<p>The solution here is using two functions calling each other.</p>
<pre lang="javascript">
var paper = Raphael('canvas', 1024, 500);
var c = paper.circle(50, 50, 6).attr({fill : '#f00'});

function a() {
    c.animate({r : 10, fill : '#00f'}, 1000, b);
}
function b() {
    c.animate({r : 6, fill : '#f00'}, 1000, a);
}
a();
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/14/javascript-array-pop-get-the-last-item/" rel="bookmark" title="JavaScript array.pop() &#8211; Get The Last Item">JavaScript array.pop() &#8211; Get The Last Item </a></li>
<li><a href="/2010/09/27/jquery-setting-up-a-vector-path-fill-color/" rel="bookmark" title="jQuery: Setting Up a Vector Path Fill Color">jQuery: Setting Up a Vector Path Fill Color </a></li>
<li><a href="/2010/09/24/2xjquery-select-a-selector/" rel="bookmark" title="2xjQuery: Select a Selector">2xjQuery: Select a Selector </a></li>
<li><a href="/2010/02/02/profiling-javascript-with-firebug-console-profile-console-time/" rel="bookmark" title="Profiling JavaScript with Firebug. console.profile() &#038; console.time()!">Profiling JavaScript with Firebug. console.profile() &#038; console.time()! </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/09/13/looping-animation-with-javascript-and-raphael/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
