6
« on: June 22, 2019, 11:27:30 PM »
Hey guys - I've been working on a new theme and I can't figure out how to make a straight up and down vertical game list. I don't want a conveyor or a "wheel" per se, but I do want WHEEL ART on a standard vertical list.
I'm on a Pi 3B+. Here's the code I currently have:
// Wheel
fe.load_module("conveyor");
local pi = 3.14;
local wheels = config["wheels"].tointeger() + 3;
class WheelEntry extends ConveyorSlot {
constructor() {
local w = fe.add_artwork("wheel");
w.preserve_aspect_ratio = true;
base.constructor(w);
}
function on_progress(progress, var) {
/* Center alignment */
local pos = abs(ceil(progress * wheels));
local size, alpha;
local pprogress = 1 - (pos.tofloat()/wheels - progress) * wheels;
print(pos + " " + progress + " " + pprogress + "\n");
size = 0.14;
alpha = 155;
if (pos == wheels/2 + 1) {
size = 0.2 - pprogress * 0.06;
alpha = 255 - pprogress * 100;
} else if (pos == wheels/2) {
size = 0.14 + pprogress * 0.06;
alpha = 155 + pprogress * 100;
}
/* Realign between -2pi/3 and -4pi/3 */
local angle = (progress * -2*pi/3) + 4*pi/3;
m_obj.x = (1.4 - size /2)*flw + flh * cos(angle);
m_obj.y = (0.5 - size /2)*flh + flh * sin(angle);
m_obj.width = size*flw;
m_obj.height = size*flh;
m_obj.alpha = alpha;
local rotation = (progress * -120) + 60;
m_obj.rotation = rotation;
}
};
local conveyor_bg = fe.add_text("", flw*0.73, flh*0, flw*0.28, flh*1);
conveyor_bg.set_bg_rgb(0,0,0);
conveyor_bg.bg_alpha = 220;
local slots = [];
for (local i=0; i<wheels; i++)
slots.push(WheelEntry());
local conveyor = Conveyor();
conveyor.set_slots(slots);
conveyor.transition_ms = config["spin_ms"].tointeger();
Can anyone help me out?