<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Swingpant&#039;s Game Lab &#187; non-linear</title>
	<atom:link href="http://swingpants.com/tag/non-linear/feed/" rel="self" type="application/rss+xml" />
	<link>http://swingpants.com</link>
	<description>Swingpant&#039;s Code Nurdlings</description>
	<lastBuildDate>Wed, 08 Feb 2012 08:02:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='swingpants.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/4a88693aa17d6b5e1d453a6684bc1c68?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Swingpant&#039;s Game Lab &#187; non-linear</title>
		<link>http://swingpants.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://swingpants.com/osd.xml" title="Swingpant&#039;s Game Lab" />
	<atom:link rel='hub' href='http://swingpants.com/?pushpress=hub'/>
		<item>
		<title>Ranged Numbers. Non-Linear response curves for Sliders and TouchPads.</title>
		<link>http://swingpants.com/2009/11/18/ranged-numbers-non-linear-response-curves-for-sliders-and-touchpads/</link>
		<comments>http://swingpants.com/2009/11/18/ranged-numbers-non-linear-response-curves-for-sliders-and-touchpads/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 09:31:04 +0000</pubDate>
		<dc:creator>swingpants</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[exponential]]></category>
		<category><![CDATA[non-linear]]></category>
		<category><![CDATA[response curves]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[touchpad]]></category>

		<guid isPermaLink="false">http://swingpants.com/?p=170</guid>
		<description><![CDATA[I&#8217;ve been building a few apps recently and have found that a linear response over a range of numbers has been a poor solution. I needed to be able to apply different response curves to user interface components (knobs, sliders, touchpads) as well as on screen display objects, characters, etc. I needed a good name [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=170&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been building a few apps recently and have found that a linear response over a range of numbers has been a poor solution. I needed to be able to apply different response curves to user interface components (knobs, sliders, touchpads) as well as on screen display objects, characters, etc.</p>
<p>I needed a good name for the class, but instead came up with the pretty poor moniker &#8216;RangedNumbers&#8217;. I&#8217;ll change it when I come up with a better one. </p>
<p>So the idea is, a &#8216;ranged number&#8217; is instantiated, initialised for the required range then a simple call with a value in that range will result with a percentage that can be applied to the intended recipient accordingly. I realised that an inverted curve would be handy too, so have added that functionality.</p>
<p>I have included exponential and powered curves as well as linear. </p>
<p>So to use the ranged number system:</p>
<blockquote><p>
//Instantiate and Initialise<br />
var ranged_num:RangedNumber=new RangedNumber(min,max)<br />
//Where min is the minumum number in the range and max is the maximum</p>
<p>//In use:<br />
trace ( ranged_num.calculatedRangeNumber(value, curve_type, inverted) )<br />
//Where:<br />
// value is the value within the range to be calculated<br />
// curve_type is the type of response curve.<br />
//    Curve types: RangedNumber.LINEAR, RangedNumber.EXPONENTIAL, RangedNumber.POWERED<br />
// inverted is a boolean flag. True if the inverted response is required</p>
</blockquote>
<p>I have put together two demos to show the RangedNumber class in action:</p>
<p>Firstly using a Slider component. Grab the slider and watch how the markers are represented on all the displayed response curves.</p>
<div id="attachment_175" class="wp-caption aligncenter" style="width: 460px"><a href="http://swingpantsflash.com/range_number/ranged_number_slider.html"><img src="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_slider.jpg?w=655" alt="" title="Ranged Numbers: Slider Demo"   class="size-full wp-image-175" /></a><p class="wp-caption-text">A demonstration of how to implement non-linear response curves</p></div>
<p>Now here is the same demo but this time using a TouchPad. Click on the touchpad to engage. In this demo horizontal movement controls the standard curves and vertical the inverted.<br />
<div id="attachment_176" class="wp-caption aligncenter" style="width: 460px"><a href="http://swingpantsflash.com/range_number/ranged_number_touchpad.html"><img src="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_touchpad.jpg?w=655" alt="" title="Ranged Numbers: Touchpad Demo"   class="size-full wp-image-176" /></a><p class="wp-caption-text">How to implement non-linear response curves with a touchpad</p></div></p>
<p>The source for these demos and the Ranged Number class can be found here: <a href="http://swingpantsflash.com/range_number/number_ranged_demos.zip">Ranged Number ZIP</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flashlabs.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flashlabs.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flashlabs.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=swingpants.com&amp;blog=5703708&amp;post=170&amp;subd=flashlabs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://swingpants.com/2009/11/18/ranged-numbers-non-linear-response-curves-for-sliders-and-touchpads/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1cebf29489913586137c5bdad0414c88?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">swingpants</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_slider.jpg" medium="image">
			<media:title type="html">Ranged Numbers: Slider Demo</media:title>
		</media:content>

		<media:content url="http://flashlabs.files.wordpress.com/2009/11/ranged_numbers_touchpad.jpg" medium="image">
			<media:title type="html">Ranged Numbers: Touchpad Demo</media:title>
		</media:content>
	</item>
	</channel>
</rss>
