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

Couldn't use sequence for morphing animations #141

Closed
pbmayne opened this issue Jul 22, 2017 · 9 comments
Closed

Couldn't use sequence for morphing animations #141

pbmayne opened this issue Jul 22, 2017 · 9 comments
Assignees
Milestone

Comments

@pbmayne
Copy link

pbmayne commented Jul 22, 2017

Hey All,

I am trying to use Macaw and it is awesome but I am thinking that I am missing something in the documentation and wonder if I could get some help?

I am training to chain around 8 animations together then repeat them all from 1-8 continuously.

  let animationOne = trianglegroup.contentsVar.animation(from: squaregroup, to: square, during: 1.0, delay: 0.0)
           animationOne.onComplete {
               print("animationOne complete")
               let animationTwo = crossgroup.contentsVar.animation(from: squaregroup, to: triangle, during: 1.0, delay: 0.0)
               animationTwo.onComplete {
                   print("animationTwo complete")
                   let animationThree = circlegroup.contentsVar.animation(from: squaregroup, to: circleClosedState, during: 1.0, delay: 0.0)
                   animationThree.onComplete {
                       print("animationThree complete")
                       let animationFour = circlegroup.contentsVar.animation(from: squaregroup, to: circle, during: 1.0, delay: 0.0)
                       animationFour.onComplete {
                           print("animationFour complete")
                           let animationFive = squaregroup.contentsVar.animation(from: squaregroup, to: crossClosedState, during: 1.0, delay: 0.0)
                           animationFive.onComplete {
                               print("animationFive complete")
                               let animationSix = squaregroup.contentsVar.animation(from: squaregroup, to: cross, during: 1.0, delay: 0.0)
                               animationSix.onComplete {
                                   print("animationSix complete")
                                   let animationSeven = squaregroup.contentsVar.animation(from: squaregroup, to: squareClosedState, during: 1.0, delay: 0.0)
                                   animationSeven.onComplete {
                                       print("animationSeven complete")
                                       let animationOne = trianglegroup.contentsVar.animation(from: squaregroup, to: square, during: 1.0, delay: 0.0)
                                       animationOne.onComplete {
                                           print("animationOne complete")
                                       }
                                   }
                                   animationSeven.play()
                               }
                               animationSix.play()
                           }
                           animationFive.play()
                       }
                       animationFour.play()
                   }
                   animationThree.play()
               }
               animationTwo.play()
           }
           animationOne.play()

The problem with this is obvious plus It isn't continuous as I have to include another set of animations to repeat an extra time so I am wondering if there is a better way to do it?

Thanks in advance for any help!

@vhailor13
Copy link
Contributor

vhailor13 commented Jul 23, 2017

Hello @pbmayne, you can use .sequence extension method like this:
https://gist.github.com/vhailor13/5603c260ec4de7bb424ab4da839398a1

@pbmayne
Copy link
Author

pbmayne commented Jul 23, 2017

Hey @vhailor13 thank you so much for your reply.

I just attempted this but the animation stops after animationOne.

        let animationOne = squaregroup.contentsVar.animation(from: squaregroup, to: square, during: 1.0, delay: 0.0)
let animationTwo = squaregroup.contentsVar.animation(from: squaregroup, to: triangle, during: 1.0, delay: 0.0)
        let animationThree = squaregroup.contentsVar.animation(from: squaregroup, to: circleClosedState, during: 1.0, delay: 0.0)
        let animationFour = squaregroup.contentsVar.animation(from: squaregroup, to: circle, during: 1.0, delay: 0.0)
        let animationFive = squaregroup.contentsVar.animation(from: squaregroup, to: crossClosedState, during: 1.0, delay: 0.0)
        let animationSix = squaregroup.contentsVar.animation(from: squaregroup, to: cross, during: 1.0, delay: 0.0)
        let animationSeven = squaregroup.contentsVar.animation(from: squaregroup, to: squareClosedState, during: 1.0, delay: 0.0)

        [animationOne, animationTwo, animationThree, animationFour, animationFive, animationSix, animationSeven].sequence().cycle().play()

Am I doing something wrong?

@pbmayne
Copy link
Author

pbmayne commented Jul 24, 2017

Hey @vhailor13 any ideas on this please? Thanks for your help.

@vhailor13
Copy link
Contributor

Just reproduced this behaviour for morphing animation, will fix it asap

@pbmayne
Copy link
Author

pbmayne commented Jul 26, 2017

Thanks @vhailor13. Any ETA or is it just when you get around to it?

@vhailor13
Copy link
Contributor

The problem seems will take some time. 1-3 days as I see it.

@vhailor13
Copy link
Contributor

We decided to refactor core animation functionality in order to properly solve this problem and avoid similar problems in the future. So it will take more time.

@vhailor13
Copy link
Contributor

Sorry for silence period, finally were able to perform the fix. You can try it using master branch:
pod 'Macaw', :git => 'https://github.com/exyte/Macaw.git'

@pbmayne
Copy link
Author

pbmayne commented Aug 14, 2017

Brilliant, thanks @vhailor13. I will test shortly.

@ystrot ystrot changed the title Easier way to chain together animations? Couldn't use sequence for morphing animations Sep 19, 2017
@ystrot ystrot added this to the 0.8.3 milestone Sep 19, 2017
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

3 participants