Copy link to clipboard
Copied
I'm looking for a way to create a frame-based mask from a script (jsx).
I can create a mask based on time (seconds) with addKey (), but I don't know how to mask based on the frame.
keyIndex1 = newMask.property(1).addKey(frame * frameDuration);
newMask.property(1).setInterpolationTypeAtKey(keyIndex1, KeyframeInterpolationType.HOLD);
If anyone knows how to create a mask based on a frame without using addkey (), please let me know.
Copy link to clipboard
Copied
Time conversion methods such as frameToTime() are available both in scripts and expressions. That's all you need.
Mylenium
Copy link to clipboard
Copied
The frameToTime () function was not recognized as a function in the script.
By the way, is there any other way to convert to frame unit?
Copy link to clipboard
Copied
Not sur ewhat your question is. You already have the answer how to convert number of frames to a time in seconds in your example:
frame * frameDuration
Copy link to clipboard
Copied
In the official addKey () function description, the addKey argument specifies the number of seconds.
Basically, there is no problem with specifying the number of seconds.
But,In the case of a long movie (after about 8 minutes), problems such as the mask collapsing, the rotobeje not being applied, and an unrelated mask appearing will occur.
While investigating the cause of the problem, I suspect that the cause is that the number of digits in the value of frame * frameDuration becomes large.
On the other hand, if you reduce the number of digits in frame * frameDuration, the frame will deviate from the frame you want to mask, so you cannot reduce the number of digits poorly.
Therefore, this time I was looking for a method that can be set on a frame-by-frame basis.