pop动画

1,数字文本 :数字跳动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

func ani() {

amountLab.text = "0"
let prop = POPAnimatableProperty.property(withName: "countup") { (ani) in

ani?.writeBlock = { obj,values in


guard let lab = obj as? UILabel else { return }
guard let a = values?[0] else { return }

lab.text = String(format: "%d", Int(a))
}
} as? POPAnimatableProperty


let aniBase = POPBasicAnimation.easeOut()
aniBase?.property = prop
aniBase?.fromValue = 0
aniBase?.toValue = 80
aniBase?.duration = 1
aniBase?.beginTime = CACurrentMediaTime() + 0.5

amountLab.pop_add(aniBase, forKey: "countup")
}