Scripting an animated Opacity Mask
Hi friends!
I'm trying to script the playing of a couple of animated .mp4 Opacity Masks, and am having a doozy of a time.
Using the new Behavior script with the animated mask selected for "Animated Texture" and the Screen Image object in question for the "Visual Object" is returning an error of wrong argument number count.
Using a custom script on the Screen Image object also seems to not be working:
var myAnimation = script.getSceneObject().getFirstComponent("Component.Image");
var loops = 0;
var offset = 0.0;
myAnimation.mainPass.opacityTex.control.play(loops, offset);
This also returns a wrong argument count error on line 4: 1 expected, got 2.
My goal is simply to have the masks not animate until a trigger is satisfied, then play once.
Thanks for all of your help!
-
Hey Zach,
Can you share your project including your animation so i can take a look for you?
Comment actions -
Thanks for the offer! Here it is a bit cleaned up but with the errors still occurring.
Comment actions -
Hey, Thank you for providing the project file.
Here's the project you wanted.
It plays once when you open your mouth.
https://drive.google.com/open?id=1HIVyKdFN3bv4i_prl2sbPCB_ZuOH631y
Let me know if i can help you with anything else.
Comment actions -
Whoah, thanks! It was really stumping us. Appreciate the help.
Comment actions -
This is kinda like the solution we actually just came to! Now trying to tackle how to get the animation to not be at the endframe when the lens is loaded. May have to just enable it on trigger.
Comment actions -
Hi Zach!
You can add a script on Initialized to set the animation position when the Lens is loaded:
//@input Asset.Texture texture
script.texture.control.pauseAtFrame(0);Then, when you use that script you should have an input field where you can put your texture and have it start on the first frame.
Can't wait to see the result!
Cheers,
Jon
Comment actions -
Perfect, thanks Jon!
Comment actions
Please sign in to leave a comment.
Have a comment?