Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

adding an expression to an expression selector via a script.

Community Beginner ,
Feb 13, 2024 Feb 13, 2024

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?

 

 

 

TOPICS
Expressions , How to , Scripting
200
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 13, 2024 Feb 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;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 13, 2024 Feb 13, 2024
LATEST

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);
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines