hyperPad hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    Adjust a value over time: HOW?

    Scheduled Pinned Locked Moved
    Help and Support
    3
    20
    599
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Deeeds @Aidan_Fire
      last edited by

      @Aidan-Oxley argh. Got it... however.. what I'm trying to find is the process to change a value, over time, for a specific duration, with any given curve function. This is normally done with keyframes in animation editors, and Actions within cocos2D, SpriteKit and a couple of other engines, and with coroutines in just about all other coding/engine environments.

      Aidan_FireA 1 Reply Last reply Reply Quote 0
      • Aidan_FireA
        Aidan_Fire @Deeeds
        last edited by

        @Deeeds Mine is linear, super easy, a curve function would be much more complex, since you have to do it manually in this case, and you’d end up doing probably whatever Jack did before, depending on how complex your curve function is.

        D 1 Reply Last reply Reply Quote 0
        • D
          Deeeds @Aidan_Fire
          last edited by

          @Aidan-Oxley I get what yours is doing. And am very impressed. It's incredibly elegant, and has some great advantages: e.g.... in terms of it being dynamic based on the higher value's ... value.

          THANK YOU!

          However, I'm trying to understand how to set a timer to operate on a value for a specific amount of time.

          Aidan_FireA 1 Reply Last reply Reply Quote 0
          • Aidan_FireA
            Aidan_Fire @Deeeds
            last edited by

            @Deeeds Then simply at the same time the timer is activated, also activate a “Wait” behaviour with the duration you want your timer to run for, at the end of the “Wait” add a “Behaviour Off” with the t8mer selected.

            D 2 Replies Last reply Reply Quote 0
            • D
              Deeeds @Aidan_Fire
              last edited by

              @Aidan-Oxley That won't work because it doesn't graduate the change of the value over the specified time, it only limits the operation of the loop influencing the value via the timer's frequency effect.

              Aidan_FireA 1 Reply Last reply Reply Quote 0
              • D
                Deeeds @Aidan_Fire
                last edited by

                @Aidan-Oxley I think I'm starting to understand what Jack did. He manually specified the divisor for the units of time, and then calculated how far through the desired duration the changes had been, and uses an "IF" conditional to break out of the loop once the duration limit has been reached. But I'm not quite sure how he's distributed the change of value to the specified duration.

                1 Reply Last reply Reply Quote 0
                • Aidan_FireA
                  Aidan_Fire @Deeeds
                  last edited by

                  @Deeeds I would just use what I already have, then do the maths to work out what the value in that “Subtract values” behaviour should be. For example: I want the timer to take 2 seconds. There are 60 frames in a second, 2 seconds makes 120 frames. I want to go down by 3 in 120 frames (to get from 3 to 0). 3 ÷ 120 = 0.025. The value in my subtract values behaviour will be 0.025.

                  D 2 Replies Last reply Reply Quote 0
                  • D
                    Deeeds @Aidan_Fire
                    last edited by

                    @Aidan-Oxley You know maths FAR better than I do. I'm a visual thinker ;)

                    The problem is that the arbitrary high value (3 in this example) is never going to be the same. It's the rate of spin the character has attained, and can be anything from a very small number to a massive value.

                    Is it possible to do this pre-calcuation of the required distribution rate, to perform the transition for a specific duration, for things like an exponential, quadratic or cubic curve? Don't worry about trying to answer with a massive visual code, I'm just curious if it's possible to pre-plan. Just a yes or no will give me the incentive to believe it possible.

                    I'm truly flummoxed by maths.

                    But can lift heavy things.

                    1 Reply Last reply Reply Quote 0
                    • D
                      Deeeds @Aidan_Fire
                      last edited by

                      @Aidan-Oxley I think I've found a dirty cheat way to do this:

                      Create an empty object as a dummy.

                      Set its X position to the incoming rotation speed (3 in this example)

                      Use a Move to Point behaviour for a duration of 2 seconds with an Exponential Out curve, to move it to 0.1 on the X axis.

                      Whilst this "action" is running, use it to set the value of the Air Resistance on the desired object.

                      Aidan_FireA 1 Reply Last reply Reply Quote 0
                      • Aidan_FireA
                        Aidan_Fire @Deeeds
                        last edited by

                        @Deeeds Haha real dirty, also less efficient. Value for subtract values = amount you want to increase or decrease by ÷ (amount of seconds it should take × 60) (the brackets just meaning the times 60 happens before the division). Doing maths in hyperPad rather than your dirty method is usually much more efficient. But your way is heaps easier especially fur curve functions.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post