Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CADisplayLink? #3

Open
eonist opened this issue Oct 25, 2016 · 4 comments
Open

CADisplayLink? #3

eonist opened this issue Oct 25, 2016 · 4 comments

Comments

@eonist
Copy link

eonist commented Oct 25, 2016

Hey,

First of all Awesome concept!

Couple of questions:

  1. Does your Library use CADisplayLink or?
  2. 60fps?
  3. Support for interactions while animation is happening?
  4. Could you talk a little about what drives the animation?

Thanks.

@eonist
Copy link
Author

eonist commented Oct 27, 2016

I first read about the implications of CADisplayLink here: https://blog.bigspaceship.com/the-holy-grail-of-ios-animation-intervals-e9e663ea93c4 Pretty good article. I recently implemented the CVDisplayLink which is the macOS equivalent.

@RamonGilabert
Copy link
Owner

Hey @eonist, thanks for the issue.

  1. & 4. The way Walker works is basically by taking the initial point and the final point and drawing the curve that the object should take, calculating all the points with a small step at the time, that way, a CAKeyframeAnimation is configured and will run the animation. The reason for that was for simplicity. I know there are some libraries that build the entire animation without using any sort of default API.
  2. For the question of the 60fps, the answer is I am not sure. The performance of it relies in CAKeyframeAnimation, so it should be 60fps, since the calculation in points shouldn't take that long and, when a curve that is not a spring is used, the calculation is much simpler.
  3. This is the reason why the library is in 0.10.0 and not in 1.0.0. I wanted to explore something different and not rely on CAKeyframeAnimation completely. Maybe build my own animation that moves ever x ms sending a notification or a delegate method – not sure. I haven't done much on it in a while, but I might definitely come back to it, this issue is mainly a motivation for it now – so thanks.

I'll read more about CADisplayLink, do you have a link to your macOS project? 😊

@eonist
Copy link
Author

eonist commented Oct 31, 2016

Thanks for the reply/answers!

I have a few blog posts about the AnimLib I've built for macOS:

http://stylekit.org/blog/2016/02/24/CVDisplayLink/
http://stylekit.org/blog/2016/02/20/Core-animation/
http://stylekit.org/blog/2016/03/09/Demo-app/

And here is the AnimLib (the important class being Animator.swift)

https://github.com/eonist/swift-utils/tree/master/misc/animation

In the example bellow, a clock pointer rotates 3 times:

let line:LineGraphic = addSubView(LineGraphic())
let animator = LoopingAnimator(Animation.sharedInstance,3,1,0,1,progress,Easing.easeLinear)
func progress(value:CGFloat){
   let angle = π * 2  * value
   line.p2 = line.p1.polarPoint(50,angle)
   line.draw()
}
animator.start()

The reason I asked about your lib was in terms of Interaction + animation which seems to be the tricky part. I want to attempt something similar for iOS, but looking through what other people has made first. Let me know if something is unclear with CADisplayLink. I'd be happy to help.

@eonist
Copy link
Author

eonist commented Mar 22, 2017

Hey, im lending som inspiration from your walker lib. Really liked the chaining you used. https://github.com/eonist/Element-iOS/wiki/anim-lib-ios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants