Author: zmike Language: lua
Description: Example E18 Compositor Effect Timestamp: 2013-06-10 13:30:59 +0000
View raw paste Reply
  1. group { name: "e/comp/effects/auto/pane";
  2.    //data.item: "noclip" "1"; //setting this prevents object from being clipped to its zone during effect
  3.    script {
  4.       public message(Msg_Type:type, id, ...) {
  5.          if ((type == MSG_INT_SET) && (id == 0)) {
  6.             /* set state */
  7.             new st;
  8.  
  9.             st = getarg(2);
  10.             if (st == 1)
  11.               set_state(PART:"mover", "custom", 0.0);
  12.             else
  13.               set_state(PART:"mover", "default", 0.0);
  14.          } else if ((type == MSG_INT_SET) && (id == 1)) {
  15.             /* border geom[4] / screen size[2] / desk change direction[2] */
  16.             new x, y, sw, sh, dx, dy;
  17.  
  18.             sw = getarg(6);
  19.             sh = getarg(7);
  20.             dx = getarg(8);
  21.             dy = getarg(9);
  22.  
  23.             x = round(sw*dx*1.5);
  24.             y = round(sh*dy*1.5);
  25.  
  26.             custom_state(PART:"mover", "default", 0.0);
  27.             set_state_val(PART:"mover", STATE_REL1_OFFSET, x, y);
  28.             set_state_val(PART:"mover", STATE_REL2_OFFSET, x, y);
  29.          }
  30.       }
  31.    }
  32.    parts {
  33.       part { name: "mover"; type: SPACER;
  34.         description { state: "default" 0.0;
  35.         }
  36.       }
  37.       part { name: "e.swallow.content"; type: SWALLOW;
  38.         description { state: "default" 0.0;
  39.            rel1.to: "mover";
  40.            rel2.to: "mover";
  41.         }
  42.       }
  43.    }
  44.    programs {
  45.       program {
  46.          name: "show";
  47.          signal: "e,action,go";
  48.          source: "e";
  49.          filter: "mover" "default";
  50.          action: STATE_SET "custom" 0.0;
  51.          transition: DECELERATE COMP_EFFECT_DURATION CURRENT;
  52.          target: "mover";
  53.          after: "done";
  54.       }
  55.       program {
  56.          name: "hide";
  57.          signal: "e,action,go";
  58.          source: "e";
  59.          filter: "mover" "custom";
  60.          action: STATE_SET "default" 0.0;
  61.          transition: DECELERATE COMP_EFFECT_DURATION CURRENT;
  62.          target: "mover";
  63.          after: "done";
  64.       }
  65.       program {
  66.          name: "stop";
  67.          signal: "e,action,stop";
  68.          source: "e";
  69.          action: ACTION_STOP;
  70.          target: "show";
  71.          target: "hide";
  72.       }
  73.       program {
  74.          name: "done";
  75.          action: SIGNAL_EMIT "e,action,done" "e";
  76.       }
  77.    }
  78. }
View raw paste Reply