ExtendScript + Expresión

<= Artículo anterior ExtendScript trabajando con composiciones





Hola.





En el artículo anterior, hicimos la base del modelo para crear títulos en la escena After Effects. Agregamos una escena al proyecto, o varias escenas. Ahora necesitamos agregar los créditos a la escena. Para agregar títulos, es necesario crear modelos en el diseño AE, que nos servirán para copiar.





Entramos en el proyecto, donde ya se ha creado la composición ModelScene_1x1. En la misma carpeta 1x1 , cree dos composiciones. A uno de ellos lo llamaremos ModelTitre_simple_1x1 , al otro ModelTitre_double_1x1 .





Comencemos con la composición ModelTitre_simple_1x1 . Agreguémoslo a la composición ModelScene_1x1.





En el propio ModelTitre_simple_1x1, crearemos un cuadro de texto. Llamémoslo texto_de_referencia .





. , -. After Effects, . , . . Expression, Javascript, , . . reference_text, Transform, Position.





Animation > Add Expression. Position Expression , .





:





var width = Math.round(thisLayer.sourceRectAtTime().width);
var padding = 20;
var hideX = -width - padding;
var showX = padding;
var posY = transform.position[1];
var animationTime = 0.5;

var timeIn = comp("ModelScene_1x1")
   .layer(thisComp.name)
   .inPoint;

var timeOut = comp("ModelScene_1x1")
   .layer(thisComp.name)
   .outPoint;

if (time <= animationTime) {
   easeOut(
       time,
       0,
       animationTime,
       [hideX, posY],
       [showX, posY]
   );
} else {
   easeOut(
       time,
       timeOut - timeIn - animationTime,
       timeOut - timeIn,
       [showX, posY],
       [hideX, posY]
   );
}
      
      



, . . . thisLayer, , sourceRectAtTime, .





thisLayer.sourceRectAtTime().width
      
      



. . , , .





var hideX = -width - padding;
var showX = padding;
      
      



Y ,





var posY = transform.position[1];
      
      



, . , .





var animationTime = 0.5;

var timeIn = comp("ModelScene_1x1")
   .layer(thisComp.name)
   .inPoint;

var timeOut = comp("ModelScene_1x1")
   .layer(thisComp.name)
   .outPoint;
      
      



, ModelScene_1x1, . , , thisComp.name. inPoint outPoint   .





, . , 0. animationTime, , .





if (time <= animationTime) {
   easeOut(
       time,
       0,
       animationTime,
       [hideX, posY],
       [showX, posY]
   );
}
      
      



easeOut, , 5 . 





  • time -





  • startTime - , time >= startTime





  • endTime -





  • startPosition -





  • endPosition -





position , X Y. , , X, - Y.





, ,





easeOut(
       time,
       timeOut - timeIn - animationTime,
       timeOut - timeIn,
       [showX, posY],
       [hideX, posY]
   );
      
      



-





timeOut - timeIn
      
      



animationTime





timeOut - timeIn - animationTime
      
      



, , ModelScene_1x1. , , .





, ModelTiter_double_1x1. . , . , , . reference_text, strin_1 string_2





reference_text Guide Layer.





, . , string_1 string_2. ? . , reference_text. , .





, Expression. sourceText string_1 Animation > Add Expression









var refText = thisComp.layer("reference_text")
    .text.sourceText.split("\r");

var stringID = parseInt(thisLayer.name.split("_")[1]);

refText[stringID - 1]
      
      



reference_text . , \r. refText[0], , id, refText id. sourceText string_2. string_1 reference_text, string_2 - .





. simple, , . , .





Position string_1Expression ModelTitre_simple_1x1. delay.





var delay = 0.3;
      
      



( 0.3 ):





easeOut(time,
   timeOut - timeIn - animationTime - delay,
   timeOut - timeIn - delay,
   [showX, posY],
   [hideX, posY]
);
      
      



, delay , .





Ahora tenemos layouts de dos tipos de títulos y todo está listo para ponerlos en escena. Pero hablaremos sobre cómo hacer esto la próxima vez. 





Puede descargar todas las expresiones de este artículo aquí





Documentación de expresión aquí





Eso es todo por hoy.





<= Artículo anterior ExtendScript trabajando con composiciones








All Articles