Copy link to clipboard
Copied
I have done tons of search query's on this... it seems so simple on the surface, but can't nail it.
1- I have a simple y-pos animation in a precomp -- to transition from a blank screen to the screen full with content
2- I have a parent-comp with two comp-markers, that will trigger the appropriate nested precomps to play real-time
I am using the comp below to time three-scenes for each of 3-digital signage boards (FCP, VCP, ICP) simultaneously.
3- My approach and the problem
var compWithMarker = comp("Proof_DS_");
var show2 = compWithMarker.marker.key("Show2").time;
var show3 = compWithMarker.marker.key("Show3").time;
linear(time,show2,100,0,100)
Thank you!
Try it this way:
var compWithMarker = comp("Proof_DS_");
var show2 = compWithMarker.marker.key("Show2").time;
var show3 = compWithMarker.marker.key("Show3").time;
time < show2 ? 0 : time - show2
Copy link to clipboard
Copied
Try it this way:
var compWithMarker = comp("Proof_DS_");
var show2 = compWithMarker.marker.key("Show2").time;
var show3 = compWithMarker.marker.key("Show3").time;
time < show2 ? 0 : time - show2
Copy link to clipboard
Copied
Oh my goodness, thank you so much -- it worked!
I have never seen either a question mark, or a colon in an expression line.
Do you care to elaborate what is going on here? If not, no worries, it works, and I am grateful for your help Dan.
Copy link to clipboard
Copied
It's just the ternary conditional JavaScript operator. If the condition (the part before the ?) is true, it does what's between the ? and the : -- otherwise it does what's after the :
So once the current time reaches the marker, it uses time - show2, before that it holds at 0.
Dan
Copy link to clipboard
Copied
So it's just short hand for if/then?
? = if
: = then
That's awesome!
Copy link to clipboard
Copied
It's the same as this:
if (time < show2) { 0 } else { time - show2 }
Dan
Copy link to clipboard
Copied
Thank you!