Roland Tobiasz
Forum Replies Created
-
Once again. Thank you Oleg for the solution!
-
Perfect!
I needed to change the arrays to 2 values and it works perfectly for my project.
Thank you!
-
Thank you.
-
I’m still struggling to understand why this would need to be calculated.
If I put the ‘app.project.item(6).layer(“Null 1”).property(“Effects”).property(“Point Control”).property(“Point”)[1]’ into Source Text, the value is displayed correctly on the screen as the playhead moves along the timeline. No need to calculate it.
I would imagine that the script would want to find a frame instead of a keyframe where the value is greater than 500 and use it’s time to initiate the if…then … linear function.
So instead of looping through keyframes, loop through frames?
-
Dan,
I was testing the expression and I noticed that the change happens on the keyframe, which is a bit problematic if the keyframes are far apart and the values change significantly between them.
Here’s what I am seeing:
Keyframe1 (time = 1 seconds, value = 0)
Keyframe2 (time = 10 seconds, value = 1000)Your code changes the opacity at keyframe2 (10 seconds) although the 500 threshold was crossed at the 5 second time and ideally, that should have triggered the opacity change.
Is there a way to read the values between keyframes i.e. for each frame from the point control effect (thisComp.layer(“Null 1”).effect(“Point Control”)(“Point”)[0]) and use that to trigger the opacity change?
-
Thank you.
-
Dan,
Wow!
Thank you very much!
As I said at the beginning, I am just learning so your examples are a great source for that.
If I am reading your code correctly then if p has keyframes then find the closest keyframe to the current position, read it’s time and then use it in the linear function to set the start time and duration for the fade in – fade out.
Not sure what these 2 lines do:
if (time < p.key(n).time) n--;
...
p.key(1).value[0] >= 500 ? 0 : 100; -
I came up with this code, which toggles between 0 and 100 when the Null 1 value changes above or below 500 but it isn’t ramping the opacity over the 0.5 second duration.
fadeTime = .5;if (thisComp.layer("Null 1").effect("Point Control")("Point")[0]>=500){
linear(time,value,value+fadeTime,0,100)
}else if (thisComp.layer("Null 1").effect("Point Control")("Point")[0]<500) {
linear(time,value-fadeTime,value,100,0);
} -
Thank you Sir! You are spot on! I was trying to figure out the error for the past 3 hours!
Maybe you could help me with the entire expression and save me a few days of trying to figure it out on my own?
I have a null layer with a Point Control effect that I am using to hold values that I have populated using a script in 1 to 10 seconds linear keyframe intervals so I have approximately 100 keyframes.
pProperty = app.project.item(6).layer("Null 1").property("Effects").property("Point Control").property("Point")[1]I would like to linear in the opacity from 0 to 100 in 0.5 seconds if a keyframe value on pProperty is less than 500 and linear out the opacity from 100 to 0 in 0.5 seconds if a keyframe value on pProperty is >= 500.