Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pcca-matrix

Pages: [1]
1
Scripting / Re: Scripting Help - First time user
« on: December 31, 2019, 05:48:04 AM »
if he has no programming experience, read the doc will not help him !

sometimes some simple example can help a lot  ;)

Code: [Select]
flx <- fe.layout.width=1920;
fly <- fe.layout.height=1080;

// modules
fe.load_module("conveyor");

// Wheel
local wheel_x = [ flx*0.94, flx*0.935, flx*0.896, flx*0.865, flx*0.84, flx*0.82, flx*0.78, flx*0.82, flx*0.84, flx*0.865, flx*0.896, flx*0.90, ];
local wheel_y = [ -fly*0.22, -fly*0.105, fly*0.0, fly*0.105, fly*0.215, fly*0.325, fly*0.436, fly*0.61, fly*0.72 fly*0.83, fly*0.935, fly*0.99, ];
local wheel_w = [ flx*0.15, flx*0.15, flx*0.15, flx*0.15, flx*0.15, flx*0.15, flx*0.22, flx*0.15, flx*0.15, flx*0.15, flx*0.15, flx*0.15, ];
local wheel_h = [  fly*0.10,  fly*0.10,  fly*0.10,  fly*0.10,  fly*0.10,  fly*0.10, fly*0.14,  fly*0.10,  fly*0.10,  fly*0.10,  fly*0.10,  fly*0.10, ];
local wheel_r = [  30,  25,  20,  15,  10,   5,   0, -10, -15, -20, -25, -30, ];
local wheel_a = [  90,  90,  90,  90,  90,  90, 90,  90,  90,  90,  90,  90, ];
local num_arts = 8;

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 >=10 ) slot=10;
        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 = 50;
try { conveyor.transition_ms = my_config["transition_ms"].tointeger(); } catch ( e ) { }

// Video Snap
local snap = fe.add_artwork("snap", 0, 0, flx, fly);
snap.preserve_aspect_ratio = false;
snap.zorder=-1;

2
Scripting / 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

Pages: [1]