Comments (4)
Potentially. I'll keep you in touch :)
from viewanimator.
@Narayane I was thinking about that feature some time ago. We currently support springs but supporting timing functions shouldn't be much work. Do you want to take a shot at it? I can help out with the PR.
from viewanimator.
Hi @marcosgriselli,
I've tried to follow this approach but it doesn't work with your extension UIView.animate()
...
Even when I add parameter options: [.curveEaseInOut]
to your extension UIView.animate()
, it doesn't seem to be taken into account at runtime: move is the save with and without it...
let fromAnimation = AnimationType.from(direction: .bottom, offset: 270)
UIView.animate(views: [self.myView], animations: [fromAnimation], delay: 0, duration: 1, options: [.curveEaseInOut])
Do you have any idea on how to make it?
Thanks.
from viewanimator.
@Narayane the reason why the options don't work on that particular function is that the library is using the UIView springs animation API. We need to create a new function that uses the UIView
animation API that doesn't use springs.
Here's what the function will look like:
static func animate(views: [UIView],
animations: [Animation],
reversed: Bool = false,
initialAlpha: CGFloat = 0.0,
finalAlpha: CGFloat = 1.0,
delay: Double = 0,
animationInterval: TimeInterval = 0.05,
duration: TimeInterval = ViewAnimatorConfig.duration,
options: UIView.AnimationOptions = [],
completion: (() -> Void)? = nil) {
guard views.count > 0 else {
completion?()
return
}
views.forEach { $0.alpha = initialAlpha }
let dispatchGroup = DispatchGroup()
for _ in 1...views.count { dispatchGroup.enter() }
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
for (index, view) in views.enumerated() {
view.alpha = initialAlpha
view.animate(animations: animations,
reversed: reversed,
initialAlpha: initialAlpha,
finalAlpha: finalAlpha,
delay: Double(index) * animationInterval,
duration: duration,
options: options,
completion: { dispatchGroup.leave() })
}
}
dispatchGroup.notify(queue: .main) {
completion?()
}
}
I'll create a release later this week with support for this but for the moment that function should be enough to drop-in and use in your project.
from viewanimator.
Related Issues (20)
- Not working using Xib on tableview HOT 1
- UIView unexpectedly changes position after animation HOT 1
- When/Where to use it? HOT 1
- Add Custom Animation HOT 2
- Add Swift Package Manager support HOT 4
- SwiftUI support HOT 1
- sprintWithDamping/initialSpringVelocity not working? HOT 2
- Help :) HOT 1
- Swift 5+ support
- Animations not visible on UICollectionView HOT 8
- Animations don't work when presenting a ViewController HOT 8
- Animation repeat interval HOT 1
- ViewAnimator Pod is not installing HOT 3
- SwiftUI support with version 3.01.? HOT 1
- AnimationType.vector animates in an incorrect direction HOT 3
- Items in StackView Hide /show animation HOT 1
- Type 'AnimationType' has no member 'from' HOT 7
- App Store Submission Error HOT 2
- SwiftUI support maybe? HOT 1
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 viewanimator.