Author Topic: Random animations  (Read 1456 times)

pcca-matrix

  • Newbie
  • *
  • Posts: 4
    • View Profile
Random animations
« on: December 30, 2019, 12:31:33 PM »
Hi
I am new to this forum,
I want to create a new layout and I would like to have random animations for objects.

is there any possiblities to remove an animation from table ? so i can replace with new animation at next artwork update.

what i tried :

Code: [Select]
function transition( ttype, var, ttime )
    {
        if ( ttype == Transition.EndNavigation || ttype == Transition.ToNewList )
        {
            local chs = random(1,3);
            switch(chs){
                case 1:         
                PropertyAnimation(cda._front).name("t").key("alpha").from(0).to(255).triggers([Transition.ToNewSelection]).play()
                PropertyAnimation(cda._front).name("t").key("y").from(cda._front.y).to(200).duration(1100).triggers([Transition.EndNavigation]).play()
                PropertyAnimation(cda._front).name("t").key("x").from(cda._front.x).to(460).duration(1100).triggers([Transition.EndNavigation]).play()
                PropertyAnimation(cda._front).name("t").key("rotation").delay(500).from(0).to(350).duration(1100).triggers([Transition.EndNavigation]).play()
                break;
               
                case 2:
                PropertyAnimation(cda._front).name("t").key("alpha").from(0).to(255).triggers([Transition.ToNewSelection]).play()
                PropertyAnimation(cda._front).name("t").key("y").from(cda._front.y).to(200).duration(600).triggers([Transition.EndNavigation]).play()
                PropertyAnimation(cda._front).name("t").key("x").from(cda._front.x).to(460).duration(600).triggers([Transition.EndNavigation]).play()
                PropertyAnimation(cda._front).name("t").key("rotation").from(0).to(35).duration(600).triggers([Transition.EndNavigation]).play()

                break;
               
                case 3:
                PropertyAnimation(cda._front)
                  .name("t")
                  .triggers([Transition.EndNavigation])
                  .easing("ease-in-out-quint")
                  .state("left", { x = 250, y = 150 })
                  .state("right", { x = 950, y = 150 })
                  .from("left").to("right")
                  .loop(2)
                  .yoyo()
                break;
            }         
        }
    }   

but animation is reapeated multiple time