Comments (4)
can you please paste in a chunk of code of how you add the animations and how you remove them so I can try to reproduce the problem?
from easyanimation.
Sorry, not the same as I expected before. It something like that below. I will change the title. While I am touching too fast, the completion block will not work.
func transformToTouching() { //Response to touching event
self.setHighlighted(true, animated: true)
self.animationQueue.removeAll(keepCapacity: true)
EAAnimationDelayed.animations.map {
$0.cancelAnimationChain()
}
self.spriteLayer.removeAllAnimations()
self.chainAnimation({ () -> Void in
self.spriteLayer.fillColor = ...
self.spriteLayer.path = ...
}, duration: 0.3)
}
typealias AnimationBlock = () -> Void
typealias AnimationPiece = (animation:AnimationBlock, duration: NSTimeInterval)
var animating:Bool = false
var animationQueue = [AnimationPiece]()
func chainAnimation(animation: AnimationBlock, duration: NSTimeInterval) {
self.animationQueue.append((animation:animation, duration: duration))
self.feedAnimation()
}
func feedAnimation() {
if self.animating {
return
}
if let some = self.animationQueue.first {
self.animationQueue.removeAtIndex(0)
self.animating = true
UIView.animateWithDuration(some.duration, delay: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: some.animation, completion: { (done: Bool) -> Void in // Not work while too fast
self.animating = false
self.feedAnimation()
})
} else {
return
} //
}
from easyanimation.
what I see at first sight is that you never actually use the EasyAnimation API to create chains - animateAndChainWithDuration(...). You can cancel only custom EA chains, since the "normal" animations you create with the UIKit API aren't cancelable (but not a bad idea to think if it's possible to do that). Review again the example in the README: https://github.com/icanzilb/EasyAnimation#cancel-chain-animations
from easyanimation.
I really want to use your chain, but it doesn't work out while I chain them from different place. #9
Oops, as the block, we can comment it, it doesn't matter for the phenomenon. 😂
EAAnimationDelayed.animations.map {
$0.cancelAnimationChain()
}
from easyanimation.
Related Issues (20)
- Seems to crash in Xcode7.3 / iOS 9.3 HOT 2
- Animating properties of more than one elements HOT 2
- Animations going in reverse HOT 1
- Error after update to Xcode 7.3 HOT 3
- Swift 3 HOT 1
- How to use with Carthage? HOT 10
- v1.1 hasn't been added as a pod yet HOT 1
- EAAnimationDelayed.swift file missing in xcode HOT 2
- Question about "pending:" print statements HOT 5
- Spring Animation HOT 3
- Disable aggressive debug logging HOT 1
- Warnings: Method 'initialize()' defines Objective-C class method 'initialize', which is not guaranteed to be invoked by Swift and will be disallowed in future versions HOT 6
- String interpolation produces debug description HOT 2
- Co-maintainer needed
- 2.0.0 concerns HOT 7
- Animations in chain seam to get cached. Adding other animations to a view that is finished animating restars the whole chain. HOT 1
- Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1 HOT 2
- EasyAnimation 2.2.1 issue HOT 3
- Objective c enable
- Use of unresolved identifier 'EAAnimationFuture'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easyanimation.