Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Chirone

macrumors 6502
Original poster
Mar 2, 2009
279
0
NZ
Hi, I have a view that I want to spin on the z axis and if you swipe your finger fast enough it should continue to spin and slow down, much like the scroll views do.

I'm having a lot of trouble trying to figure it out. I've seen some people do it before but the result they get isn't really all that good. Like, the view spins like it should only if you swipe in a particular direction.

All I've successfully been able to do is have the view rotate for a set time and set angle. I don't know how to calculate the time and angle based on the speed of the finger.
 

Chirone

macrumors 6502
Original poster
Mar 2, 2009
279
0
NZ
That will make it slow down as it stops yes, but it's not the solution I'm looking for.
It relies on me already knowing the start and end angles and the duration. The last two of which I don't know as mentioned in the last sentence of my first post
 

MattInOz

macrumors 68030
Jan 19, 2006
2,760
0
Sydney
Wwdc session advanced scroll view showed how to use a scrollview to act as the the gesture recognized. Using its delegate methods and the like to provide the sort info you want then apply that data to an OpenGL scene at frame rate.

Might be worth a look.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
That will make it slow down as it stops yes, but it's not the solution I'm looking for.
It relies on me already knowing the start and end angles and the duration. The last two of which I don't know as mentioned in the last sentence of my first post

Shouldn't you be able to calculate (and so know very quickly afterwards) those two variables as soon as the user picks up their finger?
 

Chirone

macrumors 6502
Original poster
Mar 2, 2009
279
0
NZ
Wwdc session advanced scroll view showed how to use a scrollview to act as the the gesture recognized. Using its delegate methods and the like to provide the sort info you want then apply that data to an OpenGL scene at frame rate.

Might be worth a look.
Which year was that?

Shouldn't you be able to calculate (and so know very quickly afterwards) those two variables as soon as the user picks up their finger?
Sure can! But I don't know how to calculate it...
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
Which year was that?


Sure can! But I don't know how to calculate it...

Well, you have the current speed and (I assume) a constant deceleration, so calculating the time it should come to a stop isn't hard. The position it'll be at that time can be found by taking the initial speed, dividing by 2, and multiplying by that end time.
 

Chirone

macrumors 6502
Original poster
Mar 2, 2009
279
0
NZ
2012. Session 223 enhancing user experience with scroll views

Cool. Will have a look.

Also, I found this website:
http://gizma.com/easing/

it looks like the formulas should work. But it appears only the ease in and linear ones work. The ease out and ease in and out ones don't.
Since ease in/out never looks different to linear to me I have to plot the values calculated on a graph and the values calculated for ease out are linear.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.