Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Gary Griswold

Picker / Spinner using ThrowProps

Recommended Posts

I would like to replace Flex Spinner (sometimes called Picker or UIPicker) with something written in AS3 without Flex.  

 

ThrowProps and Blitmask should be a great help.  Are there any examples of doing using Greensock?

 

 

post-20256-0-47149600-1406673223_thumb.png

post-20256-0-15615800-1406673234_thumb.png

Link to comment
Share on other sites

Hmm, sorry, can't think of anything exactly like that.

By setting a BlitMasks' wrap property to true (see docs), you can easily achieve seamless and infinite looping which should hopefully make it fairly straight-forward.

Link to comment
Share on other sites

It is mostly done now, but the part that is new to me is that the scrolling needs to snap to the nearest item when the velocity is below some threshold. There is a panel snap scrolling example on the http://greensock.com/throwprops web page that is very helpful.  It is only differs from this problem in axis and that the bounds of the scrolling viewport are the same as the bounds of the item being scrolled.

Link to comment
Share on other sites

For snapping, see the end property in the docs. It explains how you can use a function to snap to a specified increment. So if each item in your spinner was 100px tall you can make sure it always ends on 100px increments. 

 

It sounds like you want to interrupt your tween when a certain threshold is reached. For that you will need to monitor the velocity of the item that is spinning and then perhaps create a new ThrowProps tween. Check out the track() and getVelocity() methods, they should help with that. 

Link to comment
Share on other sites

Thanks very much Carl.  This is very helpful.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×