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

Mixed animations not working? #315

Open
alexeydemidovkz opened this issue Sep 4, 2018 · 2 comments
Open

Mixed animations not working? #315

alexeydemidovkz opened this issue Sep 4, 2018 · 2 comments

Comments

@alexeydemidovkz
Copy link

So I am trying to make chained animation with a view moving in, and then after sometime fading out, however I am getting strange results - view is moving in, and then moving out (as if it was animateTo) and in the same time fading out. Here is the code:

            stringCard.animation = "squeezeLeft"
            stringCard.curve = "easeOut"
            stringCard.force = 1.0
            stringCard.duration = 3.5
            
            stringCard.animateNext(completion: {
                
                stringCard.animation = "fadeOut"
                stringCard.curve = "easeOut"
                stringCard.force = 1.0
                stringCard.delay = 1.0
                stringCard.duration = 1.5
                
                stringCard.animateNext {  // was trying stringCard.animateToNext here with same result 
                    print("finished")
                }
                  
            })

If i am doing only the fade in/fade out everything works good, or if i am doing something like this:

            stringCard.animation = "squeezeLeft"
            stringCard.curve = "easeOut"
            stringCard.force = 1.0
            stringCard.duration = 3.5

            stringCard.animateNext(completion: {
           
                stringCard.animation = "squeezeRight"
                stringCard.curve = "easeOut"
                stringCard.force = 1.0
                stringCard.delay = 1.0
                stringCard.duration = 1.5
                
                stringCard.animateToNext {
                    print("finished")
                }
                  
            })

Everything works great also (move in, then move out). Is it some kind of unexpected behavior here or am I doing something wrong?

@alexeydemidovkz
Copy link
Author

Also if i just manually call this part from another place later (via touch for example):

                stringCard.animation = "fadeOut"
                stringCard.curve = "easeOut"
                stringCard.force = 1.0
                stringCard.delay = 1.0
                stringCard.duration = 1.5
                
                stringCard.animateNext {  // was trying stringCard.animateToNext here with same result 
                    print("finished")
                }

Then everything works as it should.

@alexeydemidovkz
Copy link
Author

Get it working by adding .animate() in the end of the code - so now works exactly as needed (move in, wait, fade out):

            stringCard.animation = "squeezeLeft"
            stringCard.curve = "easeOut"
            stringCard.force = 1.0
            stringCard.duration = 3.5

            stringCard.animateNext(completion: {

                stringCard.animation = "fadeOut"
                stringCard.curve = "easeOut"
                stringCard.force = 1.0
                stringCard.duration = 1.5
                stringCard.delay = 1.0
                stringCard.animate()

            })

            stringCard.animate()

However not sure why it is - will be thankful if anyone can explain, thank you.

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

1 participant