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

TWEENING driving me craaazy !!!!

  • A few things I notice here, first you need some sort of check if the tween has already been called or you're gonna be constantly calling or stopping it which won't let it play right and possibly slow performance.

    Second, a distance of 40 for screen transforms is pretty testing I couldn't spread them out even close to that far. Maybe you're using them differently but I still updated the value in the example code to 4.0055 instead.

    Here's an example script I made with these changes, this should run on initialized:


    // @input Component.ScreenTransform screenTransform
    // @input Component.ScreenTransform screenTransform2
    // @input SceneObject objectWithTweens

    // Boolean that tells us if the tween has been started
    var tweenRunning = false

    //Update event is running every frame
    var event = script.createEvent('UpdateEvent')
    event.bind(function(eventData) {

      // Get distance
      var pointA = script.screenTransform.getTransform().getWorldPosition()
      var pointB = script.screenTransform2.getTransform().getWorldPosition()
      var distance = pointA.distance(pointB)

      //Check if distance is less than <value>>
      if (distance <= 4.0055) {

        // Check if the tween is already started on this collision so it won't constantly restart
        if (!tweenRunning) {
          global.tweenManager.startTween(script.objectWithTweens, 'a1')
          tweenRunning = true
      } else {

        // Check if the tween has already been stopped so we aren't needlessly calling stop
        if (tweenRunning) {
          global.tweenManager.stopTween(script.objectWithTweens, 'a1')
          tweenRunning = false
    Comment actions Permalink
  • Hi, just me!

    Can I wonder what kind of Tween are you using? 

    I would suggest that for the screen transforms you are using TweenScreenTransform script and anchor type of tween. 

    I added output for the distance to see if it reaches desired value and a flag to check if tween is playing or not, so tween is not trying to start every frame. 

    Here is my code: (set this script to LensTurnedOn or Initialized event) 


    // -----JS CODE-----

    // @input Component.ScreenTransform screenTransform

    // @input Component.ScreenTransform screenTransform2

    // @input SceneObject objectWithTweens

    // @input float desiredDistance

    var isPlaying = false;

    script.createEvent("UpdateEvent").bind(function (eventData) {

        var pointA = script.screenTransform.getTransform().getWorldPosition();

        var pointB = script.screenTransform2.getTransform().getWorldPosition();

        var distance = pointA.distance(pointB);

        print(distance);// see if you reach desired distance

        if (distance <= script.desiredDistance) {

            if (!isPlaying) {

                global.tweenManager.startTween(script.objectWithTweens, "a1");

                isPlaying = true;

                print("staring tween");


        } else {

            if (isPlaying) {

                global.tweenManager.stopTween(script.objectWithTweens, "a1");

                print("stopping tween");

                isPlaying = false;




    And here is a tween i use


    Lets me know if there any questions!



    Comment actions Permalink
  • Whoops! Looks like I posted an answer at the same time with Brandon

    Sorry for the duplication!

    Comment actions Permalink
  • Thank you Olha - Brandon / Apoc for the responding

    as you see im trying to make a slider where user can move and chose 4 different choices

    i did every thing but the problem the tween not working with the type ( position to ) but working with type ( Offset )

    the offset type not giving me the right position every time  changed

    the second problem when i activated the second tween its just stucking not even in the position 

    this is a preview video for the slider

    and this is the project im working on

    Thank you so much


    Comment actions Permalink
  • Hi, just me! here is one of your posts which I answered some time ago. Could you please take a look? 



    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?



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:



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!