Comments (6)
@cupojoe Do you have an example where you are having this issue? To test, I added onComplete
callbacks to the tweens in the SequenceViewController.swift
example and the completion blocks for each tween were being triggered properly within the timeline:
let moveX = Tween(target: square).to(.x(110)).duration(0.5).ease(Easing.inOutCubic)
moveX.onStart({ (animation) in
print("starting moveX")
}).onComplete { (animation) in
print("moveX done")
}
let moveY = Tween(target: square).to(.y(250), .backgroundColor(.orange)).duration(0.5).ease(Easing.inOutCubic)
moveY.onStart { (animation) -> Void in
print("starting moveY")
}.onComplete { (animation) in
print("moveY done")
}
let resize = Tween(target: square).to(.width(200), .backgroundColor(.blue)).duration(0.5).ease(Easing.inOutCirc)
resize.onStart { (animation) -> Void in
print("starting resize")
}.onComplete { (animation) in
print("resize done")
}
let timeline = Timeline(tweens: [moveX, moveY, resize], align: .sequence)
timeline.yoyo().forever().onStart({ (animation) in
print("TIMELINE start")
}).onRepeat { (animation) in
print("TIMELINE repeat")
}
Which output:
starting moveX
TIMELINE start
moveX done
starting moveY
moveY done
starting resize
resize done
TIMELINE repeat
starting resize
resize done
starting moveY
moveY done
starting moveX
moveX done
TIMELINE repeat
starting moveX
moveX done
starting moveY
moveY done
starting resize
resize done
TIMELINE repeat
...
from kinetic.
I left the office already, but I'll send you a snippet in the morning.
Great job with the library BTW. I don't get why Apples animation api is limited to the properties they choose. It should be able to animate any value or at least be observable, right?
from kinetic.
Thanks, glad you're liking it so far! I've been making a lot of big improvements in the props-refactor
branch, so hopefully I can get that merged over to master soon for 1.0.
And while UIViewPropertyAnimator introduced by Apple in iOS 10 is an improvement, I still don't like that it's not nearly as flexible or useful as what I've tried to do in bring GSAP's TweenMax/TimelineMax to iOS.
from kinetic.
Yeah. I think the GSAP brought a very powerful animation pattern to a very simple to use API. I've loved it since the Flash days.
edited: Anyhow, here is a snippet where the Timeline onComplete gets called and the onUpdate of the tween doesn't:
let backgroundTween = Tween(target: transitionBackground, from: [.alpha(0)], to: [.alpha(1)], mode: TweenMode.to).duration(1).ease(Easing.swiftOut)
let illustrationTween = Tween(target: transitionIllustration).to(.x(illustrationFrame.origin.x)).duration(1).ease(Easing.outBack)
illustrationTween.onUpdate { (tween) in
print("update")
}
animator = Timeline(tweens: [backgroundTween, illustrationTween])
animator.onComplete({ (tween) in
self.replaceBackgroundFor(gradient: GradientBackgroundColor(rawValue: Int(self.goals[self.currentIndex].category))!, in: self.backgroundView)
tween.setProgress(0)
})
Actually, disregard that. The onUpdate and onComplete both get called. What really happens is that when I set the progress of the animation manually (eg. not by playing the animation) the event's are not called. I realize this is a complete different issue. In fact it's probably the expected behavior, so we should close this issue and maybe I'll open a feature request for that, since it would be useful in scenarios like this, where the animation is controlled by user interaction (pan gesture) and completed when the gesture ends.
from kinetic.
Yeah that's probably a good thing to add support for, so I'll add it to my list but may not make it in there until I can wrap up the refactoring branch and merge it in (soon hopefully).
from kinetic.
Makes sense! I'll stay tuned. If I can help in any way... Let me know
from kinetic.
Related Issues (20)
- Bug: .RotateY only works with .to, not .from HOT 2
- Bug: animation doesn't execute if not called from main thread HOT 7
- Please add @discardableResult to key functions in the swift 3 branch HOT 2
- Feature Request: Swift 3 HOT 2
- bezierPath? HOT 4
- Cannot animate SKNode objects. HOT 1
- Memory leak in Tween HOT 2
- User interaction while animating HOT 1
- it stop to work with Swift 4.1 HOT 1
- Interpolator issue HOT 1
- Is there a way to say if element is currently tweening HOT 1
- UIViews inside ScrollView animated HOT 1
- Can we tween a tableview? HOT 2
- How can I install it manually HOT 1
- EasingType - Bounce? How to use this? HOT 3
- Getting error: Dependency "Kinetic" has no shared framework schemes with Carthage
- ZoomIn and ZoomOut option?
- Tween not working on CGAffineTransform
- Not working on iOS 13
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 kinetic.