Comments (4)
I'm finally close to having all of the refactoring of the library done for the 1.0 release over in the https://github.com/u10int/Kinetic/tree/props-refactor branch. I also just added support for animating along both quadratic and cubic bezier paths:
let path = QuadBezier(start: start.center, cp1: controlPoint1.center, end: end.center)
let tween = Kinetic.animate(square).along(path).duration(1).ease(.quartInOut)
Aside from some additional final cleanup of the code and API and a few bugs, thinking this branch is pretty close to being production-ready for updating master with. Feel free to test it out and let me know if you find any issues.
from kinetic.
This isn't possible with the library yet, but it is next on my list of things to add. Once I get the refactoring branch merged into master, the library will be at a more stable 1.0 version and then I'll be working on support for bezier path animations.
Hopefully I can get the refactor merged into master in the coming weeks. Until then, here's the branch that contains the newer API for the library: https://github.com/u10int/Kinetic/tree/props-refactor
from kinetic.
Cool! :)
I solved the bezier path.
I wanted an icon to move along a path while getting smaller and fade out towards the end.
func QuadBezier(t:CGFloat, start:CGFloat, c1:CGFloat, end:CGFloat) -> CGFloat
{
let t_:CGFloat = (1.0 - t)
let tt_:CGFloat = t_ * t_
let tt:CGFloat = t * t
return start * tt_ + 2.0 * c1 * t_ * t + end * tt
}
let A = CGPoint(x: frame.origin.x, y: frame.origin.y)
let B = CGPoint(x: System.width-40, y: 32)
let C = CGPoint(x: A.x + (B.x - A.x)/2 - 40, y: -130)
let duration = 0.8
Kinetic.animate(icon).to(.alpha(0), .scale(0.5)).duration(0.08).delay(duration - 0.08).play()
Kinetic.animate(icon).to(.scale(0.3)).duration(duration).ease(Easing.inSine).play().onUpdate({ anim in
let x = self.QuadBezier(t: CGFloat(anim.progress()), start: A.x, c1: C.x, end: B.x)
let y = self.QuadBezier(t: CGFloat(anim.progress()), start: A.y, c1: C.y, end: B.y)
icon.frame = CGRect(origin: CGPoint(x: x, y: y), size: icon.frame.size)
}).onComplete({ anim in
icon.removeFromSuperview()
})
from kinetic.
great! very cool :)
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
- onComplete doesn't get called when tween inside timeline HOT 6
- 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.