The forum on this site is closed for new comments and posts. Continue the conversation in the new forum, and learn more here.

tap to trigger billboard and 3d animations; 2D and 3D animation states in state manager

  • Hi Deb,

    Are you using your own state manager system? At a high level, what you probably want to do is add an input for your animation's AnimationMixer in the state manager

    // @input Component.AnimationMixer animationMixer

    then when you enter the state, tell the animation mixer to play: 

    script.animationMixer.setWeight("AnimationLayerName", 1.0);
    script.animationMixer.start("AnimationLayerName", 0.0, -1.0);

    You can take a look at https://lensstudio.snapchat.com/api/classes/AnimationMixer/ for more information on playing 3D animation.

    Can't wait to see what you make!

    Jon

    Comment actions Permalink
  • Hey Jon,  finally trying this and it almost works.  I want to have the 3D character animate, then once the animation finishes, I want a 2D sprite billboard to spring down.  The billboard stays up for 5 seconds, then goes away, then the whole thing starts again.  I'm almost there but getting an error.  Can you help?

     

    Comment actions Permalink
  • Hi Deb! 

    What error are you getting? 

    Creating the Billboard Animation

    One way you can do this is to use the Tween system https://lensstudio.snapchat.com/guides/scripting/tweening/ which will allow you to animate your billboard up and down based on time. 

    Once you've imported the tween.lso found in the zip, you can select your billboard and in the Inspector panel: Add New > Script. Then select Tween > TweenTypes > TweenBillboard. 

    Then you can add different parameter to set how your billboard animates. I did something like the following to get the billboard to drop from out of the screen and have an elastic effect. Take a look at the guide above for more information.  

    You can add another script with TweenBillboard to do your outro animation. Don't forget to fill in 5.0 in the delay field so that the animation plays after 5 seconds.

    Since we want to play these tweens after the 3D animation ends, uncheck "Play Automatically". Then, for both of these tweens, you'll want to give it a name we can call it in script, like "billboard-in" and "billboard-out".  

    Calling the animation

    Finally, in the script where you play your animation, we can get a reference to this billboard object with the tween script. 

    // @input SceneObject billboard

    Then where we have the animation play, we can use "startWithCallback". Take a look at https://lensstudio.snapchat.com/api/classes/AnimationMixer/ for additional information. 

    script.AnimationMixer.startWithCallback(script.IdleAnimLayer, 0, 1, function () {
    global.tweenManager.startTween(script.billboard, "billboard-in");
    global.tweenManager.startTween(script.billboard, "billboard-out");
    });

    So your final script should look something like: 

    // @input Component.AnimationMixer AnimationMixer
    // @input string IdleAnimLayer

    // @input SceneObject billboard

    script.AnimationMixer.startWithCallback(script.IdleAnimLayer, 0, 1, function () {
    global.tweenManager.startTween(script.billboard, "billboard-in");
    global.tweenManager.startTween(script.billboard, "billboard-out");
    });


    Let me know if I can clarify anything. Don't forget to share what you come up with :)

    Cheers,

    Jon

    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?

Version

Graphics

Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:

Name:

Email:

What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!