<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Using interpolators and timers</title>
	<atom:link href="http://blog.nickgravelyn.com/2010/01/using-interpolators-and-timers/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nickgravelyn.com/2010/01/using-interpolators-and-timers/</link>
	<description></description>
	<lastBuildDate>Fri, 23 Jul 2010 01:34:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Philippe Da Silva</title>
		<link>http://blog.nickgravelyn.com/2010/01/using-interpolators-and-timers/comment-page-1/#comment-382</link>
		<dc:creator>Philippe Da Silva</dc:creator>
		<pubDate>Wed, 24 Feb 2010 12:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nickgravelyn.com/?p=1256#comment-382</guid>
		<description>Since I started using this, I just can&#039;t know how I could have lived without it!!!

That&#039;s one pretty clever use of delegates that you implemented here. So good that it should be simply part of the framework itself.

My first trial with it was to reproduce the &quot;cliché&quot; computer-movie-like text animation that shows a blinking underscore as a carret and draws some text, character by character.
Here is the code:

Interpolators.Timer t1 = Interpolators.Timer.Create(
                0.25f,
                true,
                timer =&gt;
                {
                    if (!this.Text.EndsWith(&quot;_&quot;))
                        this.Text += &quot;_&quot;;
                    else
                        this.Text = this.Text.TrimEnd(new char[] { &#039;_&#039; });
                });

            Interpolators.Timer.Create(
                2.75f,
                false,
                timer =&gt;
                {
                    Interpolators.Timer t2 = Interpolators.Timer.Create(
                        0.1f,
                        true,
                        timer2 =&gt;
                        {
                            int realLength = this.Text.TrimEnd(new char[]{&#039;_&#039;}).Length;
                            if (realLength != TITLE.Length)
                                this.Text = TITLE.Substring(0, realLength + 1);
                            else
                                timer2.Stop();
                        });
                });

Then, you just call your usual SpriteBatch.DrawString method using the Text property of the class and you&#039;re done.

Here is a video showing the result (with a little subtility afterwards: randomly selecting characters in the string and replacing them with some others in a quick interpolated loop ;))
http://blog.will2real.com/?p=188

Thank you so much Nick for this.</description>
		<content:encoded><![CDATA[<p>Since I started using this, I just can&#8217;t know how I could have lived without it!!!</p>
<p>That&#8217;s one pretty clever use of delegates that you implemented here. So good that it should be simply part of the framework itself.</p>
<p>My first trial with it was to reproduce the &#8220;cliché&#8221; computer-movie-like text animation that shows a blinking underscore as a carret and draws some text, character by character.<br />
Here is the code:</p>
<p>Interpolators.Timer t1 = Interpolators.Timer.Create(<br />
                0.25f,<br />
                true,<br />
                timer =&gt;<br />
                {<br />
                    if (!this.Text.EndsWith(&#8220;_&#8221;))<br />
                        this.Text += &#8220;_&#8221;;<br />
                    else<br />
                        this.Text = this.Text.TrimEnd(new char[] { &#8216;_&#8217; });<br />
                });</p>
<p>            Interpolators.Timer.Create(<br />
                2.75f,<br />
                false,<br />
                timer =&gt;<br />
                {<br />
                    Interpolators.Timer t2 = Interpolators.Timer.Create(<br />
                        0.1f,<br />
                        true,<br />
                        timer2 =&gt;<br />
                        {<br />
                            int realLength = this.Text.TrimEnd(new char[]{&#8216;_&#8217;}).Length;<br />
                            if (realLength != TITLE.Length)<br />
                                this.Text = TITLE.Substring(0, realLength + 1);<br />
                            else<br />
                                timer2.Stop();<br />
                        });<br />
                });</p>
<p>Then, you just call your usual SpriteBatch.DrawString method using the Text property of the class and you&#8217;re done.</p>
<p>Here is a video showing the result (with a little subtility afterwards: randomly selecting characters in the string and replacing them with some others in a quick interpolated loop <img src='http://blog.nickgravelyn.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )<br />
<a href="http://blog.will2real.com/?p=188" rel="nofollow">http://blog.will2real.com/?p=188</a></p>
<p>Thank you so much Nick for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Looman</title>
		<link>http://blog.nickgravelyn.com/2010/01/using-interpolators-and-timers/comment-page-1/#comment-381</link>
		<dc:creator>Tom Looman</dc:creator>
		<pubDate>Sat, 23 Jan 2010 20:48:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nickgravelyn.com/?p=1256#comment-381</guid>
		<description>Great Articles! The Interpolator and Pool classes are very helpful.</description>
		<content:encoded><![CDATA[<p>Great Articles! The Interpolator and Pool classes are very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Domenic</title>
		<link>http://blog.nickgravelyn.com/2010/01/using-interpolators-and-timers/comment-page-1/#comment-380</link>
		<dc:creator>Domenic</dc:creator>
		<pubDate>Sat, 23 Jan 2010 17:21:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nickgravelyn.com/?p=1256#comment-380</guid>
		<description>That&#039;s so incredibly useful! I&#039;ll have to give it a shot.</description>
		<content:encoded><![CDATA[<p>That&#8217;s so incredibly useful! I&#8217;ll have to give it a shot.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
