Comments (3)
YES, it is really interesting. When I found the animation syntax is so concise and elegant. I have tried to use this syntax to set up UIKit component ChainableKit But it is a little weird. I think this syntax works well with animation but not such well with UIKit.
The suggestion is also very great. And it still needs much more work... I will try it figure it out and see whether it is better way to add constraint to UIKit component.
Thanks so much.
from dkchainableanimationkit.
ChainableKit looks really good.
I'm trying to think about what would be the most concise, DRY, and readable syntax, which combines setting properties, animating and constraints (and animating constraints).
To produce this:
.. you could have something like this:
var greenView = UIView()
greenView.set.backgroundColor(UIColor.greenColor()).alpha(0.5) // 'set' to chain properties
view.addSubview(greenView)
greenView.constrain.top.bottom.left.equalTo(view) // 'constrain' to make (and chain) constraints
greenView.constrain.width.equalTo(view).multipliedBy(0.25)
var redView = UIView(frame:CGRectMake(0, 0, 100, 100))
redView.backgroundColor = UIColor.redColor()
view.addSubview(redView)
greenView.constrain.width.equalTo(view).multipliedBy(0.5).spring.animate(1.0) {
self.greenView.animate.alpha(1.0).animate(1.0).
self.redView.animate.moveXY(200,200).delay(0.5).spring.animate(0.5)
}
Thatβs about 10 lines, 620 characters.
If done without any libraries - https://gist.github.com/cannyboy/dabe7a9f487338e07830 - it would be maybe 40 lines - about 2500 characters.
from dkchainableanimationkit.
@cannyboy I responded to your issue on SnapKit. There are some reasons that that syntax wont work (or at least it would be very difficult to make it work). I am thinking of adding a chainable property that takes a NSLayoutContraint and a value and animates the change of the constant.
So if you use SnapKit or Masonry to reference a constraint you could then say
self.myView.makeConstraint(self.myConstraint, 50).animate(1.0);
I just want to make sure this works 100% of the time and conforms to apples API.
from dkchainableanimationkit.
Related Issues (20)
- Animating Constraints
- ObjC version? HOT 1
- Can not use right with makeFrame HOT 1
- Keyframe caculator Funtions: easeInCirc,...
- makeHeight, makeWith still keep current coordinates
- How to repeat / stop a group of animation HOT 4
- not working xcode 7.3 HOT 6
- Any plan on Swift 3.0 update? HOT 2
- Animating Background Color Crashing HOT 4
- Podfile + Xcode 8 HOT 3
- how to use in swift 3.0 HOT 1
- The latest version on CocoaPods is 1.6.1 HOT 1
- crash in Xcode 8.2 , Swift 3.0.2 HOT 1
- Animation trouble using Timer
- MakeWidth/MoveWidth doesn't animate HOT 1
- Doesn't compile in XCode 9.2 with Swift 4 HOT 2
- Can't compile in XCode 9.3 Swift 4 HOT 1
- Can't Compile in Xcode 10.2
- Method to repeat HOT 3
- I had to add "import DKChainableAnimationKit" to make it work. HOT 2
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 dkchainableanimationkit.