TeehanLax / UICollectionView-Spring-Demo

A demonstration of UICollectionView and UIKit Dynamics
MIT License
473 stars 71 forks source link

Implement a minimum space between cells (enhancement) #22

Open ruiwh0 opened 8 years ago

ruiwh0 commented 8 years ago

Thank you for sharing this great job!

I wonder if it would be difficult to implement a minimum space between cells. Like the WildCard app does:

gif

Svantulden commented 8 years ago

You can kind of recreate this behavior by playing with the scrollResistanceFactor(or kScrollResistanceFactorDefault if you don't set the UICollectionView by code), the springBehaviour.length, springBehaviour.damping and springBehaviour.frequency.

Ive set resistance to 2000.0f, length to 1.0f, damping to 0.8f and frequency to 1.5f, to get a similar animation.