15
« on: September 24, 2020, 02:17:31 PM »
The 6 (six) is de middle.
local wheel = fe.load_module( "conveyor" );
# 1 2 3 4 5 â–º6â—„ 7 8 9 10
local wheel_x = [ flx*0, -flx*1.000, -flx*1.000, -flx*0.621, -flx*0.309, flx*0.003, flx*0.315, flx*0.747, flx*1.059, flx*1.371, flx*1.100, flx*1.100, ];
local wheel_y = [ fly*0, fly*0.448, fly*0.448, fly*0.448, fly*0.448, fly*0.448, fly*0.418, fly*0.448, fly*0.448, fly*0.448, fly*0.448, fly*0.448, ];
local wheel_w = [ flw*0, flw*0.250, flw*0.250, flw*0.250, flw*0.250, flw*0.250, flw*0.370, flw*0.250, flw*0.250, flw*0.250, flw*0.250, flw*0.250, ];
local wheel_h = [ flh*0, flh*0.160, flh*0.160, flh*0.160, flh*0.106, flh*0.106, flh*0.166, flh*0.106, flh*0.106, flh*0.106, flh*0.106, flh*0.106, ];
local wheel_r = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ];
local wheel_a = [ 0, 0, 0, 150, 150, 150, 255, 150, 150, 0, 0, 0, ];
local num_arts = 10;
class WheelEntry extends ConveyorSlot
{
constructor()
{
base.constructor( ::fe.add_artwork ( "wheel" ) );
}
function on_progress( progress, var )
{
local p = progress / 0.1;
local slot = p.tointeger();
p -= slot;
slot++;
if ( slot < 0 ) slot=0;
if ( slot >=13 ) slot=13;
m_obj.x = wheel_x[slot] + p * ( wheel_x[slot+1] - wheel_x[slot] );
m_obj.y = wheel_y[slot] + p * ( wheel_y[slot+1] - wheel_y[slot] );
m_obj.width = wheel_w[slot] + p * ( wheel_w[slot+1] - wheel_w[slot] );
m_obj.height = wheel_h[slot] + p * ( wheel_h[slot+1] - wheel_h[slot] );
m_obj.rotation = wheel_r[slot] + p * ( wheel_r[slot+1] - wheel_r[slot] );
m_obj.alpha = wheel_a[slot] + p * ( wheel_a[slot+1] - wheel_a[slot] );
}
};
local wheel_entries = [];
for ( local i=0; i<num_arts/2; i++ )
wheel_entries.push( WheelEntry() );
local remaining = num_arts - wheel_entries.len();
for ( local i=0; i<remaining; i++ )
wheel_entries.insert( num_arts/2, WheelEntry() );
local conveyor = Conveyor();
conveyor.set_slots( wheel_entries );
conveyor.transition_ms = 250;
try { conveyor.transition_ms = my_config["transition_ms"].tointeger(); } catch ( e ) { }
conveyor.preserve_aspect_ratio = true;