背景
实现类似于支付宝余额宝金额的数字自增动画,查找了一些轮子,稍微看了两个,一个swift实现,但是是swift1.x,有一些错误,本身对swift不熟,放弃。另一个倒是没有错,但是是label的分类,引入后跟系统已有的label分类有冲突,放弃。不用库了,自己实现。恰好阅读到缓冲函数的三次贝塞尔曲线,和自定义函数曲线。发现用一个数学函数就可以模拟曲线运动。
效果
代码
1 | #import "ViewController.h" |
实现类似于支付宝余额宝金额的数字自增动画,查找了一些轮子,稍微看了两个,一个swift实现,但是是swift1.x,有一些错误,本身对swift不熟,放弃。另一个倒是没有错,但是是label的分类,引入后跟系统已有的label分类有冲突,放弃。不用库了,自己实现。恰好阅读到缓冲函数的三次贝塞尔曲线,和自定义函数曲线。发现用一个数学函数就可以模拟曲线运动。
1 | #import "ViewController.h" |