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

    Powers

    Scheduled Pinned Locked Moved
    Help and Support
    4
    29
    1.3k
    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.
    • iTap DevelopmentI
      iTap Development
      last edited by

      @Murtaza or @Hamed or anyone, What would be the best way to have a number raised to a power? Since there’s no power behavior.

      D Aidan_FireA 2 Replies Last reply Reply Quote 0
      • D
        Deeeds @iTap Development
        last edited by

        @iTap-Development

        Loop (to the power of) in Repeat mode
        Value (with number to be expon-ified)
        Multiply (Value x Value)
        Set Value to Result

        ???

        iTap DevelopmentI 1 Reply Last reply Reply Quote 0
        • iTap DevelopmentI
          iTap Development @Deeeds
          last edited by

          @Deeeds yeah that’s all I could think of. I’m hoping not to use a loop.

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

            @iTap-Development You want to abstract it further?

            iTap DevelopmentI 1 Reply Last reply Reply Quote 0
            • iTap DevelopmentI
              iTap Development @Deeeds
              last edited by

              @Deeeds 🤨😴

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

                @iTap-Development Sorry, not an expert in emojis. I was born before C.

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

                  @iTap-Development are you worried about loops pausing the game while they do HUGE exponentials?

                  If so, use messaging. Send a broadcast of the value and the power to a receiver. Let it do one iteration, then return the result along with an increment to the times it's been times'd.

                  Or similar abuse of messaging/broadcasting until you get the desired result.

                  iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                  • iTap DevelopmentI
                    iTap Development @Deeeds
                    last edited by

                    @Deeeds yes it’s that I don’t want pause. I’m using it for the scrolling. I’m planning on making my own loop of sorts.

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

                      @iTap-Development Are you using the exponentials to slow the scrolling?

                      iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                      • iTap DevelopmentI
                        iTap Development @Deeeds
                        last edited by iTap Development

                        @Deeeds that’s what I was planning on. I have no idea if that’s how it works though, except for how it looks on my iPad.

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

                          @iTap-Development You've come to the right monkey. Well, actually, I'm a gorilla... but enough about me.

                          There's a multitude of cheat ways to do this that require very little work on your part. Here's one that's easy to articulate and understand, and hyperPad has the right tools to use:

                          This doesn't require using powers and squares and all that guff, because someone else is doing it for you.

                          Make a dummy object, and set it wherever you like, offscreen, probably best. Give it a mass you like, passable so it can't hit anything, and give it a gravity you like and an air resistance of your choosing. You'll have to experiment with these settings to get the right feel you want.

                          Whenever your user releases a fast scroll, grab the velocity of the scroll (I'm sure you''re already doing this) and apply it to the dummy object, going up (against) towards gravity.

                          And monitor its speed. Grab it every frame, and set your scrolling object to this same speed. When it reaches its peak, there's two actions you can use to deal with this.

                          Stopped Moving might fire, but Started Falling definitely will. Use a little of that fall to roll back at the end of the scroll just a tiny bit. This looks very cool.

                          iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                          • iTap DevelopmentI
                            iTap Development @Deeeds
                            last edited by

                            @Deeeds that probably work, I just don’t like using dummy objects/physics to do this stuff. It’s cheating!

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

                              @iTap-Development This is exactly what Apple does. UIKitDynamics is invisibly attached physics objects for all their scrolling and visual responses, and even sorting collection views and a bunch of other cool stuff.

                              Little known secret: A lot of people think UIKitDynamics is based off Box2D. It's not, it's Bullet Physics without the 3rd dimension, and customised for their purposes. Or so I'm lead to believe. Similarly, SpriteKit physics is Bullet Physics with an API made to be familiar to users of Box2D.

                              In SceneKit, it's back to full 3D Bullet Physics.

                              iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                              • iTap DevelopmentI
                                iTap Development @Deeeds
                                last edited by

                                @Murtaza is this how UI elements(specifically scrolling) will work when you add them?
                                @Deeeds I'm not saying you are wrong, it just seems weird and kinda tacky way to do it🤷‍♂️

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

                                  @iTap-Development Me? Wrong?

                                  Com'on now. Who do you think you're talking with?

                                  Don't believe me. There's no need:

                                  Watch the video: https://developer.apple.com/videos/play/wwdc2015/229/

                                  And read for yourself:

                                  https://developer.apple.com/documentation/uikit/animation_and_haptics/uikit_dynamics

                                  iTap DevelopmentI 2 Replies Last reply Reply Quote 0
                                  • Aidan_FireA
                                    Aidan_Fire @iTap Development
                                    last edited by

                                    @iTap-Development If your power is always staying the same, just multiply the two values together, then again and again until you reach your power. But if your power is changing during the project being run, yeah you’d use a loop or something. You know what else I’d like? More options than just square root. What about cubed root etc?

                                    iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                                    • iTap DevelopmentI
                                      iTap Development @Aidan_Fire
                                      last edited by

                                      @Aidan-Oxley yeah the power is changing.
                                      Yes! Other roots would be great!

                                      1 Reply Last reply Reply Quote 0
                                      • iTap DevelopmentI
                                        iTap Development @Deeeds
                                        last edited by iTap Development

                                        @Deeeds so if I scroll through my iMessages, thats a physics object doing the animation?

                                        1 Reply Last reply Reply Quote 0
                                        • iTap DevelopmentI
                                          iTap Development @Deeeds
                                          last edited by

                                          @Deeeds I checked out the links, pretty cool! I might make two versions of the scroll now!

                                          Jack8680J 1 Reply Last reply Reply Quote 1
                                          • Jack8680J
                                            Jack8680 @iTap Development
                                            last edited by

                                            @iTap-Development (late reply) Math behaviours should be efficient enough that you can do integer powers through loops without freezing as long as you don't have them too large. It'd probably depend on what device is running, but I can calculate the 64th power of numbers through a loop in under a frame on iPad Air 2.

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