2
* This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
3
* For full copyright and license information please refer to doc/license.txt.
12
PARAM(actors,Array<Widget>,new Array<Widget>())
13
PARAM(divisions,T_Int(7),Number divisions on the half-wheel)
14
PARAM(smallScale,T_Float(0.35),Scale of widgets in the small position )
15
PARAM(speed,T_Float(0.20),Angular speed of the wheel, rotations per second, use negative for opposite direction)
16
PARAM(yOffset,T_Float(0.0),How far the y is offset in wheel as well, factor of height, does not compensate widget size)
17
PARAM(yScale,T_Float(1.0),Scale of widgets to height, used in conjunction with yOffset normally)
19
var actors : Array<Widget>;
20
VAR(current,Array<Widget>,new Array<Widget>())
21
VAR(startSlot,T_Int(0))
26
//TODO: taken basically from BoneCircle
27
actors = params.actors;
29
for( actor in actors )
31
addChild( actor.getNative() );
32
actor.setVisible( false );
37
ASSERT( actors.length >= params.divisions );
44
if( startSlot >= actors.length )
46
else if( startSlot < 0 )
47
startSlot = actors.length - 1;
49
for( i in 0...actors.length )
50
actors[i].setVisible( false );
52
for( i in 0...params.divisions )
54
//invert natural order as wheel is reversed mathematically
55
var ndx = params.divisions - (i +startSlot) - 1;
56
ndx = mathx.MathUtil.pmodi( ndx, actors.length );
57
current[i] = actors[ndx];
58
actors[ndx].setVisible( true );
60
//ensure Z-order overlap is correct on edges (items in back are in back)
62
current[i].getNative(),
63
if( i > params.divisions/2 )
64
(params.divisions-i) *2 - 1
73
//not used now (didn't make sense)
74
VAR(zOrderNormal,T_Bool(true))
75
TRAIT(ZOrder,Normal,DEFAULT,zOrderNormal=true;)
77
SEQUENCE(Rotate,DEFAULT)
82
phase += elapsed * params.divisions * params.speed;
89
else if( phase <= 0.0 )
101
//TODO: both height and width go a "tad" bit outside of bounds, hmm...
103
//FEATURE: making this algorithm more generic would add all sorts
104
//of need FX for the path taken
105
var loss = actorSize.y * params.yScale * params.smallScale;
106
var width = actorSize.x - loss;
108
var offDelta = Math.PI/params.divisions;
109
for( i in 0...params.divisions )
111
//all slots at phase 0 are right-aligned in their slot
113
var angle = (i + 1.0 - phase) * offDelta;
115
var size = 1.0 - (1.0 - Math.sin( angle ) ) * (1.0 - params.smallScale);
117
var po = Math.cos( angle ) * width/2;
118
var py = params.yOffset * actorSize.y * Math.sin(angle);
120
current[i].resize( actorSize.y * params.yScale * size, actorSize.y * params.yScale * size );
121
current[i].move( po, py );
124
current[i].getNative().alpha = 1.0 - phase;
125
else if( i == (params.divisions-1) )
126
current[i].getNative().alpha = phase;
132
for( actor in actors )
133
actor.resize( actorSize.y * params.yScale, actorSize.y * params.yScale ); //yes, square
b'\\ No newline at end of file'