Skip to main content
PetePLTR
Participating Frequently
February 13, 2024
Question

adding an expression to an expression selector via a script.

  • February 13, 2024
  • 2 replies
  • 345 views

I'm working on a .jsx and I've hit a wall with adding an expression to an expression selector.

This is the chunk of code I have that gives no errors, but doesn't actually add the expression to the expressible selector....

 

function createLabelsTextLayer(comp, labels) {
  var textLayer = comp.layers.addText("Labels");
  textLayer.name = "Labels";
  var textProp = textLayer.property("Source Text");
  var expression = '["' + labels.join('", "') + '"]';
  textProp.expression = expression;

  // Create a single position animator
  var myAnim = textLayer.Text.Animators.addProperty("ADBE Text Animator");
  myAnim.property("ADBE Text Animator Properties").addProperty("ADBE Text Position 3D");
  var expressionSelector = myAnim.property("ADBE Text Selectors").addProperty("ADBE Text Expressible Selector");
  var expSel = expressionSelector.property("ADBE Text Expressible Amount").expression;
  var expression1 = "wiggle(5, 50)";
  expSel.expression1 = expression1;

  // based on lines
  var basedOnProperty = expressionSelector.property("ADBE Text Range Type2");
  basedOnProperty.setValue(4);

  return textLayer;
}

 

where am I going wrong?

 

 

 

This topic has been closed for replies.

2 replies

Legend
February 13, 2024

This line is wrong:

  expSel.expression1 = expression1;

 

function createLabelsTextLayer(comp, labels) {
var textLayer = comp.layers.addText("Labels");
textLayer.name = "Labels";
var textProp = textLayer.property("Source Text");
var expression = '["' + labels.join('", "') + '"]';
textProp.expression = expression;

// Create a single position animator
var myAnim = textLayer.Text.Animators.addProperty("ADBE Text Animator");
myAnim.property("ADBE Text Animator Properties").addProperty("ADBE Text Position 3D");
var expressionSelector = myAnim.property("ADBE Text Selectors").addProperty("ADBE Text Expressible Selector");

var expression1 = "wiggle(5, 50)";
expressionSelector.property("ADBE Text Expressible Amount").expression = expression1;

// based on lines
var basedOnProperty = expressionSelector.property("ADBE Text Range Type2");
basedOnProperty.setValue(1);
}
PetePLTR
PetePLTRAuthor
Participating Frequently
February 13, 2024

solved via gtp....

 

function createLabelsTextLayer(comp, labels) {
  var textLayer = comp.layers.addText("Labels");
  textLayer.name = "Labels";
  var textProp = textLayer.property("Source Text");
  var expression = '["' + labels.join('", "') + '"]';
  textProp.expression = expression;

  // Create a single position animator
  var myAnim = textLayer.Text.Animators.addProperty("ADBE Text Animator");
  myAnim.property("ADBE Text Animator Properties").addProperty("ADBE Text Position 3D");
  var expressionSelector = myAnim.property("ADBE Text Selectors").addProperty("ADBE Text Expressible Selector");
  var expSel = expressionSelector.property("ADBE Text Expressible Amount");
  var expression1 = "wiggle(5, 50)";
  expSel.expression = expression1;

  // based on lines
  var basedOnProperty = expressionSelector.property("ADBE Text Range Type2");
  basedOnProperty.setValue(4);

  return textLayer;
}