# Latest Changes

Differences between version #6774 and #6818

```2,10c2,4
< public static function lEquation (T:Dynamic, x1:Float, x2:Float, y0:Float, y1:Float, y2:Float) :Dynamic {
<
< 		var x0 = (x2 - x1) * (y0 - y1) / (y2 - y1) + x1;
<
< 		return switch (T) {
< 			case Int: Math.round ( x0 );
< 			default : x0;
< 		}
< 	}
---
> public static function lEquation (x1:Float, x2:Float, y0:Float, y1:Float, y2:Float) :Float {
> 	return (x2 - x1) * (y0 - y1) / (y2 - y1) + x1;
> }
12,15c6,9
< What is this equation useful? For a lot of things, here's an example how to move a progress bar when you know the percent loaded:
< <code haxe>progressBar.width = lEquation (Int, 0, 530, percent, 0, 100);</code>
< T is the type you want to return, Int or Float
< 0 - 530 means that the width of the progressBar will change from 0 to 530 when the percent will take values from 0 to 100
---
> What is this equation useful? For a lot of things that changes their values linearly. Here's an example how to move a progress bar when you know the percent loaded:
> <code haxe>progressBar.width = lEquation (0, 530, percent, 0, 100);</code>
> 0 - 530 means that the width of the progressBar will change from 0 to 530 when the percent will take values from 0 to 100.
> I find it useful because you don't have to think the formula again and again, you know visually what values to put in the function.

```
Ver Date Entry Lg User Action
#18057 2013-04-27 07:39:01 doc/start/objc en cristibaluta View | Diff
#18056 2013-04-27 07:39:01 doc/start/objc en cristibaluta Set title to Getting started with Haxe/ObjC
#12654 2012-03-28 12:52:06 doc/snip/selective_trace en cristibaluta View | Diff
#10766 2011-07-21 17:03:35 com/showcase en cristibaluta View | Diff
#10765 2011-07-21 17:02:09 com/showcase en cristibaluta View | Diff