Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:neror/ftutils

  • Loading branch information...
commit 295c97689b44cc9cfb71675b77983d48077119a7 2 parents a0b3750 + 001bec3
@neror authored
View
10 Classes/FTAnimationManager.m
@@ -330,7 +330,7 @@ - (CAAnimation *)popInAnimationFor:(UIView *)view duration:(NSTimeInterval)durat
nil];
CABasicAnimation *fadeIn = [CABasicAnimation animationWithKeyPath:@"opacity"];
- fadeIn.duration = duration * .7f;
+ fadeIn.duration = duration * .4f;
fadeIn.fromValue = [NSNumber numberWithFloat:0.f];
fadeIn.toValue = [NSNumber numberWithFloat:1.f];
fadeIn.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
@@ -354,11 +354,11 @@ - (CAAnimation *)popOutAnimationFor:(UIView *)view duration:(NSTimeInterval)dura
nil];
CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"];
- fadeOut.duration = duration * .3f;
+ fadeOut.duration = duration * .4f;
fadeOut.fromValue = [NSNumber numberWithFloat:1.f];
fadeOut.toValue = [NSNumber numberWithFloat:0.f];
fadeOut.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
- fadeOut.beginTime = duration * .7f;
+ fadeOut.beginTime = duration * .6f;
fadeOut.fillMode = kCAFillModeBoth;
return [self animationGroupFor:[NSArray arrayWithObjects:scale, fadeOut, nil] withView:view duration:duration
@@ -385,7 +385,6 @@ - (CAAnimation *)fallInAnimationFor:(UIView *)view duration:(NSTimeInterval)dura
CAAnimationGroup *group = [self animationGroupFor:[NSArray arrayWithObjects:fall, fade, nil] withView:view duration:duration
delegate:delegate startSelector:startSelector stopSelector:stopSelector
name:kFTAnimationFallIn type:kFTAnimationTypeIn];
- group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
return group;
}
@@ -405,7 +404,6 @@ - (CAAnimation *)fallOutAnimationFor:(UIView *)view duration:(NSTimeInterval)dur
CAAnimationGroup *group = [self animationGroupFor:[NSArray arrayWithObjects:fall, fade, nil] withView:view duration:duration
delegate:delegate startSelector:startSelector stopSelector:stopSelector
name:kFTAnimationFallOut type:kFTAnimationTypeOut];
- group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
return group;
}
@@ -419,11 +417,11 @@ - (CAAnimation *)flyOutAnimationFor:(UIView *)view duration:(NSTimeInterval)dura
CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"];
fade.toValue = [NSNumber numberWithFloat:0.f];
+ fade.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
CAAnimationGroup *group = [self animationGroupFor:[NSArray arrayWithObjects:fly, fade, nil] withView:view duration:duration
delegate:delegate startSelector:startSelector stopSelector:stopSelector
name:kFTAnimationFlyOut type:kFTAnimationTypeOut];
- group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
return group;
}
View
11 Examples/BackInOut.m
@@ -27,16 +27,21 @@ of this software and associated documentation files (the "Software"), to deal
@implementation BackInOut
-+ (NSString *)friendlyName {
++ (NSString *)displayName {
return @"Back In/Back Out";
}
+- (void)viewDidLoad {
+ self.hasDirectionControl = YES;
+}
+
- (void)performAnimation:(id)sender {
if(self.viewToAnimate.hidden) {
- [self.viewToAnimate backInFrom:kFTAnimationTop withFade:NO duration:1. delegate:nil];
+ [self.viewToAnimate backInFrom:self.directionControl.selectedSegmentIndex withFade:NO duration:.4 delegate:nil];
} else {
- [self.viewToAnimate backOutTo:kFTAnimationTop withFade:NO duration:1. delegate:nil];
+ [self.viewToAnimate backOutTo:self.directionControl.selectedSegmentIndex withFade:NO duration:.4 delegate:nil];
}
}
+
@end
View
29 Examples/ExampleManager.m
@@ -25,6 +25,12 @@ of this software and associated documentation files (the "Software"), to deal
#import "ExampleManager.h"
#import <objc/runtime.h>
#import "BackInOut.h"
+#import "SlideInOut.h"
+#import "FadeInOut.h"
+#import "FadeBackgroundColorInOut.h"
+#import "PopInOut.h"
+#import "FallInOut.h"
+#import "FlyOut.h"
@interface ExampleManager ()
@@ -34,7 +40,7 @@ + (ExampleManager *)sharedSampleManager;
@interface UIViewController (ThisIsHereToAviodACompilerWarning)
-+ (NSString *)friendlyName;
++ (NSString *)displayName;
@end
@@ -57,19 +63,18 @@ + (ExampleManager *)sharedSampleManager {
- (id)init {
self = [super init];
if (self != nil) {
-// NSArray *geom = [NSArray arrayWithObjects:[GeometricProperties class], [LayerTransforms class], nil];
-// NSArray *hier = [NSArray arrayWithObjects:[LayerTree class], nil];
-// NSArray *drawing = [NSArray arrayWithObjects:[ImageContent class], [LayerDrawing class], [StyleProperties class], nil];
-// NSArray *animation = [NSArray arrayWithObjects:[BasicAnimation class], [AnimationGroups class],
-// [AnimationTransactions class], [KeyframeAnimation class], [LayerActions class],
-// [LayerTransitions class], nil];
-// NSArray *special = [NSArray arrayWithObjects:[ShapeLayers class], [GradientLayers class], nil];
-
-
groups_ = [[NSArray alloc] initWithObjects:@"Animating Views",
nil];
- samples_ = [[NSArray alloc] initWithObjects:[NSArray arrayWithObject:[BackInOut class]], nil];
+ samples_ = [[NSArray alloc] initWithObjects:[NSArray arrayWithObjects:[BackInOut class],
+ [SlideInOut class],
+ [FadeInOut class],
+ [FadeBackgroundColorInOut class],
+ [PopInOut class],
+ [FallInOut class],
+ [FlyOut class],
+ nil],
+ nil];
}
return self;
}
@@ -96,7 +101,7 @@ + (NSString *)sampleNameAtIndexPath:(NSIndexPath *)indexPath {
ExampleManager *SELF = [ExampleManager sharedSampleManager];
NSArray *samples = [SELF->samples_ objectAtIndex:indexPath.section];
Class clazz = [samples objectAtIndex:indexPath.row];
- return [clazz friendlyName];
+ return [clazz displayName];
}
+ (UIViewController *)sampleInstanceAtIndexPath:(NSIndexPath *)indexPath {
View
31 Examples/FadeBackgroundColorInOut.h
@@ -0,0 +1,31 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SimpleAnimationExample.h"
+
+
+@interface FadeBackgroundColorInOut : SimpleAnimationExample {
+}
+
+@end
View
49 Examples/FadeBackgroundColorInOut.m
@@ -0,0 +1,49 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "FadeBackgroundColorInOut.h"
+#import "FTAnimation.h"
+
+@implementation FadeBackgroundColorInOut
+
++ (NSString *)displayName {
+ return @"Fade Background Color In/Out";
+}
+
+- (void)viewDidLoad {
+ self.viewToAnimate.image = nil;
+ self.viewToAnimate.backgroundColor = UIColorFromRGBA(0x0000FF, .85);
+ self.viewToAnimate.layer.cornerRadius = 20.;
+}
+
+- (void)performAnimation:(id)sender {
+ if(self.viewToAnimate.hidden) {
+ [self.viewToAnimate fadeBackgroundColorIn:.4 delegate:nil];
+ } else {
+ [self.viewToAnimate fadeBackgroundColorOut:.4 delegate:nil];
+ }
+}
+
+
+@end
View
31 Examples/FadeInOut.h
@@ -0,0 +1,31 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SimpleAnimationExample.h"
+
+
+@interface FadeInOut : SimpleAnimationExample {
+}
+
+@end
View
43 Examples/FadeInOut.m
@@ -0,0 +1,43 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "FadeInOut.h"
+#import "FTAnimation.h"
+
+@implementation FadeInOut
+
++ (NSString *)displayName {
+ return @"Fade In/Fade Out";
+}
+
+- (void)performAnimation:(id)sender {
+ if(self.viewToAnimate.hidden) {
+ [self.viewToAnimate fadeIn:.4 delegate:nil];
+ } else {
+ [self.viewToAnimate fadeOut:.4 delegate:nil];
+ }
+}
+
+
+@end
View
31 Examples/FallInOut.h
@@ -0,0 +1,31 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SimpleAnimationExample.h"
+
+
+@interface FallInOut : SimpleAnimationExample {
+}
+
+@end
View
43 Examples/FallInOut.m
@@ -0,0 +1,43 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "FallInOut.h"
+#import "FTAnimation.h"
+
+@implementation FallInOut
+
++ (NSString *)displayName {
+ return @"Fall In/Fall Out";
+}
+
+- (void)performAnimation:(id)sender {
+ if(self.viewToAnimate.hidden) {
+ [self.viewToAnimate fallIn:.4 delegate:nil];
+ } else {
+ [self.viewToAnimate fallOut:.4 delegate:nil];
+ }
+}
+
+
+@end
View
31 Examples/FlyOut.h
@@ -0,0 +1,31 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SimpleAnimationExample.h"
+
+
+@interface FlyOut : SimpleAnimationExample {
+}
+
+@end
View
43 Examples/FlyOut.m
@@ -0,0 +1,43 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "FlyOut.h"
+#import "FTAnimation.h"
+
+@implementation FlyOut
+
++ (NSString *)displayName {
+ return @"Fly Out";
+}
+
+- (void)performAnimation:(id)sender {
+ if(self.viewToAnimate.hidden) {
+ [self.viewToAnimate fadeIn:.2 delegate:nil];
+ } else {
+ [self.viewToAnimate flyOut:.4 delegate:nil];
+ }
+}
+
+
+@end
View
31 Examples/PopInOut.h
@@ -0,0 +1,31 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SimpleAnimationExample.h"
+
+
+@interface PopInOut : SimpleAnimationExample {
+}
+
+@end
View
43 Examples/PopInOut.m
@@ -0,0 +1,43 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "PopInOut.h"
+#import "FTAnimation.h"
+
+@implementation PopInOut
+
++ (NSString *)displayName {
+ return @"Pop In/Pop Out";
+}
+
+- (void)performAnimation:(id)sender {
+ if(self.viewToAnimate.hidden) {
+ [self.viewToAnimate popIn:.4 delegate:nil];
+ } else {
+ [self.viewToAnimate popOut:.4 delegate:nil];
+ }
+}
+
+
+@end
View
3  Examples/SimpleAnimationExample.h
@@ -28,10 +28,13 @@
@interface SimpleAnimationExample : UIViewController {
UIImageView *viewToAnimate_;
UIButton *performAnimationButton_;
+ UISegmentedControl *directionControl_;
}
@property(nonatomic,retain) UIImageView *viewToAnimate;
@property(nonatomic,retain) UIButton *performAnimationButton;
+@property(nonatomic,retain) UISegmentedControl *directionControl;
+@property(assign) BOOL hasDirectionControl;
- (void)performAnimation:(id)sender;
View
25 Examples/SimpleAnimationExample.m
@@ -29,8 +29,9 @@ @implementation SimpleAnimationExample
@synthesize viewToAnimate = viewToAnimate_;
@synthesize performAnimationButton = performAnimationButton_;
+@synthesize directionControl = directionControl_;
-+ (NSString *)friendlyName {
++ (NSString *)displayName {
return @"";
}
@@ -38,7 +39,7 @@ + (NSString *)friendlyName {
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
- self.title = [[self class] friendlyName];
+ self.title = [[self class] displayName];
}
return self;
}
@@ -46,9 +47,22 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (void)dealloc {
self.viewToAnimate = nil;
self.performAnimationButton = nil;
+ self.directionControl = nil;
[super dealloc];
}
+- (void)setHasDirectionControl:(BOOL)hasDirection {
+ if(hasDirection && (self.directionControl.superview == nil)) {
+ [self.view insertSubview:self.directionControl belowSubview:self.viewToAnimate];
+ } else if(!hasDirection && self.directionControl.superview != nil){
+ [self.directionControl removeFromSuperview];
+ }
+}
+
+- (BOOL)hasDirectionControl {
+ return (self.directionControl.superview != nil);
+}
+
#pragma mark Load and unload the view
- (void)loadView {
@@ -58,13 +72,18 @@ - (void)loadView {
self.viewToAnimate = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ViewBackground.png"]] autorelease];
self.viewToAnimate.opaque = NO;
self.viewToAnimate.backgroundColor = [UIColor clearColor];
- self.viewToAnimate.frame = CGRectMake(20., 20., 280., 320.);
+ self.viewToAnimate.frame = CGRectMake(20., 10., 280., 280.);
self.performAnimationButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
self.performAnimationButton.frame = CGRectMake(10., 356., 300., 44.);
[self.performAnimationButton setTitle:@"Run Animation" forState:UIControlStateNormal];
[self.performAnimationButton addTarget:self action:@selector(performAnimation:) forControlEvents:UIControlEventTouchUpInside];
+ NSArray *directionItems = [NSArray arrayWithObjects:@"Top", @"Right", @"Bottom", @"Left", nil];
+ self.directionControl = [[[UISegmentedControl alloc] initWithItems:directionItems] autorelease];
+ self.directionControl.selectedSegmentIndex = 0;
+ self.directionControl.frame = CGRectMake(10., 300., 300., 44.);
+
[self.view addSubview:self.performAnimationButton];
[self.view addSubview:self.viewToAnimate];
}
View
31 Examples/SlideInOut.h
@@ -0,0 +1,31 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SimpleAnimationExample.h"
+
+
+@interface SlideInOut : SimpleAnimationExample {
+}
+
+@end
View
47 Examples/SlideInOut.m
@@ -0,0 +1,47 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#import "SlideInOut.h"
+#import "FTAnimation.h"
+
+@implementation SlideInOut
+
++ (NSString *)displayName {
+ return @"Slide In/Slide Out";
+}
+
+- (void)viewDidLoad {
+ self.hasDirectionControl = YES;
+}
+
+- (void)performAnimation:(id)sender {
+ if(self.viewToAnimate.hidden) {
+ [self.viewToAnimate slideInFrom:self.directionControl.selectedSegmentIndex duration:.4 delegate:nil];
+ } else {
+ [self.viewToAnimate slideOutTo:self.directionControl.selectedSegmentIndex duration:.4 delegate:nil];
+ }
+}
+
+
+@end
View
BIN  Examples/ViewBackground.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
66 FTUtils.xcodeproj/project.pbxproj
@@ -18,6 +18,12 @@
DF287AB10FE19638001E9F62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA50FE19638001E9F62 /* UIKit.framework */; };
DF2962EE0FE18E0000B9D71D /* FTAnimationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2962E40FE18E0000B9D71D /* FTAnimationManager.h */; };
DF2962F20FE18E0000B9D71D /* FTAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */; };
+ DF3E06A110C71FF7004434C3 /* SlideInOut.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3E06A010C71FF7004434C3 /* SlideInOut.m */; };
+ DF3E06C610C721E0004434C3 /* FadeInOut.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3E06C510C721E0004434C3 /* FadeInOut.m */; };
+ DF3E06F110C723F0004434C3 /* FadeBackgroundColorInOut.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3E06F010C723F0004434C3 /* FadeBackgroundColorInOut.m */; };
+ DF3E071410C72581004434C3 /* PopInOut.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3E071310C72581004434C3 /* PopInOut.m */; };
+ DF3E073410C72689004434C3 /* FallInOut.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3E073310C72689004434C3 /* FallInOut.m */; };
+ DF3E075B10C7278D004434C3 /* FlyOut.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3E075A10C7278D004434C3 /* FlyOut.m */; };
DFA2EA8A10C2AC89003A76FF /* FTUtils+NSObject.m in Sources */ = {isa = PBXBuildFile; fileRef = DFFBF80910ADF405008DB0B9 /* FTUtils+NSObject.m */; };
DFE4EF141035CC4D006A7598 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DFE4EF131035CC4D006A7598 /* OCMock.framework */; };
DFE4EF1C1035CC97006A7598 /* OCMock.framework in Copy OCMock */ = {isa = PBXBuildFile; fileRef = DFE4EF131035CC4D006A7598 /* OCMock.framework */; };
@@ -44,13 +50,6 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- DFFBF86110ADF7A1008DB0B9 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = DFE4EF0A1035CBCB006A7598;
- remoteInfo = UnitTests;
- };
DFFDB4B010C2DA5200F7BF95 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -88,6 +87,18 @@
DF2962E10FE18E0000B9D71D /* TestFTAnimationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestFTAnimationManager.m; sourceTree = "<group>"; };
DF2962E40FE18E0000B9D71D /* FTAnimationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTAnimationManager.h; path = FTUtils/FTAnimationManager.h; sourceTree = "<group>"; };
DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTAnimationManager.m; sourceTree = "<group>"; };
+ DF3E069F10C71FF7004434C3 /* SlideInOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlideInOut.h; sourceTree = "<group>"; };
+ DF3E06A010C71FF7004434C3 /* SlideInOut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SlideInOut.m; sourceTree = "<group>"; };
+ DF3E06C410C721E0004434C3 /* FadeInOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FadeInOut.h; sourceTree = "<group>"; };
+ DF3E06C510C721E0004434C3 /* FadeInOut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FadeInOut.m; sourceTree = "<group>"; };
+ DF3E06EF10C723F0004434C3 /* FadeBackgroundColorInOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FadeBackgroundColorInOut.h; sourceTree = "<group>"; };
+ DF3E06F010C723F0004434C3 /* FadeBackgroundColorInOut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FadeBackgroundColorInOut.m; sourceTree = "<group>"; };
+ DF3E071210C72581004434C3 /* PopInOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopInOut.h; sourceTree = "<group>"; };
+ DF3E071310C72581004434C3 /* PopInOut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PopInOut.m; sourceTree = "<group>"; };
+ DF3E073210C72689004434C3 /* FallInOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FallInOut.h; sourceTree = "<group>"; };
+ DF3E073310C72689004434C3 /* FallInOut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FallInOut.m; sourceTree = "<group>"; };
+ DF3E075910C7278D004434C3 /* FlyOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlyOut.h; sourceTree = "<group>"; };
+ DF3E075A10C7278D004434C3 /* FlyOut.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlyOut.m; sourceTree = "<group>"; };
DF6D06470FE1A6F200CC44C6 /* README.mdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.mdown; sourceTree = "<group>"; };
DFE4EF0B1035CBCB006A7598 /* UnitTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
DFE4EF0C1035CBCB006A7598 /* UnitTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UnitTests-Info.plist"; sourceTree = "<group>"; };
@@ -238,11 +249,21 @@
name = Support;
sourceTree = "<group>";
};
+ DF3E064410C71181004434C3 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ DFFDB68110C2EA1400F7BF95 /* Checkers.png */,
+ DFFDB62510C2E67100F7BF95 /* ViewBackground.png */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
DFFDB49110C2D91B00F7BF95 /* Examples */ = {
isa = PBXGroup;
children = (
DFFDB4A510C2D9E300F7BF95 /* Simple View Animation */,
- DFFDB5BC10C2DDB600F7BF95 /* Supporting Files */,
+ DFFDB5BC10C2DDB600F7BF95 /* Supporting Classes */,
+ DF3E064410C71181004434C3 /* Resources */,
);
path = Examples;
sourceTree = "<group>";
@@ -254,15 +275,25 @@
DFFDB59C10C2DC7900F7BF95 /* SimpleAnimationExample.m */,
DFFDB5DE10C2DFB700F7BF95 /* BackInOut.h */,
DFFDB5DF10C2DFB700F7BF95 /* BackInOut.m */,
+ DF3E069F10C71FF7004434C3 /* SlideInOut.h */,
+ DF3E06A010C71FF7004434C3 /* SlideInOut.m */,
+ DF3E06C410C721E0004434C3 /* FadeInOut.h */,
+ DF3E06C510C721E0004434C3 /* FadeInOut.m */,
+ DF3E06EF10C723F0004434C3 /* FadeBackgroundColorInOut.h */,
+ DF3E06F010C723F0004434C3 /* FadeBackgroundColorInOut.m */,
+ DF3E071210C72581004434C3 /* PopInOut.h */,
+ DF3E071310C72581004434C3 /* PopInOut.m */,
+ DF3E073210C72689004434C3 /* FallInOut.h */,
+ DF3E073310C72689004434C3 /* FallInOut.m */,
+ DF3E075910C7278D004434C3 /* FlyOut.h */,
+ DF3E075A10C7278D004434C3 /* FlyOut.m */,
);
name = "Simple View Animation";
sourceTree = "<group>";
};
- DFFDB5BC10C2DDB600F7BF95 /* Supporting Files */ = {
+ DFFDB5BC10C2DDB600F7BF95 /* Supporting Classes */ = {
isa = PBXGroup;
children = (
- DFFDB68110C2EA1400F7BF95 /* Checkers.png */,
- DFFDB62510C2E67100F7BF95 /* ViewBackground.png */,
DFFDB57610C2DA9700F7BF95 /* main.m */,
DFFDB5EE10C2E12200F7BF95 /* Examples_Prefix.pch */,
DFFDB59410C2DBC000F7BF95 /* ExampleManager.h */,
@@ -272,7 +303,7 @@
DFFDB57810C2DAED00F7BF95 /* ExamplesAppDelegate.h */,
DFFDB57910C2DAED00F7BF95 /* ExamplesAppDelegate.m */,
);
- name = "Supporting Files";
+ name = "Supporting Classes";
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -433,17 +464,18 @@
DFFDB59D10C2DC7900F7BF95 /* SimpleAnimationExample.m in Sources */,
DFFDB5A610C2DD1600F7BF95 /* RootViewController.m in Sources */,
DFFDB5E010C2DFB700F7BF95 /* BackInOut.m in Sources */,
+ DF3E06A110C71FF7004434C3 /* SlideInOut.m in Sources */,
+ DF3E06C610C721E0004434C3 /* FadeInOut.m in Sources */,
+ DF3E06F110C723F0004434C3 /* FadeBackgroundColorInOut.m in Sources */,
+ DF3E071410C72581004434C3 /* PopInOut.m in Sources */,
+ DF3E073410C72689004434C3 /* FallInOut.m in Sources */,
+ DF3E075B10C7278D004434C3 /* FlyOut.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- DFFBF86210ADF7A1008DB0B9 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = DFE4EF0A1035CBCB006A7598 /* UnitTests */;
- targetProxy = DFFBF86110ADF7A1008DB0B9 /* PBXContainerItemProxy */;
- };
DFFDB4B110C2DA5200F7BF95 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D2AAC07D0554694100DB518D /* FTUtils */;
View
1  Headers/FTUtils/FTAnimation+UIView.h
@@ -61,6 +61,7 @@
- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate;
- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate;
- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
Please sign in to comment.
Something went wrong with that request. Please try again.