marcosgriselli / ViewAnimator

ViewAnimator brings your UI to life with just one line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sprintWithDamping/initialSpringVelocity not working?

haemi opened this issue · comments

Expected Behavior

when setting usingSpringWithDamping and initialSpringVelocity it seems as if they have no effect; no spring animation at all... Am I missing something?

Actual Behavior

E.g. the zoom animation is linear, the view grows - but now springin

Steps to Reproduce the Problem

  1. setting usingSpringWithDamping to e.g. 3, 0.3, ...
  2. setting initialSpringVelocity to e.g. 5, 0.5, ...
  3. there is no difference between setting in on configuration or directly with UIView.animate

Specifications

  • Version: 13
  • Platform: iOS

Hi @haemi, thanks for reporting this. I'll take a look at it in the upcoming days.

@haemi, the springs are working as expected.

I'm using these values to create the animation below:

UIView.animate(
    views: self.collectionView!.orderedVisibleCells,
    animations: animations,
    duration: 1.3,
    usingSpringWithDamping: 0.45,
    initialSpringVelocity: 10
)

Screen Recording 2019-10-12 at 16 35 20

Perhaps your animation uses the default duration and it's to fast to appreciate the spring?
Also, keep in mind that usingSpringWithDamping goes from 0 to 1.