natmark / simple-tween

Simple tween library for swift
MIT License
0 stars 0 forks source link

API design #2

Open natmark opened 6 years ago

natmark commented 6 years ago
Tween.animateTo(obj: Number, startValue: Double, endValue: Double, duration: Double, options: .curveLinear, animations: {

}, completion nil)
let increase = (endValue - startValue) / duration
var value = start

UIView.animate(withDuration: duration, delay: 0, options: .curveLinear, animations: {
    self.value += increase
}, completion: {
  completion()
})
natmark commented 6 years ago

UIView.animate({
self.value = end
})
self.value.subscribe?```
natmark commented 6 years ago

https://github.com/u10int/Kinetic

natmark commented 6 years ago
let tween = Tween.animate(value).to(1000).duration(10)
tween.ease(Easing.outExpo).onUpdate { (animation) -> Void in
   print(value)
}.onComplete({ (animation) -> Void in
   print(value)
})
natmark commented 6 years ago
Animation
Easing
Tween
Kinetic