Facebook POP animations easily take up 5-6 lines of code. MJPOPAnim does it in one line.
MJPOPSpring(view: myNSView, propertyName: kPOPLayerPositionY, toValue: 0)
MJPOPSpring(view: myNSView,
propertyName: kPOPLayerPositionY,
toValue: 0,
repeatForever: false,
repeatCount: 6,
springBounciness: 31,
springSpeed: 0.6,
dynamicsTension: 32,
dynamicsFriction: 6,
dynamicsMass: 43,
animationName: "jumptobottom")
If you want to set properties that are not in the initializer, like completionBlock
, you can set runNow
as false
var anim = MJPOPSpring(view: myNSView, propertyName: kPOPLayerPositionY, toValue: 0, runNow:false)
anim.completionBlock = {...}
myNSView.layer?.pop_add...etc
Copy the swift file into your project