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

Need Help with tween on Texture UV movement.

  • Nice✔️💜💜💜💜

    Comment actions Permalink
  • This lens is looking great, i hope you will find a way to solve this problem!

    Comment actions Permalink
  • Hi Brendan! 

    Lens is looking cool! If you are ok with a linear interpolation, you likely don't even need Tween Manager:

     

    var original = new vec2(0, .2);
    var target = new vec2(0, .6);
    var nextValue = vec2.lerp(original, target, percentMoved);
    script.straw_red_anim.mainPass.uv2Offset = nextValue

    where percentMoved is a number between 0, to 1 depending where you want it between .2 and .6

    Can't wait to see final Lens. 

    Cheers!
    Jonathan 

    Comment actions Permalink
  • Hi Brendon,

    You can also use the "Set Material Parameter" option in Tween Value script to tween the uv offset property directly. Here's an example setup for it:

    You can use something like this, just make sure to disable "Play automatically" and trigger it from your script (or behavior script) when you want to scroll the uvs.

    Let me know if you need more help!

    Jacob

    Comment actions Permalink
  • Thanks Jonathan and Jacob, but I need a bit more guidance. I tried putting Jonathan's data in there. The problem is I don't know how to move percentMoved. When I set percentMoved = .6 during the KissStartEvent it does not seem to do anything. 

    -------

    Then I tried Jacob's method. This looks a bit more promising as I now can see the fluid animating on a ping pong loop when I have Play Automatically checked. When I turn that off, how would I trigger that to go up (from .2 to .6) on KissStartedEvent and then back down (from .6 to .2) on KissFinishedEvent?

    You'll need to open this image in a new tab to view it most likely.

     

    Comment actions Permalink
  • Hi Brendan,

    You can use a script like this to kick off the tween. Notice that the call to play tween has the callback (last parameter) to call itself again to start it over.

    Cheers!

    Jonathan

    // @input SceneObject objectWithTween
    // @input string tweenName

    function playTween() {
    // play tween again after it finishes playing
    global.tweenManager.startTween( script.objectWithTween, script.tweenName, playTween )
    }

    // on tap event, start playing tween
    script.createEvent("TapEvent").bind(playTween)
    Comment actions Permalink
  • I finally got it to work. I watched this tutorial a few times.

    https://www.youtube.com/watch?v=RtpKP4yhTKQ&ab_channel=BenKnutson

    What most likely hung me up was simply calling/naming the objects correctly and I abandoned my initial scripting setup in the original post.

    To help others reading this, I created two scripts on my straw object, a tween to make the texture on it move one way, and another to move it back. I named them pingpong_start and pingpong_end. Then I set the values (0, .2 and 0, .6). I may have made the error earlier in not capitalized the O in uv2Offset.

    I'm not sure why, but when I tried to create a second TweenValue script in this object it wouldn't let me. It created a bunch of blank lines at the bottom. Instead, I copied the TweenValue script in the gear icon in the upper right, and then pasted and it created a second TweenValue script.

    Then I created a new scene object with two Behavior scripts, one to start the animation up, the other to trigger it back down. Again, I copied and pasted the Behavior script. I'm guessing there is an easier way to do this, but it worked.

    Hopefully this can help someone else with their lens. 

    Comment actions Permalink
  • Amazing, thanks for the follow up Brendan!

    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!