Permalink
Browse files

Added PopInOut example and tweaked the timing of the fade part of the…

… popIn/Out animation.
  • Loading branch information...
1 parent 733ed9e commit 108d7ea13fb81f2788bf25a28a5f2be478bceaf4 @neror committed Dec 2, 2009
Showing with 85 additions and 3 deletions.
  1. +3 −3 Classes/FTAnimationManager.m
  2. +2 −0 Examples/ExampleManager.m
  3. +31 −0 Examples/PopInOut.h
  4. +43 −0 Examples/PopInOut.m
  5. +6 −0 FTUtils.xcodeproj/project.pbxproj
@@ -329,7 +329,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];
@@ -353,11 +353,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
@@ -28,6 +28,7 @@ of this software and associated documentation files (the "Software"), to deal
#import "SlideInOut.h"
#import "FadeInOut.h"
#import "FadeBackgroundColorInOut.h"
+#import "PopInOut.h"
@interface ExampleManager ()
@@ -67,6 +68,7 @@ - (id)init {
[SlideInOut class],
[FadeInOut class],
[FadeBackgroundColorInOut class],
+ [PopInOut class],
nil],
nil];
}
View
@@ -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
@@ -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
@@ -21,6 +21,7 @@
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 */; };
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 */; };
@@ -90,6 +91,8 @@
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>"; };
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>"; };
@@ -272,6 +275,8 @@
DF3E06C510C721E0004434C3 /* FadeInOut.m */,
DF3E06EF10C723F0004434C3 /* FadeBackgroundColorInOut.h */,
DF3E06F010C723F0004434C3 /* FadeBackgroundColorInOut.m */,
+ DF3E071210C72581004434C3 /* PopInOut.h */,
+ DF3E071310C72581004434C3 /* PopInOut.m */,
);
name = "Simple View Animation";
sourceTree = "<group>";
@@ -452,6 +457,7 @@
DF3E06A110C71FF7004434C3 /* SlideInOut.m in Sources */,
DF3E06C610C721E0004434C3 /* FadeInOut.m in Sources */,
DF3E06F110C723F0004434C3 /* FadeBackgroundColorInOut.m in Sources */,
+ DF3E071410C72581004434C3 /* PopInOut.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit 108d7ea

Please sign in to comment.