Copy link to clipboard
Copied
Hi
I have been doing some very simple expressions like this to generate sin waves and add them. It works fine.
vel=100;
amp=50
freq1 =1; freq2=0.9; freq3=1.1;
x=time*vel;
wave1=Math.sin(freq1*time*2*Math.PI);
wave2=Math.sin(freq2*time*2*Math.PI);
wave3=Math.sin(freq3*time*2*Math.PI);
y= amp*(wave1+wave2+wave3)+thisComp.height/2-300;
[x,y];However, I would like to be able to have the value for y visible on the stage and updating as the animation goes on. I can't seem to find out how to do this. I guess it is something to do with dynamic text - but I can find how to set the styling but not how to set the actual value of the text.
Maybe I am using the wrong search terms.... Could someone please point me in the right direction?
Many thanks
I hope I have understood the question correctly
'Y: '+thisComp.layer("Shape Layer 1").transform.position[1].toFixed(2)
It may not be what you're looking for here, but I think it's useful to point out that as a debugging tool, you can often just plug an expression that you're working on into the source text property of a text layer and add an extra line to display a variable of interest. So in your case it would be like this to display y:
vel=100;
amp=50
freq1 =1; freq2=0.9; freq3=1.1;
x=time*vel;
wave1=Math.sin(freq1*time*2*Math.PI);
wave2=Math.sin(freq2*time*2*Math.PI);
wave3=Math.sin(freq3*time*2*Math.PI);
y...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Perfect - thank you so much.
Copy link to clipboard
Copied
It may not be what you're looking for here, but I think it's useful to point out that as a debugging tool, you can often just plug an expression that you're working on into the source text property of a text layer and add an extra line to display a variable of interest. So in your case it would be like this to display y:
vel=100;
amp=50
freq1 =1; freq2=0.9; freq3=1.1;
x=time*vel;
wave1=Math.sin(freq1*time*2*Math.PI);
wave2=Math.sin(freq2*time*2*Math.PI);
wave3=Math.sin(freq3*time*2*Math.PI);
y= amp*(wave1+wave2+wave3)+thisComp.height/2-300;
[x,y];
y
Copy link to clipboard
Copied
it was for debugging that I wanted to do this - so this is perfect too
Than ks
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more