-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSColor.as
40 lines (36 loc) · 905 Bytes
/
SColor.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package
{
public class SColor
{
public static function color(red:SColor, green:SColor, blue:SColor):uint
{
return (red.value << 16) | (green.value << 8) | blue.value;
}
public var value:int;
public var min:int;
public var max:int;
public var step:int;
public var direction:int;
public function SColor(min:int, max:int, step:int)
{
this.min = min;
this.max = max;
this.step = step;
direction = 1;
}
public function takeStep():void
{
value += step * direction;
if (value > max)
{
value = max;
direction = -1;
}
else if (value < min)
{
value = min;
direction = 1;
}
}
}
}