ExtendScript + Expression

<= Artigo anterior ExtendScript Working with Composions





Olá.





No artigo anterior, criamos a base do modelo para a construção de títulos na cena do After Effects. Adicionamos uma cena ao projeto, ou várias cenas. Agora precisamos adicionar os créditos à cena. Para adicionar títulos, você precisa criar modelos no layout AE, que nos servirão para cópia.





Entramos no projeto, onde a composição ModelScene_1x1 já foi criada . Na mesma pasta 1x1 , crie duas composições. Chamaremos um deles de ModelTitre_simple_1x1 , o outro ModelTitre_double_1x1 .





Vamos começar com a composição ModelTitre_simple_1x1 . Vamos adicioná-lo à composição ModelScene_1x1.





No próprio ModelTitre_simple_1x1, iremos criar uma caixa de texto. Vamos chamá-lo de texto_de_referência .





. , -. 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 , .





Agora temos layouts de dois tipos de títulos e está tudo pronto para colocá-los em cena. Mas falaremos sobre como fazer isso na próxima vez. 





Você pode baixar todas as expressões deste artigo aqui





Documentação de expressão aqui





Isso é tudo por hoje.





<= Artigo anterior ExtendScript Working with Composions








All Articles