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

How to change color to shape from other composition?

New Here ,
Jun 18, 2024 Jun 18, 2024

Copy link to clipboard

Copied

Hey all,

I have a compositions named from P1 to P10 (I'll call them "Parent" compositions) consisting of shape "RandShape" and  composition named "C" + number according to the composition in which it is located (I'll call them "Child" compositions). Compositions "Child" consisting of shape "ParShape". I need to change ParShape's color to RandShape's color. RandShape's color generates randomly. 

Any ideas how to do it with script?

TOPICS
Scripting

Views

67

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

correct answers 1 Correct answer

New Here , Jun 18, 2024 Jun 18, 2024

I did it!

var child = app.project.item(1);
var parent = app.project.item(12);

for(i = 1; i <= placeholder.numItems; i++){
  compId = comps.item(i);
  var rgbValue = compId.layer("RandShape").content("Ellipse 5").content("Fill 1").color.value;
  child.item(i).layer("ParShape").content("Rectangle 1").content("Fill 1").color.setValue(rgbValue);
}

 

Votes

Translate

Translate
New Here ,
Jun 18, 2024 Jun 18, 2024

Copy link to clipboard

Copied

LATEST

I did it!

var child = app.project.item(1);
var parent = app.project.item(12);

for(i = 1; i <= placeholder.numItems; i++){
  compId = comps.item(i);
  var rgbValue = compId.layer("RandShape").content("Ellipse 5").content("Fill 1").color.value;
  child.item(i).layer("ParShape").content("Rectangle 1").content("Fill 1").color.setValue(rgbValue);
}

 

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