Powers
-
-
@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-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?
-
@Aidan-Oxley yeah the power is changing.
Yes! Other roots would be great! -
@Deeeds so if I scroll through my iMessages, thats a physics object doing the animation?
-
@Deeeds I checked out the links, pretty cool! I might make two versions of the scroll now!
-
@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.
-
@Jack8680 I have iPad Pro second gen.
Shouldn’t be a problem at all then. Thanks! -
Any suggestions for the best way to get the velocity of scrolling?
-
@iTap-Development What do you mean? You could use a Get Velocity behaviour?
-
@Aidan-Oxley I don’t think get velocity will work on objects being moved by move behaviors though, right?
-
@iTap-Development Oh, using Move behaviours. No it probably won’t. What you’d need to do then is divide the distance being moved by the time it’s being moved by. If your time is zero, then multiply by 60 instead of divide by time (dividing by zero is bad 😛).
-
@Aidan-Oxley ok I’ll try that. Yeah I won’t divide by zero!
-
@Aidan-Oxley is get time behavior the best way to get the time? Is it fast?
-
@iTap-Development That’s not what I meant. I meant the time you have set in the Move behaviour (e.g move 0x and 7y over 4 seconds). The velocity for that example would be 7 ÷ 4 = 1.75m/s in y direction. You could do the same for x, and come up with an x velocity and a y velocity (depending on how your object is moving.
-
@Aidan-Oxley oh I see! Thank you!