icanzilb / EasyAnimation

A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!
MIT License
2.96k stars 201 forks source link

Spring Animation #46

Open sisomollov opened 7 years ago

sisomollov commented 7 years ago

I think there is some small bug with the spring animation. The completion block it's never been called.

        var newFrame = view.frame
        newFrame.size.height = 50

        UIView.animate(
            withDuration: 1.25,
            delay: 0,
            usingSpringWithDamping: 0.65,
            initialSpringVelocity: 0.75,
            options: [],
            animations: {
                self.testLayer.frame = newFrame
        }) { _ in
            print("Tralala!")
        }
icanzilb commented 7 years ago

thanks for reporting, could you please try with another property like alpha to check if it's a property name related problem?

sisomollov commented 7 years ago

yep with this code

        var newFrame = view.frame
        newFrame.size.height = 50

        UIView.animate(
            withDuration: 1.25,
            delay: 0,
            usingSpringWithDamping: 0.65,
            initialSpringVelocity: 0.75,
            options: [],
            animations: {
                self.testLayer.frame = newFrame
                self.view.alpha = 0.25
        }) { _ in
            print("Tralala!")
        }

works and completion block is called.

icanzilb commented 7 years ago

interesting - it must have to do with frame being a composed property (position and bounds), I will look into debugging this and thanks for reporting