Copy link to clipboard
Copied
Hello, I am using data located in a JSON file to create a graph.
In the below example, I pull a temperature # for the month of "Jan".
I would like to replace "Jan" by the current layer's name or better, by the name of the layer right below, to which I would add +1.
I have tried thisComp.layer(index).name with no luck.
eval("var variable="+footage("exportedxls.json").sourceText);
hauteur = variable[0].Jan;
min = thisComp.layer("Slider Controls").effect("Min")("Slider");
max = thisComp.layer("Slider Controls").effect("Max")("Slider");
max_movement = -thisComp.layer("Slider Controls").effect("Max Movement")("Slider")
newBaseline = thisComp.layer("Slider Controls").effect("New Baseline")("Slider");
myYheight = ((hauteur - min) / max) * max_movement + newBaseline;
myXspace = thisComp.layer(index+1).transform.position[0]+thisComp.layer("Slider Controls").effect("Space btw points")("Slider");
[myXspace, myYheight]
Would anyone be able to help me out?
Thank you,
Alex
Copy link to clipboard
Copied
And what the are the layers actually called? Where is the layer name in your code even used? What error do you get? I'm confused.
Mylenium
Copy link to clipboard
Copied
I am very new art this and confused too...
Let's focus on: "I would like to replace "Jan" by the current layer's name". (whatever the name of the layer would be)
Would this be possible?
Thanks for your help.
Copy link to clipboard
Copied
Sure, but your are still not really explaining what specifically the issue is. Your layer.name construct should work, so the real question becomes what error you are running into. String conversion issues? Don't know where to place the code? What else?
Mylenium
Copy link to clipboard
Copied
This is my JSON file:
[{"p1":"0.1"}]
Works:The below code will return the value 0.1:
eval("var variable="+footage("exportedxls.json").sourceText);
hauteur = variable[0].p1;
Does not work: The below code will not return any value:
eval("var variable="+footage("exportedxls.json").sourceText);
hauteur = variable[0].thisComp.layer(index).name;
Note that the layer's name is p1.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more