animation - Swift synchronize CABasicAnimation with label.text -
i have circular progress bar, animated via:
func animatecircle(from: double, to: double ) { let animation = cabasicanimation(keypath: "strokeend") animation.duration = 2 animation.fromvalue = animation.tovalue = to/60 animation.timingfunction = camediatimingfunction(name: kcamediatimingfunctionlinear) self.progresscircle.strokeend = cgfloat(to/60) self.progresscircle.addanimation(animation, forkey: "animatecircle") }
the stroke-animation works , visualizes "minutes 0-60". in center of animated circle label, should animated (counting, duration 2 seconds) too. there way add "change-event" cabasicanimation or cashapelayer synchronize label shape itself. ideas?
you don't need synchronize them. if start 2-second animation of label @ same time start circle animation, happen together. in demonstration, run repeating timer make label count:
Comments
Post a Comment