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

adding an expression to an expression selector via a script.

Community Beginner ,
Feb 13, 2024 Feb 13, 2024

Copy link to clipboard

Copied

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
Experiment , Expressions , How to , Scripting

Views

65

Translate

Translate

Report

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

Copy link to clipboard

Copied

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;
}

Votes

Translate

Translate

Report

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
Engaged ,
Feb 13, 2024 Feb 13, 2024

Copy link to clipboard

Copied

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);
}

Votes

Translate

Translate

Report

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