Skip to content

eonist/TimeAnimator

Repository files navigation

TimeAnimator

Animation framework

mit platform Lang codebeat badge SMP compatible

What is it

A simple animation framework

img

How does it work

  • TimeAnimator uses the swift Timer class for animation
  • The animations wont be as smooth as using CAAnimation
  • But TimeAnimator will give you more freedom than apple animation
  • TimeAnimator will use CAAnimation soon. Stay tuned

Installation:

Example:

Quick one-liner:

TimeAnimator(duration: 0.3, onChange: {/*animate stuff*/},onComplete:{/*anim completed*/}).start()

Interpolating between 0 and 1:

let to = self.curX + 1
let animator = TimeAnimator(duration: 0.3)
animator.tick = {
	Swift.print("animator.curCount:  \(animator.curCount)")
	Swift.print("animator.progress:  \(animator.progress)")
	self.curX = TimeAnimator.interpolate(from: from, to: to, fraction: animator.progress)
	self.frame.origin.x = self.curX
}
animator.start()

Looping:

animator.onComplete = {
   self.animator.reset()
   self.animator.start()
}

Todo:

About

A simple animation framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages