Creating a Script to play different animations based on what user selects
Hello,
I am looking to create a Lens where the User has options to select (similar to the Soundboard Template). When something is selected, it triggers an animation based on what the user selected. For example, 6 different GIF's to choose from, and that triggers an animation. At the end of the animation, the gif they selected would play. Is this doable?
Thanks
Chris
Hey Chris,
Jonathan helped out another community question with a similar question a couple months ago here. Does this post help you achieve the effect you were hoping for?
Cheers,
Kaitlyn
Yes this helps. I've actually been able to figure out how to do it using the Soundboard Template. Would you also be able to answer a question I have, I am looking to track the person's face to a video animation, is this doable in Lens Studio?
Sure, happy to help here. Can you explain a bit more the effect you're hoping to achieve though?
Hi Kaitlyn,
I am looking to create a Lens where the user can select between 6 different buttons, giving them a specific animation of someone dancing and the face is cut out so the user can have their face in there. Right now when I try and add the face inset it is being applied below the billboard (video). Hope this explains it well enough.
Thanks,
Chris
Another issue, probably really easy on our end just I have no idea how to make my billboard object disappear from the start. Basically what I have now are two buttons that trigger different animations which is what I want. The problem is, that when I preview on my device, the animation is already playing from the start without pressing the buttons. How do I fade in or just pop in the animation so its not just idling on the screen at the start?
Would be a huge help. Much appreciated!!!
Hey Chris,
To hide a object on the start you can simply disable the object. Like this:
For the animation you can use the Animation Mixer API page to pause the animation on initialize of the lens:
https://lensstudio.snapchat.com/api/classes/AnimationMixer/
the script above will play animation automatically and you can use the script and replace the start() with pause().
Please refer to API page to learn more about AnimationMixer component.
Best,
Amir.
Hey Chris, if you're looking to create some sort of button for the certain animation,
I have made you a project with 6 buttons.
mega.nz(download)
Hopefully this should make it much easier for you to make what your looking for :)
Wish you the best,
Matthew