Copy link to clipboard
Copied
in the expressions the position property has speed attribute but not in the script. Is there a way to get the speed of a property in script? And can we get the avarage speed exactly?
You could have your script temporarily add an expression, and then harvest the speed value and delete the expression. Or, you could approximate it by using .valueAtTime() with your target time and again with the same time plus a tiny increment and do the math to calculate the difference divided by the time interval. Something like that. But no, you don't have those tools directly available in scripting.
Copy link to clipboard
Copied
I am not sure what you are trying to accomplish. What "speed" attribute are you talking about and how are you trying to use it?
Copy link to clipboard
Copied
just wanted to make a script where I needed it. in the expression type position.speed, you will see
Copy link to clipboard
Copied
You could have your script temporarily add an expression, and then harvest the speed value and delete the expression. Or, you could approximate it by using .valueAtTime() with your target time and again with the same time plus a tiny increment and do the math to calculate the difference divided by the time interval. Something like that. But no, you don't have those tools directly available in scripting.
Copy link to clipboard
Copied
Thank you very much, the temporary expression method seems the most sensible.
Copy link to clipboard
Copied
And do you know how to do the operation like you ctrl/cmd click the eased keyframe and remove the eases, how to do that with script? It automatically sets the speed of the keyframe to the average speed, which I can't set with changing the keyframe eases with setTemporaleEaseAtKey() method because I don't know the average speed. I think the easiest way would be the to do it with command ID if there is sth like that.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now