jhurray / jhchainableanimations Goto Github PK
View Code? Open in Web Editor NEWEasy to read and write chainable animations in Objective-C and Swift
License: MIT License
Easy to read and write chainable animations in Objective-C and Swift
License: MIT License
Hi! Thank you for so awesome animation library.
A wanted to ask you to add animation controlling features like stopping, pausing and resuming animations.
Hi!
I test version 2 and found that the callbacks pre and post are called at the same time:
JHChainableAnimator *animator = [[JHChainableAnimator alloc] initWithView:self.label];
animator.
transformScale(0.01f).makeOpacity(0.0f).postAnimationBlock(@weakself(^() ){
NSLog(@"postAnimationBlock %@",[NSDate date]);
}@weakselfend).
preAnimationBlock(@weakself(^() ){
NSLog(@"preAnimationBlock %@",[NSDate date]);
}@weakselfend).
animationBlock(@weakself(^() ){
NSLog(@"animationBlock %@",[NSDate date]);
}@weakselfend).
thenAfter(10.0f).
postAnimationBlock(@weakself(^() ){
NSLog(@"postAnimationBlock %@",[NSDate date]);
}@weakselfend).
animationBlock(@weakself(^() ){
NSLog(@"animationBlock %@",[NSDate date]);
}@weakselfend).
preAnimationBlock(@weakself(^() ){
NSLog(@"preAnimationBlock %@",[NSDate date]);
}@weakselfend).
transformScale(100.0f).makeOpacity(1.0f).animate(10.5f);
output:
preAnimationBlock 2017-02-07 16:53:35 +0000
animationBlock 2017-02-07 16:53:35 +0000
postAnimationBlock 2017-02-07 16:53:35 +0000
preAnimationBlock 2017-02-07 16:53:45 +0000
animationBlock 2017-02-07 16:53:45 +0000
postAnimationBlock 2017-02-07 16:53:45
This is a bug or something I do not understand?
Hello!
Thank you for providing the animation library, which I recently used in my project, but I found a bug. Animation usually works normally. When I jump from the current App to the second App, and then jump back to the current App, any animation will be repeated.
why subviews with autolayout constraints no update when their parents width changed?
any thoughts on being able to chain animations for multiple views in concert? both sequentially or simultaneously?
MakeScale do not any animation, it transform immediately.
view.makeScale(.9).thenAfater(2)
.rotate(3)
.animate(3);
I want to add CALayer support. Difficult?
Is there an easy way to repeat an animation at the moment? It would be great to see something like view.makeScale(2.0).repeat(4).animate(3.0)
.
I was expecting it to apply a scaling CGAffineTransform.
Not many views scale well by adjusting their bounds, for me I was trying to scale a UILabel, which by default just truncates the text when smaller.
the minimum deployment target is iOS9 which is declare in "JHChainableAnimations.podspec" file:
s.ios.deployment_target = '9.0'
Some animation can not be achieved when it is completely unrelated to other animations, such as changing the background color or transparency, and these animations are irrelevant to deformation or displacement animation.
I want to grow (scale) a view set a new value and then shrink (scale) the view to its original size again.
I tried to do:
var isGrowing = true
self.badgeView?.transformScale()(2).animate()(3)
self.badgeView?.animationCompletion = {
if isGrowing {
isGrowing = false
self.badgeView?.badgeText = "\(self.selectionCounter)"
self.badgeView?.transformScale()(1).animate()(3)
}
}
But it does not work that way. How can I fix this?
Hello! I need to fade in a view while it is moving to its destination point.
So I setup it with zero alpha and start coordinates, then I need to move it to the destination in 1 second and change its alpha to 1 in 0.3 second.
Is there a possibility to do that?
a.makeOpacity(1).animate(0.3).moveX(destination).animate(1) doesn't work.
The option to change the opacity is missing when using Swift.
It's there a method that i can stop the animation that has been setted?
Say you want to move something from Point A to Point B, but while it's moving, it now needs to continue on through B to C.
Is there a way to accomplish this currently?
Doing it in the animateWithCompletion block results in a stop and go..
(The functionality is built into UIView animateWithDuration w/ the UIViewAnimationOptionBeginFromCurrentState option)
i'm chinese,english is pool, thank you !!!!!
i like those animations: .spring and .bounce
i have some Advices:
2.can you provide other frequently-used animations effects? like shake, fade,flash,
i know a framework named canvas,but it did not support iOS 7's autoLayout, it's useful,but has many bugs, i think your framework could replace it Completely.
canvas,you should know it: https://github.com/CanvasPod/Canvas
thank you very much!!!!!
_counterLabel
.wait(0.2)
.makeScale(2)
.spring
.animate(0.8);
After calling this code, the label is shifted to the left and not scaling!
Is there a way to get this working with Swift?
I can get it to compile by changing:
#import "NSBKeyframeAnimationFunctions/NSBKeyframeAnimationFunctions.h"
to:
#import "NSBKeyframeAnimationFunctions.h"
but attempting to animate a button:
button.moveX(50).animate(0.5)
doesn't compile.
XCode throw an error " Use of '@import' when modules are disable", how should I solve the problem, thank you.
animator!.moveY(50).animate(1.0)
Keep getting an error on the above line that says:
Argument passed to call that takes no arguments
Please Help!!!
First, thanks @jhurray for the awesome lib. Great work!
Now back to the problem - has anyone encountered a blinking issue? No matter what animation (move, scale) I'm using, each view (with its own animator) blinks with white color at the end of an animation.
This is happening on an iPhone 6 device, iOS 10.3. Works smoothly on a Simulator, Xcode 9.0. Any thoughts?
I'm using Swift and pod 'ChainableAnimations', '~> 3.0.1'
the view A has a childView which set auto layout H |-0-ChildView-0-| V |-0-ChildView-0-|
then run makeFrame A View become big and ChildView stay original frame
thank you for this powerful frameworks!
i have some questions:
1.chainAnim with autoLaytou is useless,e.g.:
self.redView.makeConstraint(self.leftMarginC,100).animate(2.0f); //do not has any effects
2.cloud add duratiion for each chain? e.g.:
self.redView.moveX(100).duration(1.5f).thenAfter.moveY(100).duration(.8f).animat;
3.i could not understand the diff between wait/delay and thenAfter?
thank you!
I want to spring like this:
self.myView.makeScale(1.0).spring.animate(1.0);
but myView not animation.
I like this. Thanks!
For example, given _myButton
self.myButton.animationCompletion = JHAnimationCompletion() {
NSLog(@"Done!");
});
self.myButton.makeX(5).animate(1.0);
And myButton will flash.
i have implement one animate, and i want to repeat execute this animate,how can i implement it?
Hi,
I tried to add this library in my project, but the last changes of the last commit does not appears actually if I browse in the code. Maybe, because the name of the last version (3.0.1) is the same as the previous one.
Please, fix it. Thanks
In current implementation spring easing is just an easeOutElastic now. I want spring animation has dampingRatio and velocity parameters and to be implemented as a real spring animation.
Thank you.
How to transform a line view into a tick view?
For example, I want a view repeat a "up-down animation".
code:
JHChainableAnimator *anim = [[JHChainableAnimator alloc] initWithView:view];
anim.moveY(10).thenAfter(0.2).moveY(-10).animateWithRepeat(0.2,5);
But the view will move down once and move up five times
Hi,
trying to use easeInCirc effect I got a runtime error. With the same line of code but a different effect everything works fine.
myView.moveXY(-20,-150).easeInCirc.makeScale(2.0).makeOpacity(1.0).animate(0.8);
Error: file JHKeyframeAnimation.m line 166
Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void >CGPathAddLineToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat), file >Paths/CGPath.cc, line 265.
It make a bug when we use .anchorCenter because current layer.anchorPoint is (0.5, 0.5).
-(void) makeAnchorFromX:(CGFloat) x Y:(CGFloat)y {
JHAnimationCalculationAction action = ^void(UIView *weakSelf){
CGPoint anchorPoint = CGPointMake(x, y);
// I annote this make right.
// if (CGPointEqualToPoint(anchorPoint, weakSelf.layer.anchorPoint)) {
// return;
// }
CGPoint newPoint = CGPointMake(weakSelf.bounds.size.width * anchorPoint.x,
weakSelf.bounds.size.height * anchorPoint.y);
CGPoint oldPoint = CGPointMake(weakSelf.bounds.size.width * weakSelf.layer.anchorPoint.x,
weakSelf.bounds.size.height * weakSelf.layer.anchorPoint.y);
newPoint = CGPointApplyAffineTransform(newPoint, weakSelf.transform);
oldPoint = CGPointApplyAffineTransform(oldPoint, weakSelf.transform);
CGPoint position = weakSelf.layer.position;
position.x -= oldPoint.x;
position.x += newPoint.x;
position.y -= oldPoint.y;
position.y += newPoint.y;
weakSelf.layer.position = position;
weakSelf.layer.anchorPoint = anchorPoint;
};
NSMutableArray *lastCalculationActions = [self.JHAnimationCalculationActions lastObject];
[lastCalculationActions insertObject:action atIndex:0];
}
Out Test
view
.transformScale(.5)
.anchorCenter
.animate(5);
It scale by Top-Left not Center.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.