Author Topic: Animate a Suffle List  (Read 132 times)

zlagos

  • Full Member
  • ***
  • Posts: 58
    • View Profile
Animate a Suffle List
« on: June 28, 2018, 03:35:00 PM »
I want to make an animation of a Shuffle List made with the keilmillerjr module.

It is this:

Code: [Select]
// List
if (my_config["wheel_type"] == "list")
{

fe.load_module("shuffle");

local list = Shuffle(10, "text", "[Title]");

list.slots[0].set_pos(flx*0.75, fly*0.17, flw*0.25, flh*0.042);
list.slots[0].set_rgb(R,G,B);
list.slots[0].charsize = font_list_size;
list.slots[0].align = my_align;

list.slots[1].set_pos(flx*0.75, fly*0.20, flw*0.25, flh*0.042);
list.slots[1].set_rgb(R,G,B);
list.slots[1].charsize = font_list_size;
list.slots[1].align = my_align;

list.slots[2].set_pos(flx*0.75, fly*0.23, flw*0.25, flh*0.042);
list.slots[2].set_rgb(R,G,B);
list.slots[2].charsize = font_list_size;
list.slots[2].align = my_align;

list.slots[3].set_pos(flx*0.75, fly*0.26, flw*0.25, flh*0.042);
list.slots[3].set_rgb(R,G,B);
list.slots[3].charsize = font_list_size;
list.slots[3].align = my_align;

list.slots[4].set_pos(flx*0.75, fly*0.29, flw*0.25, flh*0.042);
list.slots[4].set_rgb(R,G,B);
list.slots[4].charsize = font_list_size;
list.slots[4].align = my_align;

list.slots[5].set_pos(flx*0.75, fly*0.32, flw*0.25, flh*0.042);
list.slots[5].set_rgb(R,G,B);
list.slots[5].charsize = font_list_size;
list.slots[5].align = my_align;

list.slots[6].set_pos(flx*0.75, fly*0.35, flw*0.25, flh*0.042);
list.slots[6].set_rgb(R,G,B);
list.slots[6].charsize = font_list_size;
list.slots[6].align = my_align;

list.slots[7].set_pos(flx*0.75, fly*0.38, flw*0.25, flh*0.042);
list.slots[7].set_rgb(R,G,B);
list.slots[7].charsize = font_list_size;
list.slots[7].align = my_align;

list.slots[8].set_pos(flx*0.75, fly*0.41, flw*0.25, flh*0.042);
list.slots[8].set_rgb(R,G,B);
list.slots[8].charsize = font_list_size;
list.slots[8].align = my_align;

list.slots[9].set_pos(flx*0.75, fly*0.44, flw*0.25, flh*0.042);
list.slots[9].set_rgb(R,G,B);
list.slots[9].charsize = font_list_size;
list.slots[9].align = my_align;


class ShufflePow extends Shuffle
{
function select(slot)
{
slot.visible = true;
}

function deselect(slot)
{
slot.visible = false;
}
}

local my_pointer = my_config["set_marker_rgb"] + ".png";

local pow = ShufflePow(10, "image", "pointers/" + my_pointer);

pow.slots[0].set_pos(flx*0.7498, fly*0.18, flw*0.25, flh*0.026);
pow.slots[1].set_pos(flx*0.7498, fly*0.21, flw*0.25, flh*0.026);
pow.slots[2].set_pos(flx*0.7498, fly*0.24, flw*0.25, flh*0.026);
pow.slots[3].set_pos(flx*0.7498, fly*0.27, flw*0.25, flh*0.026);
pow.slots[4].set_pos(flx*0.7498, fly*0.30, flw*0.25, flh*0.026);
pow.slots[5].set_pos(flx*0.7498, fly*0.33, flw*0.25, flh*0.026);
pow.slots[6].set_pos(flx*0.7498, fly*0.36, flw*0.25, flh*0.026);
pow.slots[7].set_pos(flx*0.7498, fly*0.39, flw*0.25, flh*0.026);
pow.slots[8].set_pos(flx*0.7498, fly*0.42, flw*0.25, flh*0.026);
pow.slots[9].set_pos(flx*0.7498, fly*0.45, flw*0.25, flh*0.026);


// Sound
function fade_transitions(ttype, var, ttime) {
switch (ttype) {
case Transition.ToNewSelection:
case Transition.ToNewList:
local Wheelclick = fe.add_sound("pointers/clic.mp3")
Wheelclick.playing=true
break;
}
return false;
}

fe.add_transition_callback("fade_transitions");
}


To animate a normal ListBox, i use objects, as in this example, which makes it disappear on the right after 5 seconds:

Code: [Select]
// Listbox
if (my_config["wheel_type"] == "listbox")
{
::OBJECTS <- {lbx = fe.add_listbox(flx*0.75, fly*0.2, flw*0.25, flh*0.8)}
OBJECTS.lbx.rows = 27;
OBJECTS.lbx.charsize = font_list_size;
OBJECTS.lbx.set_selbg_rgb(Rs,Gs,Bs);
OBJECTS.lbx.set_rgb(R,G,B);
OBJECTS.lbx.set_sel_rgb(R,G,B);
OBJECTS.lbx.sel_style = Style.Bold;

// List Text Align
if (my_config["set_align"] == "centre") OBJECTS.lbx.align = Align.Centre;
if (my_config["set_align"] == "left") OBJECTS.lbx.align = Align.Left;
if (my_config["set_align"] == "right") OBJECTS.lbx.align = Align.Right;

local my_delay = 5000;

local move_lbx1 = { when = Transition.ToNewSelection, property = "x", start = OBJECTS.lbx.x + OBJECTS.lbx.width, end = OBJECTS.lbx.x, time = 1 }
local move_lbx2 = { when = When.ToNewSelection, property = "x", start = OBJECTS.lbx.x, end = OBJECTS.lbx.x + OBJECTS.lbx.width, time = 595, delay=my_delay }
animation.add(PropertyAnimation(OBJECTS.lbx, move_lbx1));
animation.add(PropertyAnimation(OBJECTS.lbx, move_lbx2));
}

Well, i would like the Shuffle List to do the same, but i do not know how.

keilmillerjr, please tell me if it can be done or not, thank you.

zlagos

  • Full Member
  • ***
  • Posts: 58
    • View Profile
Re: Animate a Suffle List
« Reply #1 on: July 04, 2018, 02:23:24 AM »
keilmillerjr seems to be on holidays or missing in action...  ::)

bundangdon

  • Sr. Member
  • ****
  • Posts: 145
    • View Profile
Re: Animate a Suffle List
« Reply #2 on: July 04, 2018, 05:10:02 AM »
keilmillerjr seems to be on holidays or missing in action...  ::)

Not missing in action. I noticed he was on attractmode's discord site earlier today  :D

qqplayer

  • Sr. Member
  • ****
  • Posts: 231
    • View Profile
Re: Animate a Suffle List
« Reply #3 on: July 04, 2018, 05:43:31 AM »
Change for text and avoid "width''  ;D

Code: [Select]
class ShufflePow extends Shuffle
 {

   function select(slot)
 {
slot.visible = true;
}

function deselect(slot)
 {
slot.visible = false;
}

}


::OBJECTS1 <- {
pow = ShufflePow(5, "artwork", "flyer2")
}

OBJECTS1.pow.slots[0].set_pos(flx*0.018, flh*0.495, flw*0.19, flh*0.45);

//Slot 0 Animation
fe.add_transition_callback( "first_transitions" );
function first_transitions( ttype, var, ttime ) {
 switch ( ttype )
 {
 
  case Transition.StartLayout:
  case Transition.ToNewList:
  case Transition.ToNewSelection:
   
  local pow0_alpha_onload = {
    property = "alpha",
    start = 55,
    end = 255,
    time = 200,
    tween = Tween.Expo,
    } 
   
  animation.add( PropertyAnimation ( OBJECTS1.pow.slots[0], pow0_alpha_onload ) );
   
    local pow0_width_onload = {
    property = "width",
    start = flw*0.005,
    end = flw*0.244,
    time = 400,
    tween = Tween.Expo,
    }
   
  animation.add( PropertyAnimation ( OBJECTS1.pow.slots[0], pow0_width_onload ) );

  break;
 }
 return false;
 }


OBJECTS1.pow.slots[1].set_pos(flx*0.148, flh*0.06, flw*0.9, flh*0.45);
local pow1_alpha = {
    when = Transition.ToNewSelection, property = "alpha", start = 55, end = 255, time = 200, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[1], pow1_alpha ) );
 
local pow1_width = {
    when = Transition.ToNewSelection, property = "width", start = flw*0.005, end = flw*0.244, time = 500, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[1], pow1_width ) );
 
 

OBJECTS1.pow.slots[2].set_pos(flx*0.348, flh*0.06, flw*0.19, flh*0.45);
local pow2_alpha = {
    when = Transition.ToNewSelection, property = "alpha", start = 55, end = 255, time = 200, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[2], pow2_alpha ) );
 
local pow2_width = {
    when = Transition.ToNewSelection, property = "width", start = flw*0.005, end = flw*0.244, time = 500, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[2], pow2_width ) );
 
 

OBJECTS1.pow.slots[3].set_pos(flx*0.548, flh*0.06, flw*0.19, flh*0.45);
local pow3_alpha = {
    when = Transition.ToNewSelection, property = "alpha", start = 55, end = 255, time = 200, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[3], pow3_alpha ) );
 
local pow3_width = {
    when = Transition.ToNewSelection, property = "width", start = flw*0.005, end = flw*0.244, time = 500, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[3], pow3_width ) );
 
 

OBJECTS1.pow.slots[4].set_pos(flx*0.748, flh*0.06, flw*0.19, flh*0.45);
local pow4_alpha = {
    when = Transition.ToNewSelection, property = "alpha", start = 55, end = 255, time = 200, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[4], pow4_alpha ) );
 
local pow4_width = {
    when = Transition.ToNewSelection, property = "width", start = flw*0.005, end = flw*0.244, time = 500, tween = Tween.Expo,
 }
 animation.add( PropertyAnimation( OBJECTS1.pow.slots[4], pow4_width ) );
« Last Edit: July 04, 2018, 05:46:54 AM by qqplayer »

keilmillerjr

  • Sr. Member
  • ****
  • Posts: 486
    • View Profile
Re: Animate a Suffle List
« Reply #4 on: July 04, 2018, 07:33:51 AM »
Sorry. My attendance is flakey past few months. Holiday means I have some time. Was busy past two nights writin a new plugin and something else, almost ready for release. ;)

I am not very familiar with animation module. I write simple animations from scratch and call it good. I wrote shuffle to be simple, without complexity. That doesn’t mean that simple animations can’t be added. I have thought of adding positioning like conveyor if some one experienced with conveyor wanted to team up with me.

Anyways, I will check out your examples tonight. You can extend select and deselect functions and use them possibly to trigger animations. If you have a layout you are working on, send it to me.

zlagos

  • Full Member
  • ***
  • Posts: 58
    • View Profile
Re: Animate a Suffle List
« Reply #5 on: July 05, 2018, 09:17:16 AM »
Sorry. My attendance is flakey past few months. Holiday means I have some time. Was busy past two nights writin a new plugin and something else, almost ready for release. ;)

I am not very familiar with animation module. I write simple animations from scratch and call it good. I wrote shuffle to be simple, without complexity. That doesn’t mean that simple animations can’t be added. I have thought of adding positioning like conveyor if some one experienced with conveyor wanted to team up with me.

Anyways, I will check out your examples tonight. You can extend select and deselect functions and use them possibly to trigger animations. If you have a layout you are working on, send it to me.

Thanks...

My layout: http://forum.attractmode.org/index.php?topic=481.msg15538#msg15538