├── .gitignore ├── CA360.xcodeproj └── project.pbxproj ├── CA360_Prefix.pch ├── Classes ├── CA360AppDelegate.h ├── CA360AppDelegate.m ├── CALayer+FTDebugDrawing.h ├── CALayer+FTDebugDrawing.m ├── Fun Stuff │ ├── BitmapFontCounter.h │ ├── BitmapFontCounter.m │ ├── ShutterTransition.h │ └── ShutterTransition.m ├── RootViewController.h ├── RootViewController.m ├── Samples │ ├── AdvancedShapeLayers.h │ ├── AdvancedShapeLayers.m │ ├── AnimationGroups.h │ ├── AnimationGroups.m │ ├── AnimationTransactions.h │ ├── AnimationTransactions.m │ ├── BasicAnimation.h │ ├── BasicAnimation.m │ ├── CustomPropertyAnimation.h │ ├── CustomPropertyAnimation.m │ ├── GeometricProperties.h │ ├── GeometricProperties.m │ ├── GradientLayers.h │ ├── GradientLayers.m │ ├── ImageContent.h │ ├── ImageContent.m │ ├── KeyframeAnimation.h │ ├── KeyframeAnimation.m │ ├── LayerActions.h │ ├── LayerActions.m │ ├── LayerDrawing.h │ ├── LayerDrawing.m │ ├── LayerTransforms.h │ ├── LayerTransforms.m │ ├── LayerTransitions.h │ ├── LayerTransitions.m │ ├── LayerTree.h │ ├── LayerTree.m │ ├── SampleManager.h │ ├── SampleManager.m │ ├── ShapeLayers.h │ ├── ShapeLayers.m │ ├── StyleProperties.h │ ├── StyleProperties.m │ ├── TextLayers.h │ └── TextLayers.m └── UsefulMacros.h ├── README.rst ├── Resources-iPad └── Resources │ └── MainWindow-iPad.xib ├── Resources ├── Ben.png ├── CA360-Info.plist ├── Delicious-Roman.otf ├── FTSLogo.png ├── MainWindow.xib ├── Mario.acorn ├── Mario.png ├── NumberStrip.png ├── StarMask.png └── Steve.png └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.svn 3 | *.o 4 | *.DS_Store 5 | *.mode1v3 6 | *.pbxuser 7 | *.perspectivev3 8 | CA360.xcodeproj/project.xcworkspace 9 | CA360.xcodeproj/xcuserdata 10 | -------------------------------------------------------------------------------- /CA360.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* CA360AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* CA360AppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */; }; 15 | 28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C286E00D94DF7D0034E888 /* RootViewController.m */; }; 16 | DF5FC6C011C7FBD900130E6E /* AdvancedShapeLayers.m in Sources */ = {isa = PBXBuildFile; fileRef = DF5FC6BF11C7FBD900130E6E /* AdvancedShapeLayers.m */; }; 17 | DF6D1C3A11C19AF200025ED7 /* ShutterTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = DF6D1C3911C19AF200025ED7 /* ShutterTransition.m */; }; 18 | DF75ABFD116A8252006FF3EB /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = DF75ABFC116A8252006FF3EB /* MainWindow-iPad.xib */; }; 19 | DF7A2F7D123D689400BDD60A /* TextLayers.m in Sources */ = {isa = PBXBuildFile; fileRef = DF7A2F7C123D689400BDD60A /* TextLayers.m */; }; 20 | DF7A2FA9123D6C3B00BDD60A /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF7A2FA8123D6C3B00BDD60A /* CoreText.framework */; }; 21 | DF7A2FAF123D6C5700BDD60A /* Delicious-Roman.otf in Resources */ = {isa = PBXBuildFile; fileRef = DF7A2FAE123D6C5700BDD60A /* Delicious-Roman.otf */; }; 22 | DF80136E10377A1200B48250 /* GradientLayers.m in Sources */ = {isa = PBXBuildFile; fileRef = DF80136C10377A1200B48250 /* GradientLayers.m */; }; 23 | DF8014A31038D12900B48250 /* CALayer+FTDebugDrawing.m in Sources */ = {isa = PBXBuildFile; fileRef = DF8014A11038D12900B48250 /* CALayer+FTDebugDrawing.m */; }; 24 | DF8015631038E1C400B48250 /* LayerTransforms.m in Sources */ = {isa = PBXBuildFile; fileRef = DF8015611038E1C400B48250 /* LayerTransforms.m */; }; 25 | DFAFBACF105EFF4200AE6FF1 /* LayerTransitions.m in Sources */ = {isa = PBXBuildFile; fileRef = DFAFBACE105EFF4200AE6FF1 /* LayerTransitions.m */; }; 26 | DFB121621060279A00E7DB00 /* Mario.png in Resources */ = {isa = PBXBuildFile; fileRef = DFB121611060279A00E7DB00 /* Mario.png */; }; 27 | DFC621A0117399D700F5B5FD /* BitmapFontCounter.m in Sources */ = {isa = PBXBuildFile; fileRef = DFC6219F117399D700F5B5FD /* BitmapFontCounter.m */; }; 28 | DFC621E711745A1F00F5B5FD /* NumberStrip.png in Resources */ = {isa = PBXBuildFile; fileRef = DFC621E611745A1F00F5B5FD /* NumberStrip.png */; }; 29 | DFEE3F47128C94CA0010106E /* CustomPropertyAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = DFEE3F46128C94CA0010106E /* CustomPropertyAnimation.m */; }; 30 | DFF70C321039D8BC0052EE6A /* ImageContent.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF70C311039D8BC0052EE6A /* ImageContent.m */; }; 31 | DFF70C461039D9E60052EE6A /* FTSLogo.png in Resources */ = {isa = PBXBuildFile; fileRef = DFF70C451039D9E60052EE6A /* FTSLogo.png */; }; 32 | DFF70C4F1039DA0A0052EE6A /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = DFF70C4C1039DA0A0052EE6A /* MainWindow.xib */; }; 33 | DFF70C9E1039DE170052EE6A /* Ben.png in Resources */ = {isa = PBXBuildFile; fileRef = DFF70C9C1039DE170052EE6A /* Ben.png */; }; 34 | DFF70C9F1039DE170052EE6A /* Steve.png in Resources */ = {isa = PBXBuildFile; fileRef = DFF70C9D1039DE170052EE6A /* Steve.png */; }; 35 | DFF70D151039F83E0052EE6A /* StyleProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF70D141039F83E0052EE6A /* StyleProperties.m */; }; 36 | DFF70D78103A0BB40052EE6A /* StarMask.png in Resources */ = {isa = PBXBuildFile; fileRef = DFF70D77103A0BB40052EE6A /* StarMask.png */; }; 37 | DFF70D9E103A104C0052EE6A /* LayerActions.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF70D9D103A104C0052EE6A /* LayerActions.m */; }; 38 | DFF70DA2103A10870052EE6A /* AnimationTransactions.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF70DA1103A10870052EE6A /* AnimationTransactions.m */; }; 39 | DFF70DC0103A11DF0052EE6A /* AnimationGroups.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF70DBF103A11DF0052EE6A /* AnimationGroups.m */; }; 40 | DFF7F2F6103602470067ED5B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DFF7F2F4103602470067ED5B /* QuartzCore.framework */; }; 41 | DFF7F3AD103604580067ED5B /* LayerTree.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F3AB103604580067ED5B /* LayerTree.m */; }; 42 | DFF7F3B5103605C80067ED5B /* SampleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F3B3103605C80067ED5B /* SampleManager.m */; }; 43 | DFF7F585103623ED0067ED5B /* ShapeLayers.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F584103623ED0067ED5B /* ShapeLayers.m */; }; 44 | DFF7F5C6103626750067ED5B /* GeometricProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F5C4103626750067ED5B /* GeometricProperties.m */; }; 45 | DFF7F613103632570067ED5B /* LayerDrawing.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F611103632570067ED5B /* LayerDrawing.m */; }; 46 | DFF7F616103632A90067ED5B /* BasicAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F615103632A90067ED5B /* BasicAnimation.m */; }; 47 | DFF7F65B103634C70067ED5B /* KeyframeAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = DFF7F659103634C70067ED5B /* KeyframeAnimation.m */; }; 48 | /* End PBXBuildFile section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 52 | 1D3623240D0F684500981E51 /* CA360AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CA360AppDelegate.h; sourceTree = ""; }; 53 | 1D3623250D0F684500981E51 /* CA360AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CA360AppDelegate.m; sourceTree = ""; }; 54 | 1D6058910D05DD3D006BFB54 /* CA360.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CA360.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 56 | 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 57 | 28A0AAE50D9B0CCF005BE974 /* CA360_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CA360_Prefix.pch; sourceTree = ""; }; 58 | 28C286DF0D94DF7D0034E888 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 59 | 28C286E00D94DF7D0034E888 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 60 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 61 | DF5FC6BE11C7FBD900130E6E /* AdvancedShapeLayers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AdvancedShapeLayers.h; path = Classes/Samples/AdvancedShapeLayers.h; sourceTree = ""; }; 62 | DF5FC6BF11C7FBD900130E6E /* AdvancedShapeLayers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AdvancedShapeLayers.m; path = Classes/Samples/AdvancedShapeLayers.m; sourceTree = ""; }; 63 | DF64092411DD64D1002D1414 /* UsefulMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UsefulMacros.h; sourceTree = ""; }; 64 | DF6D1C3811C19AF200025ED7 /* ShutterTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ShutterTransition.h; path = "Classes/Fun Stuff/ShutterTransition.h"; sourceTree = ""; }; 65 | DF6D1C3911C19AF200025ED7 /* ShutterTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ShutterTransition.m; path = "Classes/Fun Stuff/ShutterTransition.m"; sourceTree = ""; }; 66 | DF75ABFC116A8252006FF3EB /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainWindow-iPad.xib"; path = "Resources-iPad/Resources/MainWindow-iPad.xib"; sourceTree = ""; }; 67 | DF7A2F7B123D689400BDD60A /* TextLayers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextLayers.h; path = Classes/Samples/TextLayers.h; sourceTree = ""; }; 68 | DF7A2F7C123D689400BDD60A /* TextLayers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TextLayers.m; path = Classes/Samples/TextLayers.m; sourceTree = ""; }; 69 | DF7A2FA8123D6C3B00BDD60A /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = iphoneos4.0/System/Library/Frameworks/CoreText.framework; sourceTree = ""; }; 70 | DF7A2FAE123D6C5700BDD60A /* Delicious-Roman.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Delicious-Roman.otf"; sourceTree = ""; }; 71 | DF80136B10377A1200B48250 /* GradientLayers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GradientLayers.h; path = Classes/Samples/GradientLayers.h; sourceTree = ""; }; 72 | DF80136C10377A1200B48250 /* GradientLayers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = GradientLayers.m; path = Classes/Samples/GradientLayers.m; sourceTree = ""; }; 73 | DF8014A01038D12900B48250 /* CALayer+FTDebugDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+FTDebugDrawing.h"; sourceTree = ""; }; 74 | DF8014A11038D12900B48250 /* CALayer+FTDebugDrawing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer+FTDebugDrawing.m"; sourceTree = ""; }; 75 | DF8015601038E1C400B48250 /* LayerTransforms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerTransforms.h; path = Classes/Samples/LayerTransforms.h; sourceTree = ""; }; 76 | DF8015611038E1C400B48250 /* LayerTransforms.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = LayerTransforms.m; path = Classes/Samples/LayerTransforms.m; sourceTree = ""; }; 77 | DFAFBACD105EFF4200AE6FF1 /* LayerTransitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerTransitions.h; path = Classes/Samples/LayerTransitions.h; sourceTree = ""; }; 78 | DFAFBACE105EFF4200AE6FF1 /* LayerTransitions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = LayerTransitions.m; path = Classes/Samples/LayerTransitions.m; sourceTree = ""; }; 79 | DFB121611060279A00E7DB00 /* Mario.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Mario.png; sourceTree = ""; }; 80 | DFC6219E117399D700F5B5FD /* BitmapFontCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BitmapFontCounter.h; path = "Classes/Fun Stuff/BitmapFontCounter.h"; sourceTree = ""; }; 81 | DFC6219F117399D700F5B5FD /* BitmapFontCounter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = BitmapFontCounter.m; path = "Classes/Fun Stuff/BitmapFontCounter.m"; sourceTree = ""; }; 82 | DFC621E611745A1F00F5B5FD /* NumberStrip.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = NumberStrip.png; sourceTree = ""; }; 83 | DFEE3F45128C94CA0010106E /* CustomPropertyAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomPropertyAnimation.h; path = Classes/Samples/CustomPropertyAnimation.h; sourceTree = ""; }; 84 | DFEE3F46128C94CA0010106E /* CustomPropertyAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomPropertyAnimation.m; path = Classes/Samples/CustomPropertyAnimation.m; sourceTree = ""; }; 85 | DFF70C301039D8BC0052EE6A /* ImageContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageContent.h; path = Classes/Samples/ImageContent.h; sourceTree = ""; }; 86 | DFF70C311039D8BC0052EE6A /* ImageContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ImageContent.m; path = Classes/Samples/ImageContent.m; sourceTree = ""; }; 87 | DFF70C451039D9E60052EE6A /* FTSLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = FTSLogo.png; sourceTree = ""; }; 88 | DFF70C4C1039DA0A0052EE6A /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 89 | DFF70C4D1039DA0A0052EE6A /* CA360-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = "CA360-Info.plist"; sourceTree = ""; }; 90 | DFF70C9C1039DE170052EE6A /* Ben.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Ben.png; sourceTree = ""; }; 91 | DFF70C9D1039DE170052EE6A /* Steve.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Steve.png; sourceTree = ""; }; 92 | DFF70D131039F83E0052EE6A /* StyleProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleProperties.h; path = Classes/Samples/StyleProperties.h; sourceTree = ""; }; 93 | DFF70D141039F83E0052EE6A /* StyleProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = StyleProperties.m; path = Classes/Samples/StyleProperties.m; sourceTree = ""; }; 94 | DFF70D77103A0BB40052EE6A /* StarMask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = StarMask.png; sourceTree = ""; }; 95 | DFF70D9C103A104C0052EE6A /* LayerActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerActions.h; path = Classes/Samples/LayerActions.h; sourceTree = ""; }; 96 | DFF70D9D103A104C0052EE6A /* LayerActions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = LayerActions.m; path = Classes/Samples/LayerActions.m; sourceTree = ""; }; 97 | DFF70DA0103A10870052EE6A /* AnimationTransactions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationTransactions.h; path = Classes/Samples/AnimationTransactions.h; sourceTree = ""; }; 98 | DFF70DA1103A10870052EE6A /* AnimationTransactions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AnimationTransactions.m; path = Classes/Samples/AnimationTransactions.m; sourceTree = ""; }; 99 | DFF70DBE103A11DF0052EE6A /* AnimationGroups.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationGroups.h; path = Classes/Samples/AnimationGroups.h; sourceTree = ""; }; 100 | DFF70DBF103A11DF0052EE6A /* AnimationGroups.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AnimationGroups.m; path = Classes/Samples/AnimationGroups.m; sourceTree = ""; }; 101 | DFF7F2F4103602470067ED5B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 102 | DFF7F3AA103604580067ED5B /* LayerTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerTree.h; path = Classes/Samples/LayerTree.h; sourceTree = ""; }; 103 | DFF7F3AB103604580067ED5B /* LayerTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = LayerTree.m; path = Classes/Samples/LayerTree.m; sourceTree = ""; }; 104 | DFF7F3B2103605C80067ED5B /* SampleManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SampleManager.h; path = Samples/SampleManager.h; sourceTree = ""; }; 105 | DFF7F3B3103605C80067ED5B /* SampleManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SampleManager.m; path = Samples/SampleManager.m; sourceTree = ""; }; 106 | DFF7F583103623ED0067ED5B /* ShapeLayers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ShapeLayers.h; path = Classes/Samples/ShapeLayers.h; sourceTree = ""; }; 107 | DFF7F584103623ED0067ED5B /* ShapeLayers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ShapeLayers.m; path = Classes/Samples/ShapeLayers.m; sourceTree = ""; }; 108 | DFF7F5C3103626750067ED5B /* GeometricProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeometricProperties.h; path = Classes/Samples/GeometricProperties.h; sourceTree = ""; }; 109 | DFF7F5C4103626750067ED5B /* GeometricProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = GeometricProperties.m; path = Classes/Samples/GeometricProperties.m; sourceTree = ""; }; 110 | DFF7F610103632570067ED5B /* LayerDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerDrawing.h; path = Classes/Samples/LayerDrawing.h; sourceTree = ""; }; 111 | DFF7F611103632570067ED5B /* LayerDrawing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = LayerDrawing.m; path = Classes/Samples/LayerDrawing.m; sourceTree = ""; }; 112 | DFF7F614103632A90067ED5B /* BasicAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BasicAnimation.h; path = Classes/Samples/BasicAnimation.h; sourceTree = ""; }; 113 | DFF7F615103632A90067ED5B /* BasicAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = BasicAnimation.m; path = Classes/Samples/BasicAnimation.m; sourceTree = ""; }; 114 | DFF7F658103634C70067ED5B /* KeyframeAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyframeAnimation.h; path = Classes/Samples/KeyframeAnimation.h; sourceTree = ""; }; 115 | DFF7F659103634C70067ED5B /* KeyframeAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = KeyframeAnimation.m; path = Classes/Samples/KeyframeAnimation.m; sourceTree = ""; }; 116 | /* End PBXFileReference section */ 117 | 118 | /* Begin PBXFrameworksBuildPhase section */ 119 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 120 | isa = PBXFrameworksBuildPhase; 121 | buildActionMask = 2147483647; 122 | files = ( 123 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 124 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 125 | 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */, 126 | DFF7F2F6103602470067ED5B /* QuartzCore.framework in Frameworks */, 127 | DF7A2FA9123D6C3B00BDD60A /* CoreText.framework in Frameworks */, 128 | ); 129 | runOnlyForDeploymentPostprocessing = 0; 130 | }; 131 | /* End PBXFrameworksBuildPhase section */ 132 | 133 | /* Begin PBXGroup section */ 134 | 080E96DDFE201D6D7F000001 /* Core App Classes */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | DF64092411DD64D1002D1414 /* UsefulMacros.h */, 138 | 28C286DF0D94DF7D0034E888 /* RootViewController.h */, 139 | 28C286E00D94DF7D0034E888 /* RootViewController.m */, 140 | 1D3623240D0F684500981E51 /* CA360AppDelegate.h */, 141 | 1D3623250D0F684500981E51 /* CA360AppDelegate.m */, 142 | DFF7F3B2103605C80067ED5B /* SampleManager.h */, 143 | DFF7F3B3103605C80067ED5B /* SampleManager.m */, 144 | DF8014A01038D12900B48250 /* CALayer+FTDebugDrawing.h */, 145 | DF8014A11038D12900B48250 /* CALayer+FTDebugDrawing.m */, 146 | ); 147 | name = "Core App Classes"; 148 | path = Classes; 149 | sourceTree = ""; 150 | }; 151 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 1D6058910D05DD3D006BFB54 /* CA360.app */, 155 | ); 156 | name = Products; 157 | sourceTree = ""; 158 | }; 159 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | DFF7F3A9103603A50067ED5B /* Core Samples */, 163 | DF6091CE116E7B93005321DE /* Fun Stuff */, 164 | 080E96DDFE201D6D7F000001 /* Core App Classes */, 165 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 166 | DFF70C441039D9E60052EE6A /* Resources */, 167 | DF75ABFB116A8251006FF3EB /* Resources-iPad */, 168 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 169 | 19C28FACFE9D520D11CA2CBB /* Products */, 170 | ); 171 | name = CustomTemplate; 172 | sourceTree = ""; 173 | }; 174 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 28A0AAE50D9B0CCF005BE974 /* CA360_Prefix.pch */, 178 | 29B97316FDCFA39411CA2CEA /* main.m */, 179 | ); 180 | name = "Other Sources"; 181 | sourceTree = ""; 182 | }; 183 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | DF7A2FA8123D6C3B00BDD60A /* CoreText.framework */, 187 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 188 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 189 | 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */, 190 | DFF7F2F4103602470067ED5B /* QuartzCore.framework */, 191 | ); 192 | name = Frameworks; 193 | sourceTree = ""; 194 | }; 195 | DF6091CE116E7B93005321DE /* Fun Stuff */ = { 196 | isa = PBXGroup; 197 | children = ( 198 | DFC6219E117399D700F5B5FD /* BitmapFontCounter.h */, 199 | DFC6219F117399D700F5B5FD /* BitmapFontCounter.m */, 200 | DF6D1C3811C19AF200025ED7 /* ShutterTransition.h */, 201 | DF6D1C3911C19AF200025ED7 /* ShutterTransition.m */, 202 | ); 203 | name = "Fun Stuff"; 204 | sourceTree = ""; 205 | }; 206 | DF75ABFB116A8251006FF3EB /* Resources-iPad */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | DF75ABFC116A8252006FF3EB /* MainWindow-iPad.xib */, 210 | ); 211 | name = "Resources-iPad"; 212 | sourceTree = ""; 213 | }; 214 | DFF70C441039D9E60052EE6A /* Resources */ = { 215 | isa = PBXGroup; 216 | children = ( 217 | DF7A2FAE123D6C5700BDD60A /* Delicious-Roman.otf */, 218 | DFC621E611745A1F00F5B5FD /* NumberStrip.png */, 219 | DFB121611060279A00E7DB00 /* Mario.png */, 220 | DFF70C451039D9E60052EE6A /* FTSLogo.png */, 221 | DFF70C9C1039DE170052EE6A /* Ben.png */, 222 | DFF70C9D1039DE170052EE6A /* Steve.png */, 223 | DFF70D77103A0BB40052EE6A /* StarMask.png */, 224 | DFF70C4C1039DA0A0052EE6A /* MainWindow.xib */, 225 | DFF70C4D1039DA0A0052EE6A /* CA360-Info.plist */, 226 | ); 227 | path = Resources; 228 | sourceTree = ""; 229 | }; 230 | DFF7F3A9103603A50067ED5B /* Core Samples */ = { 231 | isa = PBXGroup; 232 | children = ( 233 | DFF7F65C103635380067ED5B /* Geometry & Transforms */, 234 | DFF7F65D1036354F0067ED5B /* Layer Hierarchy */, 235 | DFF7F65E103635690067ED5B /* Content & Style Properties */, 236 | DFF7F657103634AB0067ED5B /* Animation */, 237 | DFF7F65F103635840067ED5B /* Special Layer Types */, 238 | ); 239 | name = "Core Samples"; 240 | sourceTree = ""; 241 | }; 242 | DFF7F657103634AB0067ED5B /* Animation */ = { 243 | isa = PBXGroup; 244 | children = ( 245 | DFF7F614103632A90067ED5B /* BasicAnimation.h */, 246 | DFF7F615103632A90067ED5B /* BasicAnimation.m */, 247 | DFF7F658103634C70067ED5B /* KeyframeAnimation.h */, 248 | DFF7F659103634C70067ED5B /* KeyframeAnimation.m */, 249 | DFF70DBE103A11DF0052EE6A /* AnimationGroups.h */, 250 | DFF70DBF103A11DF0052EE6A /* AnimationGroups.m */, 251 | DFAFBACD105EFF4200AE6FF1 /* LayerTransitions.h */, 252 | DFAFBACE105EFF4200AE6FF1 /* LayerTransitions.m */, 253 | DFF70D9C103A104C0052EE6A /* LayerActions.h */, 254 | DFF70D9D103A104C0052EE6A /* LayerActions.m */, 255 | DFF70DA0103A10870052EE6A /* AnimationTransactions.h */, 256 | DFF70DA1103A10870052EE6A /* AnimationTransactions.m */, 257 | DFEE3F45128C94CA0010106E /* CustomPropertyAnimation.h */, 258 | DFEE3F46128C94CA0010106E /* CustomPropertyAnimation.m */, 259 | ); 260 | name = Animation; 261 | sourceTree = ""; 262 | }; 263 | DFF7F65C103635380067ED5B /* Geometry & Transforms */ = { 264 | isa = PBXGroup; 265 | children = ( 266 | DFF7F5C3103626750067ED5B /* GeometricProperties.h */, 267 | DFF7F5C4103626750067ED5B /* GeometricProperties.m */, 268 | DF8015601038E1C400B48250 /* LayerTransforms.h */, 269 | DF8015611038E1C400B48250 /* LayerTransforms.m */, 270 | ); 271 | name = "Geometry & Transforms"; 272 | sourceTree = ""; 273 | }; 274 | DFF7F65D1036354F0067ED5B /* Layer Hierarchy */ = { 275 | isa = PBXGroup; 276 | children = ( 277 | DFF7F3AA103604580067ED5B /* LayerTree.h */, 278 | DFF7F3AB103604580067ED5B /* LayerTree.m */, 279 | ); 280 | name = "Layer Hierarchy"; 281 | sourceTree = ""; 282 | }; 283 | DFF7F65E103635690067ED5B /* Content & Style Properties */ = { 284 | isa = PBXGroup; 285 | children = ( 286 | DFF70C301039D8BC0052EE6A /* ImageContent.h */, 287 | DFF70C311039D8BC0052EE6A /* ImageContent.m */, 288 | DFF7F610103632570067ED5B /* LayerDrawing.h */, 289 | DFF7F611103632570067ED5B /* LayerDrawing.m */, 290 | DFF70D131039F83E0052EE6A /* StyleProperties.h */, 291 | DFF70D141039F83E0052EE6A /* StyleProperties.m */, 292 | ); 293 | name = "Content & Style Properties"; 294 | sourceTree = ""; 295 | }; 296 | DFF7F65F103635840067ED5B /* Special Layer Types */ = { 297 | isa = PBXGroup; 298 | children = ( 299 | DFF7F583103623ED0067ED5B /* ShapeLayers.h */, 300 | DFF7F584103623ED0067ED5B /* ShapeLayers.m */, 301 | DF80136B10377A1200B48250 /* GradientLayers.h */, 302 | DF80136C10377A1200B48250 /* GradientLayers.m */, 303 | DF5FC6BE11C7FBD900130E6E /* AdvancedShapeLayers.h */, 304 | DF5FC6BF11C7FBD900130E6E /* AdvancedShapeLayers.m */, 305 | DF7A2F7B123D689400BDD60A /* TextLayers.h */, 306 | DF7A2F7C123D689400BDD60A /* TextLayers.m */, 307 | ); 308 | name = "Special Layer Types"; 309 | sourceTree = ""; 310 | }; 311 | /* End PBXGroup section */ 312 | 313 | /* Begin PBXNativeTarget section */ 314 | 1D6058900D05DD3D006BFB54 /* CA360 */ = { 315 | isa = PBXNativeTarget; 316 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "CA360" */; 317 | buildPhases = ( 318 | 1D60588D0D05DD3D006BFB54 /* Resources */, 319 | 1D60588E0D05DD3D006BFB54 /* Sources */, 320 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 321 | ); 322 | buildRules = ( 323 | ); 324 | dependencies = ( 325 | ); 326 | name = CA360; 327 | productName = CA360; 328 | productReference = 1D6058910D05DD3D006BFB54 /* CA360.app */; 329 | productType = "com.apple.product-type.application"; 330 | }; 331 | /* End PBXNativeTarget section */ 332 | 333 | /* Begin PBXProject section */ 334 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 335 | isa = PBXProject; 336 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CA360" */; 337 | compatibilityVersion = "Xcode 3.1"; 338 | developmentRegion = English; 339 | hasScannedForEncodings = 1; 340 | knownRegions = ( 341 | English, 342 | Japanese, 343 | French, 344 | German, 345 | en, 346 | ); 347 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 348 | projectDirPath = ""; 349 | projectRoot = ""; 350 | targets = ( 351 | 1D6058900D05DD3D006BFB54 /* CA360 */, 352 | ); 353 | }; 354 | /* End PBXProject section */ 355 | 356 | /* Begin PBXResourcesBuildPhase section */ 357 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 358 | isa = PBXResourcesBuildPhase; 359 | buildActionMask = 2147483647; 360 | files = ( 361 | DFF70C461039D9E60052EE6A /* FTSLogo.png in Resources */, 362 | DFF70C4F1039DA0A0052EE6A /* MainWindow.xib in Resources */, 363 | DFF70C9E1039DE170052EE6A /* Ben.png in Resources */, 364 | DFF70C9F1039DE170052EE6A /* Steve.png in Resources */, 365 | DFF70D78103A0BB40052EE6A /* StarMask.png in Resources */, 366 | DFB121621060279A00E7DB00 /* Mario.png in Resources */, 367 | DF75ABFD116A8252006FF3EB /* MainWindow-iPad.xib in Resources */, 368 | DFC621E711745A1F00F5B5FD /* NumberStrip.png in Resources */, 369 | DF7A2FAF123D6C5700BDD60A /* Delicious-Roman.otf in Resources */, 370 | ); 371 | runOnlyForDeploymentPostprocessing = 0; 372 | }; 373 | /* End PBXResourcesBuildPhase section */ 374 | 375 | /* Begin PBXSourcesBuildPhase section */ 376 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 377 | isa = PBXSourcesBuildPhase; 378 | buildActionMask = 2147483647; 379 | files = ( 380 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 381 | 1D3623260D0F684500981E51 /* CA360AppDelegate.m in Sources */, 382 | 28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */, 383 | DFF7F3AD103604580067ED5B /* LayerTree.m in Sources */, 384 | DFF7F3B5103605C80067ED5B /* SampleManager.m in Sources */, 385 | DFF7F585103623ED0067ED5B /* ShapeLayers.m in Sources */, 386 | DFF7F5C6103626750067ED5B /* GeometricProperties.m in Sources */, 387 | DFF7F613103632570067ED5B /* LayerDrawing.m in Sources */, 388 | DFF7F616103632A90067ED5B /* BasicAnimation.m in Sources */, 389 | DFF7F65B103634C70067ED5B /* KeyframeAnimation.m in Sources */, 390 | DF80136E10377A1200B48250 /* GradientLayers.m in Sources */, 391 | DF8014A31038D12900B48250 /* CALayer+FTDebugDrawing.m in Sources */, 392 | DF8015631038E1C400B48250 /* LayerTransforms.m in Sources */, 393 | DFF70C321039D8BC0052EE6A /* ImageContent.m in Sources */, 394 | DFF70D151039F83E0052EE6A /* StyleProperties.m in Sources */, 395 | DFF70D9E103A104C0052EE6A /* LayerActions.m in Sources */, 396 | DFF70DA2103A10870052EE6A /* AnimationTransactions.m in Sources */, 397 | DFF70DC0103A11DF0052EE6A /* AnimationGroups.m in Sources */, 398 | DFAFBACF105EFF4200AE6FF1 /* LayerTransitions.m in Sources */, 399 | DFC621A0117399D700F5B5FD /* BitmapFontCounter.m in Sources */, 400 | DF6D1C3A11C19AF200025ED7 /* ShutterTransition.m in Sources */, 401 | DF5FC6C011C7FBD900130E6E /* AdvancedShapeLayers.m in Sources */, 402 | DF7A2F7D123D689400BDD60A /* TextLayers.m in Sources */, 403 | DFEE3F47128C94CA0010106E /* CustomPropertyAnimation.m in Sources */, 404 | ); 405 | runOnlyForDeploymentPostprocessing = 0; 406 | }; 407 | /* End PBXSourcesBuildPhase section */ 408 | 409 | /* Begin XCBuildConfiguration section */ 410 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | ALWAYS_SEARCH_USER_PATHS = NO; 414 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 415 | CODE_SIGN_IDENTITY = "iPhone Developer"; 416 | COPY_PHASE_STRIP = NO; 417 | GCC_DYNAMIC_NO_PIC = NO; 418 | GCC_OPTIMIZATION_LEVEL = 0; 419 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 420 | GCC_PREFIX_HEADER = CA360_Prefix.pch; 421 | GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; 422 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 423 | HEADER_SEARCH_PATHS = ""; 424 | INFOPLIST_FILE = "Resources/CA360-Info.plist"; 425 | IPHONEOS_DEPLOYMENT_TARGET = 4.2; 426 | ONLY_ACTIVE_ARCH = YES; 427 | OTHER_CFLAGS = ""; 428 | PRODUCT_NAME = CA360; 429 | PROVISIONING_PROFILE = ""; 430 | SDKROOT = iphoneos; 431 | TARGETED_DEVICE_FAMILY = "1,2"; 432 | }; 433 | name = Debug; 434 | }; 435 | 1D6058950D05DD3E006BFB54 /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ALWAYS_SEARCH_USER_PATHS = NO; 439 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 440 | CODE_SIGN_IDENTITY = ""; 441 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 442 | COPY_PHASE_STRIP = YES; 443 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 444 | GCC_PREFIX_HEADER = CA360_Prefix.pch; 445 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 446 | HEADER_SEARCH_PATHS = ""; 447 | INFOPLIST_FILE = "CA360-Info.plist"; 448 | IPHONEOS_DEPLOYMENT_TARGET = 4.2; 449 | PRODUCT_NAME = CA360; 450 | SDKROOT = iphoneos; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | }; 453 | name = Release; 454 | }; 455 | C01FCF4F08A954540054247B /* Debug */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 459 | CODE_SIGN_IDENTITY = "iPhone Developer"; 460 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 461 | COPY_PHASE_STRIP = NO; 462 | GCC_C_LANGUAGE_STANDARD = c99; 463 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 464 | GCC_PREFIX_HEADER = CA360_Prefix.pch; 465 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 466 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 467 | GCC_WARN_UNUSED_VARIABLE = YES; 468 | IPHONEOS_DEPLOYMENT_TARGET = 4.2; 469 | ONLY_ACTIVE_ARCH = YES; 470 | PREBINDING = NO; 471 | PROVISIONING_PROFILE = ""; 472 | RUN_CLANG_STATIC_ANALYZER = YES; 473 | SDKROOT = iphoneos; 474 | TARGETED_DEVICE_FAMILY = "1,2"; 475 | }; 476 | name = Debug; 477 | }; 478 | C01FCF5008A954540054247B /* Release */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 482 | CODE_SIGN_IDENTITY = ""; 483 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 484 | GCC_C_LANGUAGE_STANDARD = c99; 485 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 486 | GCC_PREFIX_HEADER = CA360_Prefix.pch; 487 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 488 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 489 | GCC_WARN_UNUSED_VARIABLE = YES; 490 | IPHONEOS_DEPLOYMENT_TARGET = 4.2; 491 | PREBINDING = NO; 492 | RUN_CLANG_STATIC_ANALYZER = YES; 493 | SDKROOT = iphoneos; 494 | TARGETED_DEVICE_FAMILY = "1,2"; 495 | }; 496 | name = Release; 497 | }; 498 | /* End XCBuildConfiguration section */ 499 | 500 | /* Begin XCConfigurationList section */ 501 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "CA360" */ = { 502 | isa = XCConfigurationList; 503 | buildConfigurations = ( 504 | 1D6058940D05DD3E006BFB54 /* Debug */, 505 | 1D6058950D05DD3E006BFB54 /* Release */, 506 | ); 507 | defaultConfigurationIsVisible = 0; 508 | defaultConfigurationName = Release; 509 | }; 510 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CA360" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | C01FCF4F08A954540054247B /* Debug */, 514 | C01FCF5008A954540054247B /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | defaultConfigurationName = Release; 518 | }; 519 | /* End XCConfigurationList section */ 520 | }; 521 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 522 | } 523 | -------------------------------------------------------------------------------- /CA360_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | #import 25 | 26 | #ifndef __IPHONE_3_0 27 | #warning "This project uses features only available in iPhone SDK 3.0 and later." 28 | #endif 29 | 30 | 31 | #ifdef __OBJC__ 32 | #import 33 | #import 34 | #import 35 | #import "UsefulMacros.h" 36 | #endif 37 | -------------------------------------------------------------------------------- /Classes/CA360AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @class RootViewController; 26 | 27 | @interface CA360AppDelegate : NSObject { 28 | UIWindow *window_; 29 | UINavigationController *navigationController_; 30 | RootViewController *rootViewController_; 31 | } 32 | 33 | @property(nonatomic,retain) IBOutlet UIWindow *window; 34 | @property(nonatomic,retain) UINavigationController *navigationController; 35 | @property(nonatomic,retain) RootViewController *rootViewController; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /Classes/CA360AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | #import "CA360AppDelegate.h" 25 | #import "RootViewController.h" 26 | 27 | 28 | @implementation CA360AppDelegate 29 | 30 | @synthesize window = window_; 31 | @synthesize navigationController = navigationController_; 32 | @synthesize rootViewController = rootViewController_; 33 | 34 | 35 | #pragma mark - 36 | #pragma mark Application lifecycle 37 | 38 | - (void)applicationDidFinishLaunching:(UIApplication *)application { 39 | rootViewController_ = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped]; 40 | navigationController_ = [[UINavigationController alloc] initWithRootViewController:rootViewController_]; 41 | 42 | [window_ addSubview:navigationController_.view]; 43 | [window_ makeKeyAndVisible]; 44 | } 45 | 46 | 47 | #pragma mark - 48 | #pragma mark Memory management 49 | 50 | - (void)dealloc { 51 | [rootViewController_ release], rootViewController_ = nil; 52 | [navigationController_ release], navigationController_ = nil; 53 | [window_ release], window_ = nil; 54 | [super dealloc]; 55 | } 56 | 57 | @end 58 | 59 | -------------------------------------------------------------------------------- /Classes/CALayer+FTDebugDrawing.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @interface CALayer (FTDebugDrawing) 26 | 27 | - (void)debugDrawPoint:(CGPoint)point inContext:(CGContextRef)context withSize:(CGSize)size color:(UIColor *)color; 28 | - (void)debugDrawAnchorPointInContext:(CGContextRef)context withSize:(CGSize)size color:(UIColor *)color; 29 | - (void)debugDrawBoundingBoxInContext:(CGContextRef)context withLineWidth:(CGFloat)lineWidth color:(UIColor *)color; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Classes/CALayer+FTDebugDrawing.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "CALayer+FTDebugDrawing.h" 26 | 27 | 28 | @implementation CALayer (FTDebugDrawing) 29 | 30 | - (void)debugDrawPoint:(CGPoint)point inContext:(CGContextRef)context withSize:(CGSize)size color:(UIColor *)color { 31 | CGRect rect = CGRectMake(point.x - (size.width / 2), point.y - (size.height / 2), size.width, size.height); 32 | CGContextAddEllipseInRect(context, rect); 33 | CGContextSetFillColorWithColor(context, [color CGColor]); 34 | CGContextDrawPath(context, kCGPathFill); 35 | } 36 | 37 | - (void)debugDrawAnchorPointInContext:(CGContextRef)context withSize:(CGSize)size color:(UIColor *)color { 38 | CGSize layerSize = self.bounds.size; 39 | CGPoint layerOrigin = self.bounds.origin; 40 | CGPoint realAnchorPoint = CGPointMake(layerOrigin.x + (layerSize.width * self.anchorPoint.x), 41 | layerOrigin.y + (layerSize.height * self.anchorPoint.y)); 42 | [self debugDrawPoint:realAnchorPoint inContext:context withSize:size color:color]; 43 | } 44 | 45 | - (void)debugDrawBoundingBoxInContext:(CGContextRef)context withLineWidth:(CGFloat)lineWidth color:(UIColor *)color { 46 | CGContextAddRect(context, self.bounds); 47 | CGContextSetStrokeColorWithColor(context, [color CGColor]); 48 | CGContextSetLineWidth(context, lineWidth); 49 | CGContextDrawPath(context, kCGPathStroke); 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Classes/Fun Stuff/BitmapFontCounter.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface CounterView : UIView { 28 | NSString *numberString_; 29 | double number_; 30 | NSMutableArray *digitLayers_; 31 | } 32 | 33 | @property(assign) double number; 34 | 35 | - (CounterView *)initWithNumber:(double)num; 36 | - (CALayer *)layerForDigitAtIndex:(NSUInteger)index; 37 | 38 | @end 39 | 40 | @interface BitmapFontCounter : UIViewController { 41 | CounterView *counter_; 42 | UIButton *setNumberButton_; 43 | UITextField *textField_; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Classes/Fun Stuff/BitmapFontCounter.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2011 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BitmapFontCounter.h" 26 | 27 | static const CGFloat kDigitWidth = 32.f; 28 | static const CGFloat kDigitHeight = 26.f; 29 | static const unichar kCharacterOffset = 48; 30 | 31 | 32 | @implementation CounterView 33 | 34 | - (CounterView *)initWithNumber:(double)num { 35 | if ((self = [super initWithFrame:CGRectMake(0.f, 0.f, kDigitWidth, kDigitHeight)])) { 36 | digitLayers_ = [[NSMutableArray alloc] init]; 37 | [self setNumber:num]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [numberString_ release], numberString_ = nil; 44 | [digitLayers_ release], digitLayers_ = nil; 45 | [super dealloc]; 46 | } 47 | 48 | - (double)number { 49 | return number_; 50 | } 51 | 52 | - (void)setNumber:(double)num { 53 | number_ = num; 54 | [digitLayers_ makeObjectsPerformSelector:@selector(removeFromSuperlayer)]; 55 | [numberString_ release], numberString_ = nil; 56 | numberString_ = [[NSString stringWithFormat:@"%.0F", num] retain]; 57 | 58 | NSUInteger count = [numberString_ length]; 59 | [self setBounds:CGRectMake(0.f, 0.f, (CGFloat)count * kDigitWidth, kDigitHeight)]; 60 | 61 | for(NSUInteger i = 0; i < count; i++) { 62 | CALayer *theLayer = [self layerForDigitAtIndex:i]; 63 | int theNumber = (int)([numberString_ characterAtIndex:i] - kCharacterOffset); 64 | if(theNumber < 0) { 65 | theNumber = 10; 66 | } 67 | CGFloat height = 1.f/11.f; 68 | CGFloat width = 1.f; 69 | CGRect contentsRect = CGRectMake(0.f, theNumber * height, width, height); 70 | 71 | [CATransaction begin]; 72 | [CATransaction setDisableActions:YES]; 73 | theLayer.frame = CGRectMake(kDigitWidth * i, 0.f, kDigitWidth, kDigitHeight); 74 | [CATransaction begin]; 75 | [CATransaction setDisableActions:(theNumber == 10)]; 76 | theLayer.contentsRect = contentsRect; 77 | [CATransaction commit]; 78 | [CATransaction commit]; 79 | 80 | [self.layer addSublayer:theLayer]; 81 | } 82 | } 83 | 84 | - (CALayer *)layerForDigitAtIndex:(NSUInteger)index { 85 | CALayer *theLayer; 86 | if(index >= [digitLayers_ count] || 87 | (theLayer = [digitLayers_ objectAtIndex:index]) == nil) 88 | { 89 | theLayer = [CALayer layer]; 90 | theLayer.anchorPoint = CGPointZero; 91 | theLayer.masksToBounds = YES; 92 | theLayer.frame = CGRectMake(0.f, 0.f, kDigitWidth, kDigitHeight); 93 | theLayer.contentsGravity = kCAGravityCenter; 94 | theLayer.contents = (id)[[UIImage imageNamed:@"NumberStrip.png"] CGImage]; 95 | 96 | CGFloat height = 1.f/11.f; 97 | CGFloat width = 1.f; 98 | theLayer.contentsRect = CGRectMake(0.f, height, width, height); 99 | 100 | [digitLayers_ insertObject:theLayer atIndex:index]; 101 | } 102 | return theLayer; 103 | } 104 | 105 | 106 | @end 107 | 108 | 109 | @implementation BitmapFontCounter 110 | 111 | + (NSString *)friendlyName { 112 | return @"Bitmap Font Counter"; 113 | } 114 | 115 | #pragma mark init and dealloc 116 | 117 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 118 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 119 | self.title = [[self class] friendlyName]; 120 | } 121 | return self; 122 | } 123 | 124 | - (void)dealloc { 125 | [counter_ release], counter_ = nil; 126 | [textField_ release], textField_ = nil; 127 | [setNumberButton_ release], setNumberButton_ = nil; 128 | [super dealloc]; 129 | } 130 | 131 | #pragma mark Event Handlers 132 | - (void)updateNumber:(id)sender { 133 | [counter_ setNumber:[textField_.text doubleValue]]; 134 | } 135 | 136 | #pragma mark Load and unload the view 137 | 138 | - (void)loadView { 139 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 140 | myView.backgroundColor = [UIColor whiteColor]; 141 | 142 | setNumberButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 143 | setNumberButton_.frame = CGRectMake(10., 56., 300., 36.); 144 | [setNumberButton_ setTitle:@"Update Number" forState:UIControlStateNormal]; 145 | [setNumberButton_ addTarget:self action:@selector(updateNumber:) forControlEvents:UIControlEventTouchUpInside]; 146 | [myView addSubview:setNumberButton_]; 147 | 148 | textField_ = [[UITextField alloc] initWithFrame:CGRectMake(10., 10., 300., 36.)]; 149 | textField_.keyboardType = UIKeyboardTypeNumbersAndPunctuation; 150 | textField_.clearButtonMode = UITextFieldViewModeWhileEditing; 151 | textField_.borderStyle = UITextBorderStyleRoundedRect; 152 | textField_.text = @"1919"; 153 | [myView addSubview:textField_]; 154 | 155 | counter_ = [[CounterView alloc] initWithNumber:1919.f]; 156 | counter_.center = CGPointMake(160.f, 160.f); 157 | [myView addSubview:counter_]; 158 | 159 | self.view = myView; 160 | } 161 | 162 | - (void)viewDidAppear:(BOOL)animated { 163 | [textField_ becomeFirstResponder]; 164 | } 165 | 166 | @end 167 | -------------------------------------------------------------------------------- /Classes/Fun Stuff/ShutterTransition.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface ShutterTransition : UIViewController { 28 | CALayer *mainLayer_; 29 | UIButton *goButton_; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Fun Stuff/ShutterTransition.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "ShutterTransition.h" 26 | 27 | #define USE_FLATTENED_LAYER 0 28 | #define BAND_COUNT 7 29 | 30 | @implementation ShutterTransition 31 | 32 | + (NSString *)friendlyName { 33 | return @"Shutter Transition"; 34 | } 35 | 36 | #pragma mark init and dealloc 37 | 38 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 39 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 40 | self.title = [[self class] friendlyName]; 41 | } 42 | return self; 43 | } 44 | 45 | - (void)dealloc { 46 | [goButton_ release], goButton_ = nil; 47 | [mainLayer_ release], mainLayer_ = nil; 48 | [super dealloc]; 49 | } 50 | 51 | #pragma mark Load and unload the view 52 | 53 | - (void)viewDidLoad { 54 | self.view.backgroundColor = [UIColor whiteColor]; 55 | 56 | mainLayer_ = [[CALayer alloc] init]; 57 | 58 | [self.view.layer addSublayer:mainLayer_]; 59 | 60 | goButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 61 | goButton_.frame = CGRectMake(10., 10., 300., 44.); 62 | [goButton_ setTitle:@"Shutter Transition!" forState:UIControlStateNormal]; 63 | [goButton_ addTarget:self action:@selector(doShutterTransition) forControlEvents:UIControlEventTouchUpInside]; 64 | [self.view addSubview:goButton_]; 65 | 66 | } 67 | 68 | - (void)viewDidUnload { 69 | [mainLayer_ release], mainLayer_ = nil; 70 | [goButton_ release], goButton_ = nil; 71 | } 72 | 73 | - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { 74 | CGContextAddEllipseInRect(ctx, mainLayer_.bounds); 75 | CGContextSetStrokeColorWithColor(ctx, [[UIColor blackColor] CGColor]); 76 | CGContextSetLineWidth(ctx, 4.f); 77 | CGContextDrawPath(ctx, kCGPathStroke); 78 | } 79 | 80 | #pragma mark View drawing 81 | 82 | - (void)viewWillAppear:(BOOL)animated { 83 | mainLayer_.delegate = self; 84 | mainLayer_.bounds = CGRectMake(0.f, 0.f, 200.f, 200.f); 85 | mainLayer_.backgroundColor = [[UIColor blueColor] CGColor]; 86 | mainLayer_.position = self.view.center; 87 | [mainLayer_ setNeedsDisplay]; 88 | } 89 | 90 | - (void)viewWillDisappear:(BOOL)animated { 91 | mainLayer_.delegate = nil; 92 | } 93 | 94 | #pragma mark - 95 | #pragma mark Event Handlers 96 | 97 | - (void)doShutterTransition { 98 | CGSize layerSize = mainLayer_.bounds.size; 99 | 100 | #if USE_FLATTENED_LAYER 101 | //Grab the bits from the layer 102 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 103 | CGContextRef context = CGBitmapContextCreate(NULL, (int)layerSize.width, (int)layerSize.height, 8, (int)layerSize.width * 4, colorSpace, kCGImageAlphaPremultipliedLast); 104 | 105 | [mainLayer_ renderInContext:context]; 106 | UIImage *layerImage = [UIImage imageWithCGImage:CGBitmapContextCreateImage(context)]; 107 | #endif 108 | 109 | //Set up a single instance of the slide animations to be reused in the bands 110 | CABasicAnimation *slideUp = [CABasicAnimation animationWithKeyPath:@"position.y"]; 111 | slideUp.toValue = [NSNumber numberWithFloat:-(mainLayer_.frame.size.height / 2.f)]; 112 | slideUp.duration = 1.f; 113 | slideUp.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 114 | slideUp.fillMode = kCAFillModeForwards; 115 | 116 | CABasicAnimation *slideDown = [CABasicAnimation animationWithKeyPath:@"position.y"]; 117 | slideDown.toValue = [NSNumber numberWithFloat:(mainLayer_.frame.size.height / 2.f) + [UIScreen mainScreen].bounds.size.height]; 118 | slideDown.duration = 1.f; 119 | slideDown.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 120 | slideDown.fillMode = kCAFillModeForwards; 121 | 122 | NSMutableArray *bands = [[NSMutableArray alloc] initWithCapacity:BAND_COUNT]; 123 | 124 | [mainLayer_ removeFromSuperlayer]; 125 | [CATransaction begin]; 126 | [CATransaction setCompletionBlock:^(void) { 127 | [bands enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 128 | [obj setDelegate:nil]; 129 | [obj removeFromSuperlayer]; 130 | }]; 131 | [self.view.layer addSublayer:mainLayer_]; 132 | }]; 133 | 134 | CGFloat bandWidth = layerSize.width / (CGFloat)BAND_COUNT; 135 | for(int i = 0; i < BAND_COUNT; i++) { 136 | CALayer *band = [[CALayer alloc] init]; 137 | band.masksToBounds = YES; 138 | 139 | #if USE_FLATTENED_LAYER 140 | CGFloat xOffset = 1.f / (CGFloat)BAND_COUNT; 141 | band.bounds = CGRectMake(0.f, 0.f, bandWidth, layerSize.height); 142 | band.contents = (id)[layerImage CGImage]; 143 | band.contentsGravity = kCAGravityCenter; 144 | band.contentsRect = CGRectMake(xOffset * i , 0.f, xOffset, 1.f); 145 | #else 146 | band.bounds = CGRectMake(bandWidth * i, 0.f, bandWidth, layerSize.height); 147 | band.backgroundColor = mainLayer_.backgroundColor; 148 | band.delegate = self; 149 | [band setNeedsDisplay]; 150 | #endif 151 | 152 | CGPoint bandOrigin = mainLayer_.frame.origin; 153 | bandOrigin.x = bandOrigin.x + (bandWidth * i); 154 | [band setValue:[NSValue valueWithCGPoint:bandOrigin] forKeyPath:@"frame.origin"]; 155 | 156 | [self.view.layer addSublayer:band]; 157 | 158 | [band addAnimation:(i % 2) ? slideUp : slideDown forKey:nil]; 159 | [bands addObject:band]; 160 | [band release]; 161 | } 162 | [CATransaction commit]; 163 | 164 | [bands release]; 165 | 166 | #if USE_FLATTENED_LAYER 167 | CGColorSpaceRelease(colorSpace); 168 | CGContextRelease(context); 169 | #endif 170 | } 171 | 172 | 173 | @end 174 | -------------------------------------------------------------------------------- /Classes/RootViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | @class SampleManager; 26 | 27 | @interface RootViewController : UITableViewController { 28 | SampleManager *sampleManager_; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Classes/RootViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "RootViewController.h" 26 | #import "SampleManager.h" 27 | 28 | @implementation RootViewController 29 | 30 | - (void)dealloc { 31 | [sampleManager_ release], sampleManager_ = nil; 32 | [super dealloc]; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | sampleManager_ = [[SampleManager alloc] init]; 37 | self.title = @"Samples"; 38 | } 39 | 40 | - (void)viewDidUnload { 41 | [sampleManager_ release], sampleManager_ = nil; 42 | } 43 | 44 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 45 | return [sampleManager_ groupCount]; 46 | } 47 | 48 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 49 | return [sampleManager_ sampleCountForGroup:section]; 50 | } 51 | 52 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 53 | return [sampleManager_ groupTitleAtIndex:section]; 54 | } 55 | 56 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 57 | 58 | NSString *theTitle = [sampleManager_ sampleNameAtIndexPath:indexPath]; 59 | 60 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:theTitle]; 61 | if (cell == nil) { 62 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:theTitle] autorelease]; 63 | } 64 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 65 | cell.textLabel.text = theTitle; 66 | return cell; 67 | } 68 | 69 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 70 | [self.navigationController pushViewController:[sampleManager_ sampleForIndexPath:indexPath] animated:YES]; 71 | } 72 | 73 | @end 74 | 75 | -------------------------------------------------------------------------------- /Classes/Samples/AdvancedShapeLayers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface AdvancedShapeLayers : UIViewController { 28 | CAShapeLayer *shapeLayer_; 29 | CGFloat currentArc; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Samples/AdvancedShapeLayers.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "AdvancedShapeLayers.h" 26 | 27 | @implementation AdvancedShapeLayers 28 | 29 | + (NSString *)friendlyName { 30 | return @"Advanced Shape Layers"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [shapeLayer_ release], shapeLayer_ = nil; 44 | [super dealloc]; 45 | } 46 | 47 | #pragma mark Load and unload the view 48 | 49 | - (void)loadView { 50 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 51 | myView.backgroundColor = [UIColor whiteColor]; 52 | 53 | shapeLayer_ = [[CAShapeLayer alloc] init]; 54 | [myView.layer addSublayer:shapeLayer_]; 55 | 56 | self.view = myView; 57 | } 58 | 59 | - (void)viewDidUnload { 60 | [shapeLayer_ release], shapeLayer_ = nil; 61 | } 62 | 63 | #pragma mark View drawing 64 | 65 | - (void)drawPathWithArc:(CGFloat)arc { 66 | CGMutablePathRef thePath = CGPathCreateMutable(); 67 | CGPathMoveToPoint(thePath, NULL, 100.f, 100.f); 68 | CGPathAddLineToPoint(thePath, NULL, 200.f, 100.f); 69 | CGPathAddArc(thePath, NULL, 100.f, 100.f, 100.f, 0.f, arc, NO); 70 | CGPathCloseSubpath(thePath); 71 | shapeLayer_.path = thePath; 72 | CGPathRelease(thePath); 73 | } 74 | 75 | - (void)viewWillAppear:(BOOL)animated { 76 | shapeLayer_.bounds = CGRectMake(0.f, 0.f, 200.f, 200.f); 77 | shapeLayer_.position = self.view.center; 78 | shapeLayer_.strokeColor = [[UIColor blueColor] CGColor]; 79 | shapeLayer_.lineWidth = 4.f; 80 | shapeLayer_.fillColor = [[UIColor yellowColor] CGColor]; 81 | currentArc = M_PI_2; 82 | [self drawPathWithArc:currentArc]; 83 | } 84 | 85 | - (void)updatePath:(CADisplayLink *)displayLink { 86 | currentArc = fminf(currentArc * 1.1f, M_PI * 1.5f); 87 | [self drawPathWithArc:currentArc]; 88 | if(currentArc >= M_PI * 1.5f) { 89 | [displayLink invalidate]; 90 | } 91 | } 92 | 93 | - (void)viewDidAppear:(BOOL)animated { 94 | CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(updatePath:)]; 95 | [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Classes/Samples/AnimationGroups.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface AnimationGroups : UIViewController { 28 | CALayer *pulseLayer_; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Classes/Samples/AnimationGroups.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "AnimationGroups.h" 26 | 27 | @implementation AnimationGroups 28 | 29 | + (NSString *)friendlyName { 30 | return @"Animation Groups"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [pulseLayer_ release], pulseLayer_ = nil; 44 | [super dealloc]; 45 | } 46 | 47 | #pragma mark Load and unload the view 48 | 49 | - (void)loadView { 50 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 51 | myView.backgroundColor = [UIColor whiteColor]; 52 | 53 | pulseLayer_ = [[CALayer layer] retain]; 54 | [myView.layer addSublayer:pulseLayer_]; 55 | 56 | self.view = myView; 57 | } 58 | 59 | 60 | #pragma mark View drawing 61 | 62 | - (void)viewWillAppear:(BOOL)animated { 63 | pulseLayer_.backgroundColor = [UIColorFromRGBA(0x000000, .75) CGColor]; 64 | pulseLayer_.bounds = CGRectMake(0., 0., 200., 200.); 65 | pulseLayer_.cornerRadius = 12.; 66 | pulseLayer_.position = self.view.center; 67 | [pulseLayer_ setNeedsDisplay]; 68 | } 69 | 70 | - (void)viewDidAppear:(BOOL)animated { 71 | CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 72 | pulseAnimation.duration = 2.; 73 | pulseAnimation.toValue = [NSNumber numberWithFloat:1.15]; 74 | 75 | CABasicAnimation *pulseColorAnimation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"]; 76 | pulseColorAnimation.duration = 1.; 77 | pulseColorAnimation.fillMode = kCAFillModeForwards; 78 | pulseColorAnimation.toValue = (id)[UIColorFromRGBA(0xFF0000, .75) CGColor]; 79 | 80 | CABasicAnimation *rotateLayerAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; 81 | rotateLayerAnimation.duration = .5; 82 | rotateLayerAnimation.beginTime = .5; 83 | rotateLayerAnimation.fillMode = kCAFillModeBoth; 84 | rotateLayerAnimation.toValue = [NSNumber numberWithFloat:DEGREES_TO_RADIANS(45.)]; 85 | 86 | CAAnimationGroup *group = [CAAnimationGroup animation]; 87 | group.animations = [NSArray arrayWithObjects:pulseAnimation, pulseColorAnimation, rotateLayerAnimation, nil]; 88 | group.duration = 2.; 89 | group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 90 | group.autoreverses = YES; 91 | group.repeatCount = FLT_MAX; 92 | 93 | [pulseLayer_ addAnimation:group forKey:nil]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Classes/Samples/AnimationTransactions.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface AnimationTransactions : UIViewController { 29 | CALayer *blueLayer_; 30 | CALayer *redLayer_; 31 | 32 | UIButton *runButton_; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Classes/Samples/AnimationTransactions.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "AnimationTransactions.h" 26 | 27 | @implementation AnimationTransactions 28 | 29 | + (NSString *)friendlyName { 30 | return @"Animation Transactions"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [blueLayer_ release], blueLayer_ = nil; 44 | [redLayer_ release], redLayer_ = nil; 45 | [runButton_ release], runButton_ = nil; 46 | [super dealloc]; 47 | } 48 | 49 | #pragma mark Load and unload the view 50 | 51 | - (void)loadView { 52 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 53 | myView.backgroundColor = [UIColor whiteColor]; 54 | 55 | runButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 56 | runButton_.frame = CGRectMake(10., 10., 300., 44.); 57 | [runButton_ setTitle:@"Run Animation" forState:UIControlStateNormal]; 58 | [runButton_ addTarget:self action:@selector(toggleRun:) forControlEvents:UIControlEventTouchUpInside]; 59 | [myView addSubview:runButton_]; 60 | 61 | blueLayer_ = [[CALayer layer] retain]; 62 | redLayer_ = [[CALayer layer] retain]; 63 | 64 | [myView.layer addSublayer:blueLayer_]; 65 | [myView.layer addSublayer:redLayer_]; 66 | self.view = myView; 67 | } 68 | 69 | #pragma mark View drawing 70 | 71 | - (void)viewWillAppear:(BOOL)animated { 72 | CGRect rect = CGRectMake(0., 0., 100., 100.); 73 | blueLayer_.backgroundColor = [UIColorFromRGBA(0x0000FF, .75) CGColor]; 74 | blueLayer_.bounds = rect; 75 | blueLayer_.position = CGPointMake(50., 50.); 76 | blueLayer_.cornerRadius = 10.; 77 | [blueLayer_ setNeedsDisplay]; 78 | 79 | redLayer_.backgroundColor = [UIColorFromRGBA(0xFF0000, .75) CGColor]; 80 | redLayer_.bounds = rect; 81 | CGSize viewSize = self.view.bounds.size; 82 | redLayer_.position = CGPointMake(viewSize.width - 50., viewSize.height - 50.); 83 | redLayer_.cornerRadius = 10.; 84 | [redLayer_ setNeedsDisplay]; 85 | } 86 | 87 | - (void)viewDidAppear:(BOOL)animated { 88 | } 89 | 90 | #pragma mark Event Handlers 91 | 92 | - (void)toggleRun:(id)sender { 93 | [redLayer_ removeAnimationForKey:@"changePosition"]; 94 | [blueLayer_ removeAnimationForKey:@"changePosition"]; 95 | [CATransaction begin]; 96 | { 97 | [CATransaction setAnimationDuration:1.]; 98 | [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; 99 | 100 | CABasicAnimation *moveRed = [CABasicAnimation animationWithKeyPath:@"position"]; 101 | moveRed.toValue = [NSValue valueWithCGPoint:CGPointMake(75., self.view.center.y)]; 102 | [redLayer_ addAnimation:moveRed forKey:@"changePosition"]; 103 | 104 | [CATransaction begin]; 105 | { 106 | [CATransaction setAnimationDuration:2.]; 107 | [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; 108 | CABasicAnimation *moveBlue = [CABasicAnimation animationWithKeyPath:@"position"]; 109 | CGSize viewSize = self.view.bounds.size; 110 | moveBlue.toValue = [NSValue valueWithCGPoint:CGPointMake(viewSize.width - 75., self.view.center.y)]; 111 | [blueLayer_ addAnimation:moveBlue forKey:@"changePosition"]; 112 | } 113 | [CATransaction commit]; 114 | 115 | } 116 | [CATransaction commit]; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /Classes/Samples/BasicAnimation.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface BasicAnimation : UIViewController { 29 | CALayer *pulseLayer_; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Samples/BasicAnimation.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "BasicAnimation.h" 26 | 27 | @implementation BasicAnimation 28 | 29 | + (NSString *)friendlyName { 30 | return @"Basic Animation"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [pulseLayer_ release], pulseLayer_ = nil; 44 | [super dealloc]; 45 | } 46 | 47 | #pragma mark Load and unload the view 48 | 49 | - (void)loadView { 50 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 51 | myView.backgroundColor = [UIColor whiteColor]; 52 | 53 | pulseLayer_ = [[CALayer layer] retain]; 54 | [myView.layer addSublayer:pulseLayer_]; 55 | 56 | self.view = myView; 57 | } 58 | 59 | #pragma mark View drawing 60 | 61 | - (void)viewWillAppear:(BOOL)animated { 62 | pulseLayer_.backgroundColor = [UIColorFromRGBA(0x000000, .75) CGColor]; 63 | pulseLayer_.bounds = CGRectMake(0., 0., 260., 260.); 64 | pulseLayer_.cornerRadius = 12.; 65 | pulseLayer_.position = self.view.center; 66 | [pulseLayer_ setNeedsDisplay]; 67 | } 68 | 69 | - (void)viewDidAppear:(BOOL)animated { 70 | CABasicAnimation *pulseAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 71 | pulseAnimation.duration = .5; 72 | pulseAnimation.toValue = [NSNumber numberWithFloat:1.1]; 73 | pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 74 | pulseAnimation.autoreverses = YES; 75 | pulseAnimation.repeatCount = FLT_MAX; 76 | 77 | [pulseLayer_ addAnimation:pulseAnimation forKey:nil]; 78 | } 79 | 80 | @end 81 | 82 | 83 | -------------------------------------------------------------------------------- /Classes/Samples/CustomPropertyAnimation.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2010 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @class CustomLayer; 28 | 29 | @interface CustomPropertyAnimation : UIViewController { 30 | CustomLayer *customLayer_; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Classes/Samples/CustomPropertyAnimation.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2010 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "CustomPropertyAnimation.h" 26 | 27 | @interface CustomLayer : CALayer { 28 | } 29 | 30 | @property (assign) CGFloat margin; 31 | 32 | @end 33 | 34 | @implementation CustomLayer 35 | 36 | @synthesize margin; 37 | 38 | + (BOOL)needsDisplayForKey:(NSString *)key { 39 | if([key isEqualToString:@"margin"]) { 40 | return YES; 41 | } 42 | return [super needsDisplayForKey:key]; 43 | } 44 | 45 | - (void)drawInContext:(CGContextRef)ctx { 46 | CGContextSaveGState(ctx); 47 | CGContextAddEllipseInRect(ctx, CGRectInset(self.bounds, self.margin, self.margin)); 48 | CGContextSetStrokeColorWithColor(ctx, [[UIColor yellowColor] CGColor]); 49 | CGContextSetLineWidth(ctx, 4.f); 50 | CGContextDrawPath(ctx, kCGPathStroke); 51 | CGContextRestoreGState(ctx); 52 | } 53 | 54 | @end 55 | 56 | 57 | @implementation CustomPropertyAnimation 58 | 59 | + (NSString *)friendlyName { 60 | return @"Custom Properties"; 61 | } 62 | 63 | #pragma mark init and dealloc 64 | 65 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 66 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 67 | self.title = [[self class] friendlyName]; 68 | } 69 | return self; 70 | } 71 | 72 | - (void)dealloc { 73 | [super dealloc]; 74 | } 75 | 76 | #pragma mark Load and unload the view 77 | 78 | - (void)loadView { 79 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 80 | myView.backgroundColor = [UIColor whiteColor]; 81 | 82 | customLayer_ = [[CustomLayer alloc] init]; 83 | [myView.layer addSublayer:customLayer_]; 84 | 85 | self.view = myView; 86 | } 87 | 88 | #pragma mark View drawing 89 | 90 | - (void)viewWillAppear:(BOOL)animated { 91 | customLayer_.backgroundColor = [[UIColor blueColor] CGColor]; 92 | customLayer_.frame = CGRectInset(self.view.bounds, 50.f, 100.f); 93 | customLayer_.position = self.view.center; 94 | customLayer_.margin = 0.f; 95 | } 96 | 97 | - (void)viewDidAppear:(BOOL)animated { 98 | CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"margin"]; 99 | anim.duration = 1.f; 100 | anim.fromValue = [NSNumber numberWithFloat:5.f]; 101 | anim.toValue = [NSNumber numberWithFloat:25.f]; 102 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 103 | anim.repeatCount = CGFLOAT_MAX; 104 | anim.autoreverses = YES; 105 | 106 | [customLayer_ addAnimation:anim forKey:@"margin"]; 107 | 108 | CABasicAnimation *anim2 = [CABasicAnimation animationWithKeyPath:@"cornerRadius"]; 109 | anim2.duration = 1.f; 110 | anim2.fromValue = [NSNumber numberWithFloat:0.f]; 111 | anim2.toValue = [NSNumber numberWithFloat:20.f]; 112 | anim2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 113 | anim2.repeatCount = CGFLOAT_MAX; 114 | anim2.autoreverses = YES; 115 | 116 | [customLayer_ addAnimation:anim2 forKey:@"cornerRadius"]; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /Classes/Samples/GeometricProperties.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface GeometricProperties : UIViewController { 29 | CALayer *simpleLayer_; 30 | 31 | UITextView *propertiesTextView_; 32 | UIButton *moveAnchorPointButton_; 33 | UIButton *movePositionButton_; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Classes/Samples/GeometricProperties.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "GeometricProperties.h" 26 | #import "CALayer+FTDebugDrawing.h" 27 | 28 | @implementation GeometricProperties 29 | 30 | + (NSString *)friendlyName { 31 | return @"Geometric Properties"; 32 | } 33 | 34 | #pragma mark init and dealloc 35 | 36 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 37 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 38 | self.title = [[self class] friendlyName]; 39 | } 40 | return self; 41 | } 42 | 43 | - (void)dealloc { 44 | [simpleLayer_ release], simpleLayer_ = nil; 45 | [moveAnchorPointButton_ release], moveAnchorPointButton_ = nil; 46 | [movePositionButton_ release], movePositionButton_ = nil; 47 | [propertiesTextView_ release], propertiesTextView_ = nil; 48 | [super dealloc]; 49 | } 50 | 51 | #pragma mark Load and unload the view 52 | 53 | - (void)loadView { 54 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 55 | myView.backgroundColor = [UIColor whiteColor]; 56 | 57 | moveAnchorPointButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 58 | moveAnchorPointButton_.frame = CGRectMake(10., 10., 145., 44.); 59 | [moveAnchorPointButton_ setTitle:@"Move Anchor Point" forState:UIControlStateNormal]; 60 | [moveAnchorPointButton_ addTarget:self action:@selector(moveAnchorPoint:) forControlEvents:UIControlEventTouchUpInside]; 61 | [myView addSubview:moveAnchorPointButton_]; 62 | 63 | movePositionButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 64 | movePositionButton_.frame = CGRectMake(165., 10., 145., 44.); 65 | [movePositionButton_ setTitle:@"Move Position" forState:UIControlStateNormal]; 66 | [movePositionButton_ addTarget:self action:@selector(movePosition:) forControlEvents:UIControlEventTouchUpInside]; 67 | [myView addSubview:movePositionButton_]; 68 | 69 | propertiesTextView_ = [[UITextView alloc] initWithFrame:CGRectMake(0., 60., 320., 44.)]; 70 | propertiesTextView_.backgroundColor = [UIColor clearColor]; 71 | propertiesTextView_.editable = NO; 72 | propertiesTextView_.textAlignment = UITextAlignmentCenter; 73 | propertiesTextView_.font = [UIFont systemFontOfSize:12.]; 74 | [myView addSubview:propertiesTextView_]; 75 | 76 | simpleLayer_ = [[CALayer layer] retain]; 77 | [myView.layer addSublayer:simpleLayer_]; 78 | self.view = myView; 79 | } 80 | 81 | #pragma mark View drawing 82 | 83 | - (void)updatePropertiesLabel { 84 | propertiesTextView_.text = [NSString stringWithFormat:@"Bounds: %@ Position: %@\nFrame: %@ Anchor Point: %@", 85 | NSStringFromCGRect(simpleLayer_.bounds), 86 | NSStringFromCGPoint(simpleLayer_.position), 87 | NSStringFromCGRect(simpleLayer_.frame), 88 | NSStringFromCGPoint(simpleLayer_.anchorPoint)]; 89 | } 90 | 91 | - (void)viewWillAppear:(BOOL)animated { 92 | simpleLayer_.backgroundColor = [UIColorFromRGBA(0x00FF00, .85) CGColor]; 93 | simpleLayer_.bounds = CGRectMake(0., 0., 200., 200.); 94 | simpleLayer_.position = self.view.center; 95 | simpleLayer_.delegate = self; 96 | [simpleLayer_ setNeedsDisplay]; 97 | [self updatePropertiesLabel]; 98 | } 99 | 100 | - (void)viewWillDisappear:(BOOL)animated { 101 | simpleLayer_.delegate = nil; 102 | } 103 | 104 | - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { 105 | [layer debugDrawAnchorPointInContext:context withSize:CGSizeMake(8., 8.) color:[UIColor redColor]]; 106 | } 107 | 108 | #pragma mark Button Event Handlers 109 | 110 | - (void)moveAnchorPoint:(id)sender { 111 | if(CGPointEqualToPoint(simpleLayer_.anchorPoint, CGPointZero)) { 112 | simpleLayer_.anchorPoint = CGPointMake(.5, .5); 113 | } else { 114 | simpleLayer_.anchorPoint = CGPointZero; 115 | } 116 | [simpleLayer_ setNeedsDisplay]; 117 | [self updatePropertiesLabel]; 118 | } 119 | 120 | - (void)movePosition:(id)sender { 121 | if(CGPointEqualToPoint(simpleLayer_.position, self.view.center)) { 122 | CGPoint newPos = self.view.center; 123 | newPos.y += 100.; 124 | simpleLayer_.position = newPos; 125 | } else { 126 | simpleLayer_.position = self.view.center; 127 | } 128 | [simpleLayer_ setNeedsDisplay]; 129 | [self updatePropertiesLabel]; 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /Classes/Samples/GradientLayers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface GradientLayers : UIViewController { 28 | CAGradientLayer *gradientLayer_; 29 | UIButton *animateButton_; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Samples/GradientLayers.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "GradientLayers.h" 26 | 27 | @interface GradientLayers () 28 | 29 | - (void)animateGradient:(id)sender; 30 | 31 | @end 32 | 33 | 34 | @implementation GradientLayers 35 | 36 | + (NSString *)friendlyName { 37 | return @"Gradient Layers"; 38 | } 39 | 40 | #pragma mark init and dealloc 41 | 42 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 43 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 44 | self.title = [[self class] friendlyName]; 45 | } 46 | return self; 47 | } 48 | 49 | - (void)dealloc { 50 | [gradientLayer_ release], gradientLayer_ = nil; 51 | [animateButton_ release], animateButton_ = nil; 52 | [super dealloc]; 53 | } 54 | 55 | 56 | - (void)animateGradient:(id)sender { 57 | if([gradientLayer_ animationForKey:@"gradientAnimation"] == nil) { 58 | CABasicAnimation *endPointAnim = [CABasicAnimation animationWithKeyPath:@"endPoint"]; 59 | endPointAnim.toValue = [NSValue valueWithCGPoint:CGPointMake(0., .1)]; 60 | endPointAnim.duration = 1.; 61 | endPointAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 62 | endPointAnim.repeatCount = FLT_MAX; 63 | endPointAnim.autoreverses = YES; 64 | 65 | [gradientLayer_ addAnimation:endPointAnim forKey:@"gradientAnimation"]; 66 | } else { 67 | [gradientLayer_ removeAnimationForKey:@"gradientAnimation"]; 68 | } 69 | } 70 | 71 | #pragma mark Load and unload the view 72 | 73 | - (void)loadView { 74 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 75 | myView.backgroundColor = [UIColor whiteColor]; 76 | 77 | animateButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 78 | animateButton_.frame = CGRectMake(10., 10., 300., 44.); 79 | [animateButton_ setTitle:@"Animate!" forState:UIControlStateNormal]; 80 | [animateButton_ addTarget:self action:@selector(animateGradient:) forControlEvents:UIControlEventTouchUpInside]; 81 | [myView addSubview:animateButton_]; 82 | 83 | gradientLayer_ = [[CAGradientLayer layer] retain]; 84 | [myView.layer addSublayer:gradientLayer_]; 85 | self.view = myView; 86 | } 87 | 88 | #pragma mark View drawing 89 | 90 | - (void)viewWillAppear:(BOOL)animated { 91 | gradientLayer_.backgroundColor = [[UIColor blackColor] CGColor]; 92 | gradientLayer_.bounds = CGRectMake(0., 0., 200., 200.); 93 | gradientLayer_.position = self.view.center; 94 | gradientLayer_.cornerRadius = 12.; 95 | gradientLayer_.borderWidth = 2.; 96 | gradientLayer_.borderColor = [[UIColor blackColor] CGColor]; 97 | gradientLayer_.startPoint = CGPointZero; 98 | gradientLayer_.endPoint = CGPointMake(0., 1.); 99 | gradientLayer_.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], (id)[UIColorFromRGBA(0xFFFFFF, .1) CGColor], nil]; 100 | } 101 | 102 | - (void)viewDidAppear:(BOOL)animated { 103 | } 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /Classes/Samples/ImageContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface ImageContent : UIViewController { 28 | CALayer *simpleLayer_; 29 | CALayer *moneyLayer_; 30 | 31 | UIButton *magicButton_; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Classes/Samples/ImageContent.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "ImageContent.h" 26 | 27 | @implementation ImageContent 28 | 29 | + (NSString *)friendlyName { 30 | return @"Image Content"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [simpleLayer_ release], simpleLayer_ = nil; 44 | [moneyLayer_ release], moneyLayer_ = nil; 45 | [magicButton_ release], magicButton_ = nil; 46 | [super dealloc]; 47 | } 48 | 49 | #pragma mark Load and unload the view 50 | 51 | - (void)loadView { 52 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 53 | myView.backgroundColor = [UIColor whiteColor]; 54 | 55 | magicButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 56 | magicButton_.frame = CGRectMake(10., 10., 300., 44.); 57 | [magicButton_ setTitle:@"Invoke Magic!" forState:UIControlStateNormal]; 58 | [magicButton_ addTarget:self action:@selector(toggleMoney:) forControlEvents:UIControlEventTouchUpInside]; 59 | [myView addSubview:magicButton_]; 60 | 61 | simpleLayer_ = [[CALayer layer] retain]; 62 | moneyLayer_ = [[CALayer layer] retain]; 63 | 64 | [myView.layer addSublayer:simpleLayer_]; 65 | [myView.layer addSublayer:moneyLayer_]; 66 | 67 | self.view = myView; 68 | } 69 | 70 | #pragma mark View drawing 71 | 72 | - (void)viewWillAppear:(BOOL)animated { 73 | simpleLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 74 | simpleLayer_.bounds = CGRectMake(0., 0., 240., 66.); 75 | simpleLayer_.position = CGPointMake(160., 150.); 76 | simpleLayer_.contents = (id)[[UIImage imageNamed:@"FTSLogo.png"] CGImage]; 77 | 78 | moneyLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 79 | moneyLayer_.bounds = CGRectMake(0., 0., 290., 125.); 80 | moneyLayer_.position = CGPointMake(160., 265.); 81 | moneyLayer_.delegate = self; 82 | [moneyLayer_ setValue:[NSNumber numberWithBool:YES] forKey:@"moneyImageIsBen"]; 83 | [moneyLayer_ setNeedsDisplay]; 84 | } 85 | 86 | - (void)viewWillDisappear:(BOOL)animated { 87 | moneyLayer_.delegate = nil; 88 | } 89 | 90 | - (void)displayLayer:(CALayer *)layer { 91 | if(layer == moneyLayer_) { 92 | if([[layer valueForKey:@"moneyImageIsBen"] boolValue]) { 93 | layer.contents = (id)[[UIImage imageNamed:@"Ben.png"] CGImage]; 94 | } else { 95 | layer.contents = (id)[[UIImage imageNamed:@"Steve.png"] CGImage]; 96 | } 97 | } 98 | } 99 | 100 | #pragma mark Event Handlers 101 | 102 | - (void)toggleMoney:(id)sender { 103 | BOOL isBen = [[moneyLayer_ valueForKey:@"moneyImageIsBen"] boolValue]; 104 | [moneyLayer_ setValue:[NSNumber numberWithBool:!isBen] forKey:@"moneyImageIsBen"]; 105 | [moneyLayer_ setNeedsDisplay]; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Classes/Samples/KeyframeAnimation.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface KeyframeAnimation : UIViewController { 29 | CALayer *platformLayer_; 30 | CALayer *marioLayer_; 31 | 32 | UIButton *jumpButton_; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Classes/Samples/KeyframeAnimation.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "KeyframeAnimation.h" 26 | 27 | static const CGRect kMarioStandingSpriteCoords = { .5, 0., .5, 1. }; 28 | static const CGRect kMarioJumpingSpriteCoords = { 0., 0., .5, 1. }; 29 | 30 | @implementation KeyframeAnimation 31 | 32 | + (NSString *)friendlyName { 33 | return @"Keyframe Animation"; 34 | } 35 | 36 | #pragma mark init and dealloc 37 | 38 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 39 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 40 | self.title = [[self class] friendlyName]; 41 | } 42 | return self; 43 | } 44 | 45 | - (void)dealloc { 46 | [platformLayer_ release], platformLayer_ = nil; 47 | [marioLayer_ release], marioLayer_ = nil; 48 | [jumpButton_ release], jumpButton_ = nil; 49 | [super dealloc]; 50 | } 51 | 52 | #pragma mark Load and unload the view 53 | 54 | - (void)loadView { 55 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 56 | myView.backgroundColor = [UIColor whiteColor]; 57 | 58 | jumpButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 59 | jumpButton_.frame = CGRectMake(10., 10., 300., 44.); 60 | [jumpButton_ setTitle:@"Jump!" forState:UIControlStateNormal]; 61 | [jumpButton_ addTarget:self action:@selector(jump:) forControlEvents:UIControlEventTouchUpInside]; 62 | [myView addSubview:jumpButton_]; 63 | 64 | platformLayer_ = [[CALayer layer] retain]; 65 | marioLayer_ = [[CALayer layer] retain]; 66 | 67 | [myView.layer addSublayer:platformLayer_]; 68 | [myView.layer addSublayer:marioLayer_]; 69 | self.view = myView; 70 | } 71 | 72 | #pragma mark View drawing 73 | 74 | - (void)viewWillAppear:(BOOL)animated { 75 | CGSize viewSize = self.view.bounds.size; 76 | 77 | marioLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 78 | marioLayer_.anchorPoint = CGPointMake(0., 1.); 79 | marioLayer_.bounds = CGRectMake(0., 0., 32., 64.); 80 | marioLayer_.position = CGPointMake(0., viewSize.height); 81 | marioLayer_.contents = (id)[[UIImage imageNamed:@"Mario.png"] CGImage]; 82 | marioLayer_.contentsGravity = kCAGravityResizeAspect; 83 | marioLayer_.contentsRect = kMarioStandingSpriteCoords; 84 | 85 | platformLayer_.backgroundColor = [[UIColor brownColor] CGColor]; 86 | platformLayer_.anchorPoint = CGPointZero; 87 | platformLayer_.frame = CGRectMake(160., 200., 160., 20.); 88 | platformLayer_.cornerRadius = 4.; 89 | [platformLayer_ setNeedsDisplay]; 90 | } 91 | 92 | - (void)viewDidAppear:(BOOL)animated { 93 | } 94 | 95 | #pragma mark Event Handlers 96 | 97 | - (void)jump:(id)sender { 98 | CGSize viewSize = self.view.bounds.size; 99 | [marioLayer_ removeAnimationForKey:@"marioJump"]; 100 | 101 | CGMutablePathRef jumpPath = CGPathCreateMutable(); 102 | CGPathMoveToPoint(jumpPath, NULL, 0., viewSize.height); 103 | CGPathAddCurveToPoint(jumpPath, NULL, 30., 140., 170., 140., 170., 200.); 104 | 105 | CAKeyframeAnimation *jumpAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 106 | jumpAnimation.path = jumpPath; 107 | jumpAnimation.duration = 1.; 108 | jumpAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 109 | jumpAnimation.delegate = self; 110 | 111 | CGPathRelease(jumpPath); 112 | 113 | [marioLayer_ addAnimation:jumpAnimation forKey:@"marioJump"]; 114 | } 115 | 116 | #pragma mark Animation delegate methods 117 | 118 | - (void)animationDidStart:(CAAnimation *)theAnimation { 119 | [CATransaction begin]; 120 | { 121 | [CATransaction setDisableActions:YES]; 122 | marioLayer_.contentsRect = kMarioJumpingSpriteCoords; 123 | } 124 | [CATransaction commit]; 125 | } 126 | 127 | - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)finished { 128 | [CATransaction begin]; 129 | { 130 | [CATransaction setDisableActions:YES]; 131 | marioLayer_.contentsRect = kMarioStandingSpriteCoords; 132 | if(finished) { 133 | marioLayer_.position = CGPointMake(170., 200.); 134 | } 135 | } 136 | [CATransaction commit]; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Classes/Samples/LayerActions.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface LayerActions : UIViewController { 29 | CALayer *moneyLayer_; 30 | UIButton *magicButton_; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Classes/Samples/LayerActions.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "LayerActions.h" 26 | 27 | @implementation LayerActions 28 | 29 | + (NSString *)friendlyName { 30 | return @"Layer Actions"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [moneyLayer_ release], moneyLayer_ = nil; 44 | [magicButton_ release], magicButton_ = nil; 45 | [super dealloc]; 46 | } 47 | 48 | #pragma mark Load and unload the view 49 | 50 | - (void)loadView { 51 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 52 | myView.backgroundColor = [UIColor whiteColor]; 53 | 54 | magicButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 55 | magicButton_.frame = CGRectMake(10., 10., 300., 44.); 56 | [magicButton_ setTitle:@"Invoke Magic!" forState:UIControlStateNormal]; 57 | [magicButton_ addTarget:self action:@selector(toggleMoney:) forControlEvents:UIControlEventTouchUpInside]; 58 | [myView addSubview:magicButton_]; 59 | 60 | moneyLayer_ = [[CALayer layer] retain]; 61 | 62 | [myView.layer addSublayer:moneyLayer_]; 63 | 64 | self.view = myView; 65 | } 66 | 67 | #pragma mark View drawing 68 | 69 | - (void)viewWillAppear:(BOOL)animated { 70 | moneyLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 71 | moneyLayer_.bounds = CGRectMake(0., 0., 290., 125.); 72 | moneyLayer_.position = self.view.center; 73 | moneyLayer_.delegate = self; 74 | [moneyLayer_ setValue:[NSNumber numberWithBool:YES] forKey:@"moneyImageIsBen"]; 75 | [moneyLayer_ setNeedsDisplay]; 76 | } 77 | 78 | - (void)viewWillDisappear:(BOOL)animated { 79 | moneyLayer_.delegate = nil; 80 | } 81 | 82 | - (void)displayLayer:(CALayer *)layer { 83 | if(layer == moneyLayer_) { 84 | if([[layer valueForKey:@"moneyImageIsBen"] boolValue]) { 85 | layer.contents = (id)[[UIImage imageNamed:@"Ben.png"] CGImage]; 86 | } else { 87 | layer.contents = (id)[[UIImage imageNamed:@"Steve.png"] CGImage]; 88 | } 89 | } 90 | } 91 | 92 | - (id)actionForLayer:(CALayer *)layer forKey:(NSString *)event { 93 | CATransition *anim = nil; 94 | if ([event isEqualToString:@"contents"]) { 95 | anim = [CATransition animation]; 96 | anim.duration = .33; 97 | anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 98 | anim.type = kCATransitionPush; 99 | anim.subtype = kCATransitionFromRight; 100 | } 101 | return anim; 102 | } 103 | 104 | #pragma mark Event Handlers 105 | 106 | - (void)toggleMoney:(id)sender { 107 | BOOL isBen = [[moneyLayer_ valueForKey:@"moneyImageIsBen"] boolValue]; 108 | [moneyLayer_ setValue:[NSNumber numberWithBool:!isBen] forKey:@"moneyImageIsBen"]; 109 | [moneyLayer_ setNeedsDisplay]; 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Classes/Samples/LayerDrawing.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface LayerDrawing : UIViewController { 29 | CALayer *drawingLayer_; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Samples/LayerDrawing.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "LayerDrawing.h" 26 | 27 | @implementation LayerDrawing 28 | 29 | + (NSString *)friendlyName { 30 | return @"Draw Your Own Content"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [drawingLayer_ release], drawingLayer_ = nil; 44 | [super dealloc]; 45 | } 46 | 47 | #pragma mark Load and unload the view 48 | 49 | - (void)loadView { 50 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 51 | myView.backgroundColor = [UIColor whiteColor]; 52 | 53 | drawingLayer_ = [[CALayer layer] retain]; 54 | 55 | [myView.layer addSublayer:drawingLayer_]; 56 | self.view = myView; 57 | } 58 | 59 | #pragma mark View drawing 60 | 61 | - (void)viewWillAppear:(BOOL)animated { 62 | drawingLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 63 | drawingLayer_.bounds = CGRectMake(0., 0., 300., 300.); 64 | drawingLayer_.position = self.view.center; 65 | drawingLayer_.delegate = self; 66 | [drawingLayer_ setNeedsDisplay]; 67 | } 68 | 69 | - (void)viewWillDisappear:(BOOL)animated { 70 | drawingLayer_.delegate = nil; 71 | } 72 | 73 | - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { 74 | CGContextAddEllipseInRect(context, CGRectInset(layer.bounds, 4., 4.)); 75 | 76 | CGContextSetLineWidth(context, 2.); 77 | const CGFloat lineDashLengths[2] = { 6., 2. }; 78 | CGContextSetLineDash(context, 0., lineDashLengths, 2); 79 | 80 | CGContextSetFillColorWithColor(context, [[UIColor greenColor] CGColor]); 81 | CGContextSetStrokeColorWithColor(context, [[UIColor blackColor] CGColor]); 82 | 83 | CGContextDrawPath(context, kCGPathFillStroke); 84 | } 85 | 86 | @end 87 | 88 | -------------------------------------------------------------------------------- /Classes/Samples/LayerTransforms.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface LayerTransforms : UIViewController { 29 | CALayer *simpleLayer_; 30 | BOOL cumulative_; 31 | 32 | UITextView *propertiesTextView_; 33 | UIButton *moveAnchorPointButton_; 34 | UIButton *rotateButton_; 35 | UIButton *scaleButton_; 36 | UIButton *translateButton_; 37 | UIButton *resetButton_; 38 | UISwitch *cumulativeSwitch_; 39 | } 40 | 41 | @property(assign) BOOL cumulative; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Classes/Samples/LayerTransforms.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "LayerTransforms.h" 26 | #import "CALayer+FTDebugDrawing.h" 27 | 28 | const static CGPoint kSimpleLayerStartPosition = { 160., 310. }; 29 | 30 | @implementation LayerTransforms 31 | 32 | @synthesize cumulative = cumulative_; 33 | 34 | + (NSString *)friendlyName { 35 | return @"Layer Transforms"; 36 | } 37 | 38 | #pragma mark init and dealloc 39 | 40 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 41 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 42 | self.title = [[self class] friendlyName]; 43 | self.cumulative = YES; 44 | } 45 | return self; 46 | } 47 | 48 | - (void)dealloc { 49 | [simpleLayer_ release], simpleLayer_ = nil; 50 | [moveAnchorPointButton_ release], moveAnchorPointButton_ = nil; 51 | [rotateButton_ release], rotateButton_ = nil; 52 | [scaleButton_ release], scaleButton_ = nil; 53 | [translateButton_ release], translateButton_ = nil; 54 | [propertiesTextView_ release], propertiesTextView_ = nil; 55 | [resetButton_ release], resetButton_ = nil; 56 | [cumulativeSwitch_ release], cumulativeSwitch_ = nil; 57 | [super dealloc]; 58 | } 59 | 60 | #pragma mark Load and unload the view 61 | 62 | - (void)loadView { 63 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 64 | myView.backgroundColor = [UIColor whiteColor]; 65 | 66 | moveAnchorPointButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 67 | moveAnchorPointButton_.frame = CGRectMake(10., 10., 145., 44.); 68 | [moveAnchorPointButton_ setTitle:@"Move Anchor Point" forState:UIControlStateNormal]; 69 | [moveAnchorPointButton_ addTarget:self action:@selector(moveAnchorPoint:) forControlEvents:UIControlEventTouchUpInside]; 70 | [myView addSubview:moveAnchorPointButton_]; 71 | 72 | rotateButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 73 | rotateButton_.frame = CGRectMake(165., 10., 145., 44.); 74 | [rotateButton_ setTitle:@"Rotate" forState:UIControlStateNormal]; 75 | [rotateButton_ addTarget:self action:@selector(rotate:) forControlEvents:UIControlEventTouchUpInside]; 76 | [myView addSubview:rotateButton_]; 77 | 78 | 79 | scaleButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 80 | scaleButton_.frame = CGRectMake(10., 60., 145., 44.); 81 | [scaleButton_ setTitle:@"Scale" forState:UIControlStateNormal]; 82 | [scaleButton_ addTarget:self action:@selector(scale:) forControlEvents:UIControlEventTouchUpInside]; 83 | [myView addSubview:scaleButton_]; 84 | 85 | translateButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 86 | translateButton_.frame = CGRectMake(165., 60., 145., 44.); 87 | [translateButton_ setTitle:@"Tanslate" forState:UIControlStateNormal]; 88 | [translateButton_ addTarget:self action:@selector(translate:) forControlEvents:UIControlEventTouchUpInside]; 89 | [myView addSubview:translateButton_]; 90 | 91 | resetButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 92 | resetButton_.frame = CGRectMake(10., 110., 145., 44.); 93 | [resetButton_ setTitle:@"Reset" forState:UIControlStateNormal]; 94 | [resetButton_ addTarget:self action:@selector(reset:) forControlEvents:UIControlEventTouchUpInside]; 95 | [myView addSubview:resetButton_]; 96 | 97 | cumulativeSwitch_ = [[UISwitch alloc] initWithFrame:CGRectZero]; 98 | CGRect rect = CGRectMake(165., 110., 145., 44.); 99 | CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); 100 | cumulativeSwitch_.center = center; 101 | cumulativeSwitch_.on = self.cumulative; 102 | [cumulativeSwitch_ addTarget:self action:@selector(toggleCumulative:) forControlEvents:UIControlEventValueChanged]; 103 | [myView addSubview:cumulativeSwitch_]; 104 | 105 | propertiesTextView_ = [[UITextView alloc] initWithFrame:CGRectMake(0., 160., 320., 44.)]; 106 | propertiesTextView_.backgroundColor = [UIColor clearColor]; 107 | propertiesTextView_.editable = NO; 108 | propertiesTextView_.textAlignment = UITextAlignmentCenter; 109 | propertiesTextView_.font = [UIFont systemFontOfSize:12.]; 110 | [myView addSubview:propertiesTextView_]; 111 | 112 | simpleLayer_ = [[CALayer layer] retain]; 113 | [myView.layer addSublayer:simpleLayer_]; 114 | self.view = myView; 115 | } 116 | 117 | #pragma mark View drawing 118 | 119 | - (void)updatePropertiesLabel { 120 | propertiesTextView_.text = [NSString stringWithFormat:@"Bounds: %@ Position: %@\nFrame: %@ Anchor Point: %@", 121 | NSStringFromCGRect(simpleLayer_.bounds), 122 | NSStringFromCGPoint(simpleLayer_.position), 123 | NSStringFromCGRect(simpleLayer_.frame), 124 | NSStringFromCGPoint(simpleLayer_.anchorPoint)]; 125 | } 126 | 127 | - (void)viewWillAppear:(BOOL)animated { 128 | simpleLayer_.backgroundColor = [UIColorFromRGBA(0x00FF00, .85) CGColor]; 129 | simpleLayer_.bounds = CGRectMake(0., 0., 200., 200.); 130 | simpleLayer_.position = kSimpleLayerStartPosition; 131 | simpleLayer_.transform = CATransform3DIdentity; 132 | simpleLayer_.delegate = self; 133 | [simpleLayer_ setNeedsDisplay]; 134 | [self updatePropertiesLabel]; 135 | } 136 | 137 | - (void)viewWillDisappear:(BOOL)animated { 138 | simpleLayer_.delegate = nil; 139 | } 140 | 141 | - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { 142 | [layer debugDrawAnchorPointInContext:context withSize:CGSizeMake(8., 8.) color:[UIColor redColor]]; 143 | } 144 | 145 | #pragma mark Button Event Handlers 146 | 147 | - (void)moveAnchorPoint:(id)sender { 148 | if(CGPointEqualToPoint(simpleLayer_.anchorPoint, CGPointZero)) { 149 | simpleLayer_.anchorPoint = CGPointMake(.5, .5); 150 | } else { 151 | simpleLayer_.anchorPoint = CGPointZero; 152 | } 153 | [simpleLayer_ setNeedsDisplay]; 154 | [self updatePropertiesLabel]; 155 | } 156 | 157 | - (void)rotate:(id)sender { 158 | if(self.cumulative) { 159 | CATransform3D currentTransform = simpleLayer_.transform; 160 | CATransform3D rotated = CATransform3DRotate(currentTransform, 45., 0., 0., 1.); 161 | simpleLayer_.transform = rotated; 162 | } else { 163 | self.view.layer.sublayerTransform = CATransform3DIdentity; 164 | simpleLayer_.transform = CATransform3DIdentity; 165 | [simpleLayer_ setValue:[NSNumber numberWithFloat:45.] forKeyPath:@"transform.rotation.z"]; 166 | } 167 | [simpleLayer_ setNeedsDisplay]; 168 | [self updatePropertiesLabel]; 169 | } 170 | 171 | - (void)scale:(id)sender { 172 | if(self.cumulative) { 173 | CATransform3D currentTransform = simpleLayer_.transform; 174 | CATransform3D scaled = CATransform3DScale(currentTransform, 1.5, 1.5, 1.5); 175 | simpleLayer_.transform = scaled; 176 | } else { 177 | simpleLayer_.transform = CATransform3DIdentity; 178 | [simpleLayer_ setValue:[NSNumber numberWithFloat:1.5] forKeyPath:@"transform.scale"]; 179 | } 180 | [simpleLayer_ setNeedsDisplay]; 181 | [self updatePropertiesLabel]; 182 | } 183 | 184 | - (void)translate:(id)sender { 185 | CATransform3D translated; 186 | if(self.cumulative) { 187 | CATransform3D currentTransform = simpleLayer_.transform; 188 | translated = CATransform3DTranslate(currentTransform, 50., 50., 0.); 189 | } else { 190 | // The following is equvalent to: 191 | // translated = CATransform3DMakeTranslation(50., 50., 0.); 192 | translated = CATransform3DIdentity; 193 | translated.m41 = 50.; 194 | translated.m42 = 50.; 195 | } 196 | simpleLayer_.transform = translated; 197 | [simpleLayer_ setNeedsDisplay]; 198 | [self updatePropertiesLabel]; 199 | } 200 | 201 | - (void)reset:(id)sender { 202 | simpleLayer_.transform = CATransform3DIdentity; 203 | simpleLayer_.anchorPoint = CGPointMake(.5, .5); 204 | self.view.layer.sublayerTransform = CATransform3DIdentity; 205 | [simpleLayer_ setNeedsDisplay]; 206 | [self updatePropertiesLabel]; 207 | } 208 | 209 | - (void)toggleCumulative:(id)sender { 210 | self.cumulative = [(UISwitch *)sender isOn]; 211 | } 212 | 213 | @end -------------------------------------------------------------------------------- /Classes/Samples/LayerTransitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface LayerTransitions : UIViewController { 29 | CALayer *containerLayer_; 30 | CALayer *blueLayer_; 31 | CALayer *redLayer_; 32 | 33 | UIButton *transitionButton_; 34 | UISegmentedControl *typeSelectControl_; 35 | UISegmentedControl *subtypeSelectControl_; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Classes/Samples/LayerTransitions.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "LayerTransitions.h" 26 | 27 | @implementation LayerTransitions 28 | 29 | + (NSString *)friendlyName { 30 | return @"Layer Transitions"; 31 | } 32 | 33 | #pragma mark init and dealloc 34 | 35 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 36 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 37 | self.title = [[self class] friendlyName]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)dealloc { 43 | [containerLayer_ release], containerLayer_ = nil; 44 | [blueLayer_ release], blueLayer_ = nil; 45 | [redLayer_ release], redLayer_ = nil; 46 | [transitionButton_ release], transitionButton_ = nil; 47 | [typeSelectControl_ release], typeSelectControl_ = nil; 48 | [subtypeSelectControl_ release], subtypeSelectControl_ = nil; 49 | [super dealloc]; 50 | } 51 | 52 | #pragma mark Load and unload the view 53 | 54 | - (void)loadView { 55 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 56 | myView.backgroundColor = [UIColor whiteColor]; 57 | 58 | NSArray *typeItems = [NSArray arrayWithObjects:@"Push", @"Move In", @"Reveal", @"Fade", nil]; 59 | typeSelectControl_ = [[UISegmentedControl alloc] initWithItems:typeItems]; 60 | typeSelectControl_.frame = CGRectMake(10., 10., 300., 44.); 61 | typeSelectControl_.selectedSegmentIndex = 0; 62 | [myView addSubview:typeSelectControl_]; 63 | 64 | NSArray *subtypeItems = [NSArray arrayWithObjects:@"Right", @"Left", @"Top", @"Bottom", nil]; 65 | subtypeSelectControl_ = [[UISegmentedControl alloc] initWithItems:subtypeItems]; 66 | subtypeSelectControl_.frame = CGRectMake(10., 60., 300., 44.); 67 | subtypeSelectControl_.selectedSegmentIndex = 0; 68 | [myView addSubview:subtypeSelectControl_]; 69 | 70 | transitionButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 71 | transitionButton_.frame = CGRectMake(10., 110., 300., 44.); 72 | [transitionButton_ setTitle:@"Start Transition" forState:UIControlStateNormal]; 73 | [transitionButton_ addTarget:self action:@selector(toggleTransition:) forControlEvents:UIControlEventTouchUpInside]; 74 | [myView addSubview:transitionButton_]; 75 | 76 | 77 | blueLayer_ = [[CALayer layer] retain]; 78 | redLayer_ = [[CALayer layer] retain]; 79 | containerLayer_ = [[CALayer layer] retain]; 80 | 81 | [myView.layer addSublayer:containerLayer_]; 82 | [containerLayer_ addSublayer:blueLayer_]; 83 | [containerLayer_ addSublayer:redLayer_]; 84 | self.view = myView; 85 | } 86 | 87 | #pragma mark View drawing 88 | 89 | - (void)viewWillAppear:(BOOL)animated { 90 | CGRect rect = CGRectMake(0., 0., 240., 240.); 91 | 92 | containerLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 93 | containerLayer_.bounds = rect; 94 | containerLayer_.position = CGPointMake(160., 280.); 95 | [containerLayer_ setNeedsDisplay]; 96 | 97 | redLayer_.backgroundColor = [UIColorFromRGBA(0xFF0000, .75) CGColor]; 98 | redLayer_.bounds = rect; 99 | redLayer_.position = CGPointMake(120., 120.); 100 | redLayer_.hidden = YES; 101 | [redLayer_ setNeedsDisplay]; 102 | 103 | blueLayer_.backgroundColor = [UIColorFromRGBA(0x0000FF, .75) CGColor]; 104 | blueLayer_.bounds = rect; 105 | blueLayer_.position = CGPointMake(120., 120.); 106 | [blueLayer_ setNeedsDisplay]; 107 | } 108 | 109 | #pragma mark Button Event Handlers 110 | 111 | - (void)toggleTransition:(id)sender { 112 | CATransition *transition = [CATransition animation]; 113 | transition.duration = .5; 114 | transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 115 | 116 | NSString *transitionTypes[4] = { kCATransitionPush, kCATransitionMoveIn, kCATransitionReveal, kCATransitionFade }; 117 | transition.type = transitionTypes[typeSelectControl_.selectedSegmentIndex]; 118 | 119 | NSString *transitionSubtypes[4] = { kCATransitionFromRight, kCATransitionFromLeft, kCATransitionFromTop, kCATransitionFromBottom }; 120 | transition.subtype = transitionSubtypes[subtypeSelectControl_.selectedSegmentIndex]; 121 | 122 | [containerLayer_ addAnimation:transition forKey:nil]; 123 | blueLayer_.hidden = !blueLayer_.hidden; 124 | redLayer_.hidden = !redLayer_.hidden; 125 | } 126 | 127 | @end 128 | -------------------------------------------------------------------------------- /Classes/Samples/LayerTree.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface LayerTree : UIViewController { 29 | CALayer *containerLayer_; 30 | CALayer *redLayer_; 31 | CALayer *blueLayer_; 32 | CALayer *purpleLayer_; 33 | CALayer *yellowLayer_; 34 | 35 | UIButton *maskContainerButton_; 36 | UIButton *maskBlueButton_; 37 | UIButton *reparentPurpleButton_; 38 | UIButton *addRemoveYellowButton_; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Classes/Samples/LayerTree.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "LayerTree.h" 26 | #import "CALayer+FTDebugDrawing.h" 27 | 28 | @implementation LayerTree 29 | 30 | + (NSString *)friendlyName { 31 | return @"Layer Tree"; 32 | } 33 | 34 | #pragma mark init and dealloc 35 | 36 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 37 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 38 | self.title = [[self class] friendlyName]; 39 | } 40 | return self; 41 | } 42 | 43 | - (void)dealloc { 44 | [containerLayer_ release], containerLayer_ = nil; 45 | [redLayer_ release], redLayer_ = nil; 46 | [blueLayer_ release], blueLayer_ = nil; 47 | [purpleLayer_ release], purpleLayer_ = nil; 48 | [yellowLayer_ release], yellowLayer_ = nil; 49 | [maskBlueButton_ release], maskBlueButton_ = nil; 50 | [maskContainerButton_ release], maskContainerButton_ = nil; 51 | [reparentPurpleButton_ release], reparentPurpleButton_ = nil; 52 | [addRemoveYellowButton_ release], addRemoveYellowButton_ = nil; 53 | [super dealloc]; 54 | } 55 | 56 | #pragma mark Load and unload the view 57 | 58 | - (void)loadView { 59 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 60 | myView.backgroundColor = [UIColor whiteColor]; 61 | 62 | maskBlueButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 63 | maskBlueButton_.frame = CGRectMake(10., 10., 145., 44.); 64 | [maskBlueButton_ setTitle:@"Mask Blue" forState:UIControlStateNormal]; 65 | [maskBlueButton_ addTarget:self action:@selector(toggleBlueMask:) forControlEvents:UIControlEventTouchUpInside]; 66 | [myView addSubview:maskBlueButton_]; 67 | 68 | maskContainerButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 69 | maskContainerButton_.frame = CGRectMake(165., 10., 145., 44.); 70 | [maskContainerButton_ setTitle:@"Mask Container" forState:UIControlStateNormal]; 71 | [maskContainerButton_ addTarget:self action:@selector(toggleContainerMask:) forControlEvents:UIControlEventTouchUpInside]; 72 | [myView addSubview:maskContainerButton_]; 73 | 74 | reparentPurpleButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 75 | reparentPurpleButton_.frame = CGRectMake(10., 60., 145., 44.); 76 | [reparentPurpleButton_ setTitle:@"Reparent Purple" forState:UIControlStateNormal]; 77 | [reparentPurpleButton_ addTarget:self action:@selector(reparentPurpleLayer:) forControlEvents:UIControlEventTouchUpInside]; 78 | [myView addSubview:reparentPurpleButton_]; 79 | 80 | addRemoveYellowButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 81 | addRemoveYellowButton_.frame = CGRectMake(165., 60., 145., 44.); 82 | [addRemoveYellowButton_ setTitle:@"Add/Remove Yellow" forState:UIControlStateNormal]; 83 | [addRemoveYellowButton_ addTarget:self action:@selector(addRemoveYellow:) forControlEvents:UIControlEventTouchUpInside]; 84 | [myView addSubview:addRemoveYellowButton_]; 85 | 86 | containerLayer_ = [[CALayer layer] retain]; 87 | redLayer_ = [[CALayer layer] retain]; 88 | blueLayer_ = [[CALayer layer] retain]; 89 | purpleLayer_ = [[CALayer layer] retain]; 90 | yellowLayer_ = [[CALayer layer] retain]; 91 | 92 | [myView.layer addSublayer:containerLayer_]; 93 | [containerLayer_ addSublayer:redLayer_]; 94 | [containerLayer_ addSublayer:blueLayer_]; 95 | [blueLayer_ addSublayer:purpleLayer_]; 96 | 97 | self.view = myView; 98 | } 99 | 100 | #pragma mark View drawing 101 | 102 | - (void)viewWillAppear:(BOOL)animated { 103 | containerLayer_.backgroundColor = [[UIColor greenColor] CGColor]; 104 | containerLayer_.bounds = CGRectMake(0., 0., 200., 200.); 105 | containerLayer_.delegate = self; 106 | containerLayer_.position = self.view.center; 107 | [containerLayer_ setNeedsDisplay]; 108 | 109 | CGRect rect = CGRectMake(0., 0., 100., 100.); 110 | 111 | redLayer_.backgroundColor = [UIColorFromRGBA(0xFF0000, .75) CGColor]; 112 | redLayer_.bounds = rect; 113 | redLayer_.position = CGPointMake(0., 200.); 114 | redLayer_.delegate = self; 115 | [redLayer_ setNeedsDisplay]; 116 | 117 | blueLayer_.backgroundColor = [UIColorFromRGBA(0x0000FF, .75) CGColor]; 118 | blueLayer_.bounds = rect; 119 | blueLayer_.position = CGPointMake(200., 200.); 120 | blueLayer_.delegate = self; 121 | [blueLayer_ setNeedsDisplay]; 122 | 123 | purpleLayer_.backgroundColor = [UIColorFromRGBA(0xFF00FF, .75) CGColor]; 124 | purpleLayer_.bounds = rect; 125 | purpleLayer_.position = CGPointMake(25., 25.); 126 | purpleLayer_.delegate = self; 127 | [purpleLayer_ setNeedsDisplay]; 128 | 129 | yellowLayer_.backgroundColor = [UIColorFromRGBA(0xFFFF00, .75) CGColor]; 130 | yellowLayer_.bounds = rect; 131 | yellowLayer_.position = CGPointMake(0., 0.); 132 | yellowLayer_.delegate = self; 133 | [yellowLayer_ setNeedsDisplay]; 134 | } 135 | 136 | 137 | - (void)viewWillDisappear:(BOOL)animated { 138 | containerLayer_.delegate = nil; 139 | redLayer_.delegate = nil; 140 | blueLayer_.delegate = nil; 141 | purpleLayer_.delegate = nil; 142 | yellowLayer_.delegate = nil; 143 | } 144 | 145 | - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { 146 | [layer debugDrawAnchorPointInContext:context withSize:CGSizeMake(6., 6.) color:[UIColor blackColor]]; 147 | } 148 | 149 | #pragma mark Event Handlers 150 | 151 | - (void)toggleBlueMask:(id)sender { 152 | blueLayer_.masksToBounds = !blueLayer_.masksToBounds; 153 | } 154 | 155 | - (void)toggleContainerMask:(id)sender { 156 | containerLayer_.masksToBounds = !containerLayer_.masksToBounds; 157 | } 158 | 159 | - (void)reparentPurpleLayer:(id)sender { 160 | BOOL isChildOfRoot = (purpleLayer_.superlayer == containerLayer_); 161 | [purpleLayer_ removeFromSuperlayer]; 162 | if(isChildOfRoot) { 163 | [blueLayer_ addSublayer:purpleLayer_]; 164 | } else { 165 | [containerLayer_ addSublayer:purpleLayer_]; 166 | } 167 | } 168 | 169 | - (void)addRemoveYellow:(id)sender { 170 | if(yellowLayer_.superlayer == nil) { 171 | CALayer *purpleParent = purpleLayer_.superlayer; 172 | [purpleParent insertSublayer:yellowLayer_ below:purpleLayer_]; 173 | } else { 174 | [yellowLayer_ removeFromSuperlayer]; 175 | } 176 | } 177 | 178 | @end 179 | -------------------------------------------------------------------------------- /Classes/Samples/SampleManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import "LayerTree.h" 27 | 28 | @interface Sample : UIViewController { 29 | } 30 | 31 | + (NSString *)name; 32 | 33 | @end 34 | 35 | 36 | @interface SampleManager : NSObject { 37 | NSArray *groups_; 38 | NSArray *samples_; 39 | } 40 | 41 | - (NSUInteger)groupCount; 42 | - (NSUInteger)sampleCountForGroup:(NSUInteger)group; 43 | - (NSArray *)samplesForGroup:(NSUInteger)group; 44 | - (NSString *)sampleNameAtIndexPath:(NSIndexPath *)indexPath; 45 | - (UIViewController *)sampleForIndexPath:(NSIndexPath *)indexPath; 46 | - (NSString *)groupTitleAtIndex:(NSUInteger)index; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Classes/Samples/SampleManager.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "SampleManager.h" 26 | #import 27 | #import "LayerTree.h" 28 | #import "ShapeLayers.h" 29 | #import "GeometricProperties.h" 30 | #import "LayerDrawing.h" 31 | #import "BasicAnimation.h" 32 | #import "KeyframeAnimation.h" 33 | #import "GradientLayers.h" 34 | #import "LayerTransforms.h" 35 | #import "ImageContent.h" 36 | #import "StyleProperties.h" 37 | #import "LayerActions.h" 38 | #import "AnimationTransactions.h" 39 | #import "AnimationGroups.h" 40 | #import "LayerTransitions.h" 41 | #import "BitmapFontCounter.h" 42 | #import "ShutterTransition.h" 43 | #import "AdvancedShapeLayers.h" 44 | #import "TextLayers.h" 45 | #import "CustomPropertyAnimation.h" 46 | 47 | @interface UIViewController (ThisIsHereToAviodACompilerWarning) 48 | 49 | + (NSString *)friendlyName; 50 | 51 | @end 52 | 53 | @implementation SampleManager 54 | 55 | - (id)init { 56 | self = [super init]; 57 | if (self != nil) { 58 | NSArray *geom = [NSArray arrayWithObjects:[GeometricProperties class], [LayerTransforms class], nil]; 59 | NSArray *hier = [NSArray arrayWithObjects:[LayerTree class], nil]; 60 | NSArray *drawing = [NSArray arrayWithObjects:[ImageContent class], [LayerDrawing class], [StyleProperties class], nil]; 61 | NSArray *animation = [NSArray arrayWithObjects:[BasicAnimation class], [AnimationGroups class], [KeyframeAnimation class], [LayerActions class], 62 | [LayerTransitions class], [CustomPropertyAnimation class], nil]; 63 | NSArray *special = [NSArray arrayWithObjects:[ShapeLayers class], [AdvancedShapeLayers class], [GradientLayers class], [TextLayers class], nil]; 64 | NSArray *advanced = [NSArray arrayWithObjects:[BitmapFontCounter class], [ShutterTransition class], nil]; 65 | 66 | 67 | groups_ = [[NSArray alloc] initWithObjects:@"Geometry & Transforms", 68 | @"Layer Hierarchy", 69 | @"Content & Style Properties", 70 | @"Animation", 71 | @"Special Layer Types", 72 | @"Avanced Techniques", 73 | nil]; 74 | 75 | samples_ = [[NSArray alloc] initWithObjects:geom, hier, drawing, animation, special, advanced, nil]; 76 | } 77 | return self; 78 | } 79 | 80 | 81 | - (NSUInteger)groupCount { 82 | return [groups_ count]; 83 | } 84 | 85 | - (NSUInteger)sampleCountForGroup:(NSUInteger)group { 86 | return [[samples_ objectAtIndex:group] count]; 87 | } 88 | 89 | - (NSArray *)samplesForGroup:(NSUInteger)group { 90 | return [[[samples_ objectAtIndex:group] copy] autorelease]; 91 | } 92 | 93 | - (NSString *)sampleNameAtIndexPath:(NSIndexPath *)indexPath { 94 | NSArray *samples = [samples_ objectAtIndex:indexPath.section]; 95 | Class clazz = [samples objectAtIndex:indexPath.row]; 96 | return [clazz friendlyName]; 97 | } 98 | 99 | - (UIViewController *)sampleForIndexPath:(NSIndexPath *)indexPath { 100 | NSArray *samples = [samples_ objectAtIndex:indexPath.section]; 101 | Class clazz = [samples objectAtIndex:indexPath.row]; 102 | UIViewController *instance = [[clazz alloc] initWithNibName:nil bundle:nil]; 103 | return [instance autorelease]; 104 | } 105 | 106 | - (NSString *)groupTitleAtIndex:(NSUInteger)index { 107 | return [[[groups_ objectAtIndex:index] copy] autorelease]; 108 | } 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /Classes/Samples/ShapeLayers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface ShapeLayers : UIViewController { 28 | CAShapeLayer *shapeLayer_; 29 | UIButton *animateButton_; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Samples/ShapeLayers.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "ShapeLayers.h" 26 | 27 | @interface ShapeLayers () 28 | 29 | - (CGMutablePathRef)newRectPathInRect:(CGRect)rect; 30 | - (CGMutablePathRef)newCirclePathInRect:(CGRect)rect; 31 | - (void)animateShape:(id)sender; 32 | 33 | @end 34 | 35 | @implementation ShapeLayers 36 | 37 | + (NSString *)friendlyName { 38 | return @"Shape Layers"; 39 | } 40 | 41 | #pragma mark init and dealloc 42 | 43 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 44 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 45 | self.title = [[self class] friendlyName]; 46 | } 47 | return self; 48 | } 49 | 50 | - (void)dealloc { 51 | [shapeLayer_ release], shapeLayer_ = nil; 52 | [animateButton_ release], animateButton_ = nil; 53 | [super dealloc]; 54 | } 55 | 56 | #pragma mark Load and unload the view 57 | 58 | - (void)loadView { 59 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 60 | myView.backgroundColor = [UIColor whiteColor]; 61 | 62 | animateButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 63 | animateButton_.frame = CGRectMake(10., 10., 300., 44.); 64 | [animateButton_ setTitle:@"Animate!" forState:UIControlStateNormal]; 65 | [animateButton_ addTarget:self action:@selector(animateShape:) forControlEvents:UIControlEventTouchUpInside]; 66 | [myView addSubview:animateButton_]; 67 | 68 | shapeLayer_ = [[CAShapeLayer layer] retain]; 69 | [myView.layer addSublayer:shapeLayer_]; 70 | self.view = myView; 71 | } 72 | 73 | #pragma mark View drawing 74 | 75 | - (void)viewWillAppear:(BOOL)animated { 76 | shapeLayer_.backgroundColor = [[UIColor clearColor] CGColor]; 77 | shapeLayer_.frame = CGRectMake(0., 0., 200., 200.); 78 | shapeLayer_.position = self.view.center; 79 | CGPathRef path = [self newCirclePathInRect:shapeLayer_.bounds]; 80 | shapeLayer_.path = path; 81 | CGPathRelease(path); 82 | [shapeLayer_ setValue:[NSNumber numberWithBool:NO] forKey:@"isCircle"]; 83 | shapeLayer_.fillColor = [[UIColor blueColor] CGColor]; 84 | shapeLayer_.strokeColor = [[UIColor blackColor] CGColor]; 85 | shapeLayer_.lineWidth = 4.; 86 | shapeLayer_.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:8], [NSNumber numberWithInt:8], nil]; 87 | shapeLayer_.lineCap = kCALineCapRound; 88 | } 89 | 90 | - (void)viewDidAppear:(BOOL)animated { 91 | } 92 | 93 | #pragma mark Button Event Handlers 94 | 95 | - (void)animateShape:(id)sender { 96 | CGPathRef path; 97 | BOOL isCircle = [[shapeLayer_ valueForKey:@"isCircle"] boolValue]; 98 | if(isCircle) { 99 | path = [self newCirclePathInRect:shapeLayer_.bounds]; 100 | } else { 101 | path = [self newRectPathInRect:shapeLayer_.bounds]; 102 | } 103 | CABasicAnimation *pathAnim = [CABasicAnimation animationWithKeyPath:@"path"]; 104 | pathAnim.toValue = (id)path; 105 | pathAnim.duration = 1.; 106 | pathAnim.delegate = self; 107 | 108 | [shapeLayer_ setValue:[NSNumber numberWithBool:!isCircle] forKey:@"isCircle"]; 109 | [shapeLayer_ addAnimation:pathAnim forKey:@"animatePath"]; 110 | CGPathRelease(path); 111 | } 112 | 113 | #pragma mark Animation Delegate 114 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished { 115 | CGPathRef path; 116 | BOOL isCircle = [[shapeLayer_ valueForKey:@"isCircle"] boolValue]; 117 | [CATransaction begin]; 118 | [CATransaction setDisableActions:YES]; 119 | if(isCircle) { 120 | path = [self newRectPathInRect:shapeLayer_.bounds]; 121 | } else { 122 | path = [self newCirclePathInRect:shapeLayer_.bounds]; 123 | } 124 | shapeLayer_.path = path; 125 | CGPathRelease(path); 126 | [CATransaction commit]; 127 | } 128 | 129 | #pragma mark Paths 130 | 131 | - (CGMutablePathRef)newRectPathInRect:(CGRect)rect { 132 | CGMutablePathRef path = CGPathCreateMutable(); 133 | CGPathAddRect(path, NULL, rect); 134 | return path; 135 | } 136 | 137 | - (CGMutablePathRef)newCirclePathInRect:(CGRect)rect { 138 | CGMutablePathRef path = CGPathCreateMutable(); 139 | CGPathAddEllipseInRect(path, NULL, rect); 140 | return path; 141 | } 142 | 143 | 144 | @end 145 | -------------------------------------------------------------------------------- /Classes/Samples/StyleProperties.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | @interface StyleProperties : UIViewController { 29 | CALayer *simpleLayer_; 30 | CALayer *maskLayer_; 31 | 32 | UIButton *roundCornersButton_; 33 | UIButton *toggleBorderButton_; 34 | UIButton *toggleOpacityButton_; 35 | UIButton *toggleMaskButton_; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Classes/Samples/StyleProperties.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import "StyleProperties.h" 26 | 27 | 28 | @implementation StyleProperties 29 | 30 | + (NSString *)friendlyName { 31 | return @"Style Properties"; 32 | } 33 | 34 | #pragma mark init and dealloc 35 | 36 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 37 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 38 | self.title = [[self class] friendlyName]; 39 | } 40 | return self; 41 | } 42 | 43 | - (void)dealloc { 44 | [simpleLayer_ release], simpleLayer_ = nil; 45 | [maskLayer_ release], maskLayer_ = nil; 46 | [roundCornersButton_ release], roundCornersButton_ = nil; 47 | [toggleBorderButton_ release], toggleBorderButton_ = nil; 48 | [toggleOpacityButton_ release], toggleOpacityButton_ = nil; 49 | [toggleMaskButton_ release], toggleMaskButton_ = nil; 50 | [super dealloc]; 51 | } 52 | 53 | #pragma mark Load and unload the view 54 | 55 | - (void)loadView { 56 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 57 | myView.backgroundColor = [UIColor whiteColor]; 58 | 59 | roundCornersButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 60 | roundCornersButton_.frame = CGRectMake(10., 10., 145., 44.); 61 | [roundCornersButton_ setTitle:@"Round Corners" forState:UIControlStateNormal]; 62 | [roundCornersButton_ addTarget:self action:@selector(roundCorners:) forControlEvents:UIControlEventTouchUpInside]; 63 | [myView addSubview:roundCornersButton_]; 64 | 65 | toggleBorderButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 66 | toggleBorderButton_.frame = CGRectMake(165., 10., 145., 44.); 67 | [toggleBorderButton_ setTitle:@"Toggle Border" forState:UIControlStateNormal]; 68 | [toggleBorderButton_ addTarget:self action:@selector(toggleBorder:) forControlEvents:UIControlEventTouchUpInside]; 69 | [myView addSubview:toggleBorderButton_]; 70 | 71 | toggleOpacityButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 72 | toggleOpacityButton_.frame = CGRectMake(10., 60., 145., 44.); 73 | [toggleOpacityButton_ setTitle:@"Toggle Opacity" forState:UIControlStateNormal]; 74 | [toggleOpacityButton_ addTarget:self action:@selector(toggleOpacity:) forControlEvents:UIControlEventTouchUpInside]; 75 | [myView addSubview:toggleOpacityButton_]; 76 | 77 | toggleMaskButton_ = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 78 | toggleMaskButton_.frame = CGRectMake(165., 60., 145., 44.); 79 | [toggleMaskButton_ setTitle:@"Toggle Mask Layer" forState:UIControlStateNormal]; 80 | [toggleMaskButton_ addTarget:self action:@selector(toggleMaskLayer:) forControlEvents:UIControlEventTouchUpInside]; 81 | [myView addSubview:toggleMaskButton_]; 82 | 83 | simpleLayer_ = [[CALayer layer] retain]; 84 | maskLayer_ = [[CALayer layer] retain]; 85 | [myView.layer addSublayer:simpleLayer_]; 86 | self.view = myView; 87 | } 88 | 89 | #pragma mark View drawing 90 | 91 | - (void)viewWillAppear:(BOOL)animated { 92 | simpleLayer_.backgroundColor = [[UIColor greenColor] CGColor]; 93 | simpleLayer_.bounds = CGRectMake(0., 0., 200., 200.); 94 | simpleLayer_.position = CGPointMake(160., 250.); 95 | [simpleLayer_ setNeedsDisplay]; 96 | 97 | maskLayer_.bounds = simpleLayer_.bounds; 98 | maskLayer_.anchorPoint = CGPointZero; 99 | maskLayer_.contents = (id)[[UIImage imageNamed:@"StarMask.png"] CGImage]; 100 | } 101 | 102 | - (void)viewWillDisappear:(BOOL)animated { 103 | } 104 | 105 | #pragma mark Event Handlers 106 | 107 | - (void)roundCorners:(id)sender { 108 | if(simpleLayer_.cornerRadius > 0.) { 109 | simpleLayer_.cornerRadius = 0.; 110 | } else { 111 | simpleLayer_.cornerRadius = 25.; 112 | } 113 | } 114 | 115 | - (void)toggleBorder:(id)sender { 116 | if(simpleLayer_.borderWidth > 0.) { 117 | simpleLayer_.borderWidth = 0.; 118 | } else { 119 | simpleLayer_.borderWidth = 4.; 120 | simpleLayer_.borderColor = [[UIColor redColor] CGColor]; 121 | } 122 | } 123 | 124 | - (void)toggleOpacity:(id)sender { 125 | if(simpleLayer_.opacity < 1.) { 126 | simpleLayer_.opacity = 1.; 127 | } else { 128 | simpleLayer_.opacity = .25; 129 | } 130 | } 131 | 132 | - (void)toggleMaskLayer:(id)sender { 133 | CALayer *mask = (simpleLayer_.mask == nil) ? maskLayer_ : nil; 134 | [simpleLayer_ removeFromSuperlayer]; 135 | simpleLayer_.mask = mask; 136 | [self.view.layer addSublayer:simpleLayer_]; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /Classes/Samples/TextLayers.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface TextLayers : UIViewController { 28 | CATextLayer *attributedTextLayer_; 29 | CATextLayer *normalTextLayer_; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/Samples/TextLayers.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | /* 26 | Delicious font by Jos Buivenga (exljbris) -> http://www.exljbris.com 27 | Retrieved from http://www.josbuivenga.demon.nl/delicious.html 28 | */ 29 | 30 | #import "TextLayers.h" 31 | #import 32 | 33 | #define EXAMPLE_STRING \ 34 | @"Hello everyone! I am a CATextLayer.\n\n" \ 35 | @"I can render any attributed string you want. " \ 36 | @"Even if it's long like this one and wraps.\n\n" \ 37 | @"Want to see something really cool?\n\n" \ 38 | @"A blue link: http://www.freetimestudios.com/" 39 | 40 | 41 | @implementation TextLayers 42 | 43 | + (NSString *)friendlyName { 44 | return @"Text Layers"; 45 | } 46 | 47 | #pragma mark init and dealloc 48 | 49 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 50 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 51 | self.title = [[self class] friendlyName]; 52 | } 53 | return self; 54 | } 55 | 56 | - (void)dealloc { 57 | [attributedTextLayer_ release], attributedTextLayer_ = nil; 58 | [normalTextLayer_ release], normalTextLayer_ = nil; 59 | [super dealloc]; 60 | } 61 | 62 | #pragma mark Load and unload the view 63 | 64 | - (void)loadView { 65 | UIView *myView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; 66 | myView.backgroundColor = [UIColor whiteColor]; 67 | myView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 68 | self.view = myView; 69 | 70 | attributedTextLayer_ = [[CATextLayer alloc] init]; 71 | attributedTextLayer_.frame = self.view.bounds; 72 | [self.view.layer addSublayer:attributedTextLayer_]; 73 | 74 | UIButton *animateButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 75 | [animateButton setTitle: @"Animate Text" forState:UIControlStateNormal]; 76 | animateButton.bounds = CGRectMake(0.f, 0.f, self.view.bounds.size.width - 20.f, 44.f); 77 | animateButton.center = CGPointMake(self.view.center.x, self.view.bounds.size.height - 34.f); 78 | animateButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 79 | [animateButton addTarget:self action:@selector(animate) forControlEvents:UIControlEventTouchUpInside]; 80 | [self.view addSubview:animateButton]; 81 | } 82 | 83 | #pragma mark View drawing 84 | 85 | - (void)colorAndUnderlineLinksInAttributedString:(NSMutableAttributedString *)attrString 86 | withColor:(UIColor *)linkColor 87 | underlineStyle:(CTUnderlineStyle)underlineStyle 88 | { 89 | //NSDataDetector is part of the new (in iOS 4) regular expression engine 90 | Class nsDataDetector = NSClassFromString(@"NSDataDetector"); 91 | if(nsDataDetector) { 92 | NSError *error = nil; 93 | id linkDetector = [nsDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error]; 94 | NSAssert(error == nil, @"Problem creating the link detector: %@", [error localizedDescription]); 95 | [linkDetector enumerateMatchesInString:[attrString string] 96 | options:0 97 | range:NSMakeRange(0, [attrString length]) 98 | usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) 99 | { 100 | [attrString addAttribute:(NSString *)kCTForegroundColorAttributeName 101 | value:(id)[linkColor CGColor] 102 | range:[match range]]; 103 | 104 | [attrString addAttribute:(NSString *)kCTUnderlineStyleAttributeName 105 | value:[NSNumber numberWithInt:underlineStyle] 106 | range:[match range]]; 107 | }]; 108 | } else { 109 | SHOW_VERSION_ALERT_FOR_FEATURE(@"Link highlighting") 110 | } 111 | } 112 | 113 | - (CTFontRef)newFontWithAttributes:(NSDictionary *)attributes { 114 | CTFontDescriptorRef descriptor = CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes); 115 | CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, 0, NULL); 116 | CFRelease(descriptor); 117 | return font; 118 | } 119 | 120 | - (CTFontRef)newCustomFontWithName:(NSString *)fontName ofType:(NSString *)type attributes:(NSDictionary *)attributes { 121 | NSString *fontPath = [[NSBundle mainBundle] pathForResource:fontName ofType:type]; 122 | 123 | NSData *data = [[NSData alloc] initWithContentsOfFile:fontPath]; 124 | CGDataProviderRef fontProvider = CGDataProviderCreateWithCFData((CFDataRef)data); 125 | [data release]; 126 | 127 | CGFontRef cgFont = CGFontCreateWithDataProvider(fontProvider); 128 | CGDataProviderRelease(fontProvider); 129 | 130 | CTFontDescriptorRef fontDescriptor = CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes); 131 | CTFontRef font = CTFontCreateWithGraphicsFont(cgFont, 0, NULL, fontDescriptor); 132 | CFRelease(fontDescriptor); 133 | CGFontRelease(cgFont); 134 | return font; 135 | } 136 | 137 | - (CGSize)suggestSizeAndFitRange:(CFRange *)range 138 | forAttributedString:(NSMutableAttributedString *)attrString 139 | usingSize:(CGSize)referenceSize 140 | { 141 | CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attrString); 142 | CGSize suggestedSize = 143 | CTFramesetterSuggestFrameSizeWithConstraints(framesetter, 144 | CFRangeMake(0, [attrString length]), 145 | NULL, 146 | referenceSize, 147 | range); 148 | 149 | //HACK: There is a bug in Core Text where suggested size is not quite right 150 | //I'm padding it with half line height to make up for the bug. 151 | //see the coretext-dev list: http://web.archiveorange.com/archive/v/nagQXwVJ6Gzix0veMh09 152 | 153 | CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString); 154 | CGFloat ascent, descent, leading; 155 | CTLineGetTypographicBounds(line, &ascent, &descent, &leading); 156 | CGFloat lineHeight = ascent + descent + leading; 157 | suggestedSize.height += lineHeight / 2.f; 158 | //END HACK 159 | 160 | return suggestedSize; 161 | } 162 | 163 | - (void)setupAttributedTextLayerWithFont:(CTFontRef)font { 164 | NSDictionary *baseAttributes = [NSDictionary dictionaryWithObject:(id)font 165 | forKey:(NSString *)kCTFontAttributeName]; 166 | 167 | NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:EXAMPLE_STRING 168 | attributes:baseAttributes]; 169 | CFRelease(font); 170 | 171 | [self colorAndUnderlineLinksInAttributedString:attrString 172 | withColor:[UIColor blueColor] 173 | underlineStyle:kCTUnderlineStyleSingle|kCTUnderlinePatternDash]; 174 | 175 | //Make the class name in the string Courier Bold and red 176 | NSDictionary *fontAttributes = [NSDictionary dictionaryWithObjectsAndKeys: 177 | @"Courier", (NSString *)kCTFontFamilyNameAttribute, 178 | @"Bold", (NSString *)kCTFontStyleNameAttribute, 179 | [NSNumber numberWithFloat:16.f], (NSString *)kCTFontSizeAttribute, 180 | nil]; 181 | CTFontRef courierFont = [self newFontWithAttributes:fontAttributes]; 182 | 183 | NSRange rangeOfClassName = [[attrString string] rangeOfString:@"CATextLayer"]; 184 | 185 | [attrString addAttribute:(NSString *)kCTFontAttributeName 186 | value:(id)courierFont 187 | range:rangeOfClassName]; 188 | [attrString addAttribute:(NSString *)kCTForegroundColorAttributeName 189 | value:(id)[[UIColor redColor] CGColor] 190 | range:rangeOfClassName]; 191 | 192 | CFRelease(courierFont); 193 | 194 | attributedTextLayer_.string = attrString; 195 | attributedTextLayer_.wrapped = YES; 196 | CFRange fitRange; 197 | CGRect textDisplayRect = CGRectInset(attributedTextLayer_.bounds, 10.f, 10.f); 198 | CGSize recommendedSize = [self suggestSizeAndFitRange:&fitRange 199 | forAttributedString:attrString 200 | usingSize:textDisplayRect.size]; 201 | [attributedTextLayer_ setValue:[NSValue valueWithCGSize:recommendedSize] forKeyPath:@"bounds.size"]; 202 | attributedTextLayer_.position = self.view.center; 203 | [attrString release]; 204 | } 205 | 206 | - (void)viewWillAppear:(BOOL)animated { 207 | CTFontRef font = [self newCustomFontWithName:@"Delicious-Roman" 208 | ofType:@"otf" 209 | attributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:16.f] 210 | forKey:(NSString *)kCTFontSizeAttribute]]; 211 | [self setupAttributedTextLayerWithFont:font]; 212 | 213 | CGRect screenBounds = [[UIScreen mainScreen] bounds]; 214 | 215 | normalTextLayer_ = [[CATextLayer alloc] init]; 216 | normalTextLayer_.font = font; 217 | normalTextLayer_.string = @"This is just a plain old CATextLayer"; 218 | normalTextLayer_.wrapped = YES; 219 | normalTextLayer_.foregroundColor = [[UIColor purpleColor] CGColor]; 220 | normalTextLayer_.fontSize = 20.f; 221 | normalTextLayer_.alignmentMode = kCAAlignmentCenter; 222 | normalTextLayer_.frame = CGRectMake(0.f, 10.f, screenBounds.size.width, screenBounds.size.height / 10.f); 223 | [self.view.layer addSublayer:normalTextLayer_]; 224 | CFRelease(font); 225 | } 226 | 227 | - (void)viewDidAppear:(BOOL)animated { 228 | } 229 | 230 | #pragma mark Event Handlers 231 | 232 | - (void)animate { 233 | CABasicAnimation *spin = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 234 | spin.toValue = [NSNumber numberWithFloat:M_PI * 2]; 235 | spin.duration = 1.f; 236 | spin.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; 237 | 238 | [CATransaction begin]; 239 | if(IS_IOS4) { 240 | [CATransaction setCompletionBlock:^{ 241 | CABasicAnimation *squish = [CABasicAnimation animationWithKeyPath:@"transform"]; 242 | CATransform3D squishTransform = CATransform3DMakeScale(1.75f, .25f, 1.f); 243 | squish.toValue = [NSValue valueWithCATransform3D:squishTransform]; 244 | squish.duration = .5f; 245 | squish.repeatCount = 1; 246 | squish.autoreverses = YES; 247 | 248 | CABasicAnimation *fadeOutBG = [CABasicAnimation animationWithKeyPath:@"backgroundColor"]; 249 | fadeOutBG.toValue = (id)[[UIColor yellowColor] CGColor]; 250 | fadeOutBG.duration = .55f; 251 | fadeOutBG.repeatCount = 1; 252 | fadeOutBG.autoreverses = YES; 253 | fadeOutBG.beginTime = 1.f; 254 | 255 | CAAnimationGroup *group = [CAAnimationGroup animation]; 256 | group.animations = [NSArray arrayWithObjects:squish, fadeOutBG, nil]; 257 | group.duration = 2.f; 258 | group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 259 | 260 | [attributedTextLayer_ addAnimation:group forKey:@"SquishAndHighlight"]; 261 | }]; 262 | } 263 | [attributedTextLayer_ addAnimation:spin forKey:@"spinTheText"]; 264 | [CATransaction commit]; 265 | } 266 | 267 | 268 | @end 269 | -------------------------------------------------------------------------------- /Classes/UsefulMacros.h: -------------------------------------------------------------------------------- 1 | #pragma mark - 2 | #pragma mark Math 3 | 4 | #define DEGREES_TO_RADIANS(d) (d * M_PI / 180) 5 | #define RADIANS_TO_DEGREES(r) (r * 180 / M_PI) 6 | 7 | #pragma mark - 8 | #pragma mark Colors 9 | 10 | #define RGBCOLOR(r,g,b) \ 11 | [UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:1.f] 12 | 13 | #define RGBACOLOR(r,g,b,a) \ 14 | [UIColor colorWithRed:r/256.f green:g/256.f blue:b/256.f alpha:a] 15 | 16 | #define UIColorFromRGB(rgbValue) \ 17 | [UIColor \ 18 | colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 19 | green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ 20 | blue:((float)(rgbValue & 0x0000FF))/255.0 \ 21 | alpha:1.0] 22 | 23 | #define UIColorFromRGBA(rgbValue, alphaValue) \ 24 | [UIColor \ 25 | colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ 26 | green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \ 27 | blue:((float)(rgbValue & 0x0000FF))/255.0 \ 28 | alpha:alphaValue] 29 | 30 | #pragma mark - 31 | #pragma mark iOS 4 Version Checkers 32 | 33 | #define IS_IOS4 ([[[UIDevice currentDevice] systemVersion] hasPrefix:@"4"]) 34 | 35 | #define CA360_SAMPLE_IOS4_ONLY \ 36 | if(!IS_IOS4) { \ 37 | UILabel *badVersionLabel = [[UILabel alloc] initWithFrame:self.view.frame]; \ 38 | badVersionLabel.text = @"This sample only works on iOS 4+"; \ 39 | badVersionLabel.font = [UIFont boldSystemFontOfSize:26.f]; \ 40 | badVersionLabel.textColor = [UIColor blackColor]; \ 41 | badVersionLabel.textAlignment = UITextAlignmentCenter; \ 42 | badVersionLabel.adjustsFontSizeToFitWidth = YES; \ 43 | [self.view addSubview:badVersionLabel]; \ 44 | [badVersionLabel release]; \ 45 | NSLog(@"The sample '%@' only works in iOS 4+", [[self class] friendlyName]); \ 46 | return; \ 47 | } 48 | 49 | #define SHOW_VERSION_ALERT_FOR_FEATURE(__featureName) \ 50 | UIAlertView *__versionAlert = \ 51 | [[[UIAlertView alloc] initWithTitle:@"Version Warning" \ 52 | message:[NSString stringWithFormat:@"%@ uses features added " \ 53 | @"in iOS 4, and it will only work on " \ 54 | @"devices running iOS 4.0 or higher.", \ 55 | __featureName] \ 56 | delegate:nil \ 57 | cancelButtonTitle:@"OK" \ 58 | otherButtonTitles:nil] autorelease]; \ 59 | [__versionAlert show]; 60 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | CA360 - Core Animation Examples for iOS 2 | ======================================= 3 | 4 | The code in this project was originally created for a presentation at the fall 2009 5 | 360idev conference in Denver, CO. I have continued to add to it and update the 6 | examples, and it is now the repository for all of my Core Animation examples 7 | and sample code, whether they are for blog posts, articles or conference 8 | presentations. 9 | -------------------------------------------------------------------------------- /Resources-iPad/Resources/MainWindow-iPad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 768 5 | 10D573 6 | 762 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 87 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBIPadFramework 35 | 36 | 37 | IBFirstResponder 38 | IBIPadFramework 39 | 40 | 41 | IBIPadFramework 42 | 43 | 44 | 45 | 1316 46 | 47 | {768, 1024} 48 | 49 | 50 | 1 51 | MSAxIDEAA 52 | 53 | NO 54 | NO 55 | 56 | 2 57 | 58 | IBIPadFramework 59 | 60 | 61 | 62 | 63 | YES 64 | 65 | 66 | delegate 67 | 68 | 69 | 70 | 4 71 | 72 | 73 | 74 | window 75 | 76 | 77 | 78 | 5 79 | 80 | 81 | 82 | 83 | YES 84 | 85 | 0 86 | 87 | 88 | 89 | 90 | 91 | 2 92 | 93 | 94 | YES 95 | 96 | 97 | 98 | 99 | -1 100 | 101 | 102 | File's Owner 103 | 104 | 105 | 3 106 | 107 | 108 | 109 | 110 | -2 111 | 112 | 113 | 114 | 115 | 116 | 117 | YES 118 | 119 | YES 120 | -1.CustomClassName 121 | -2.CustomClassName 122 | 2.IBAttributePlaceholdersKey 123 | 2.IBEditorWindowLastContentRect 124 | 2.IBLastUsedUIStatusBarStylesToTargetRuntimesMap 125 | 2.IBPluginDependency 126 | 3.CustomClassName 127 | 3.IBPluginDependency 128 | 129 | 130 | YES 131 | UIApplication 132 | UIResponder 133 | 134 | YES 135 | 136 | 137 | YES 138 | 139 | 140 | {{157, 4}, {783, 852}} 141 | 142 | IBCocoaTouchFramework 143 | 144 | 145 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 146 | CA360AppDelegate 147 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 148 | 149 | 150 | 151 | YES 152 | 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | YES 160 | 161 | 162 | YES 163 | 164 | 165 | 166 | 15 167 | 168 | 169 | 170 | YES 171 | 172 | CA360AppDelegate 173 | NSObject 174 | 175 | window 176 | UIWindow 177 | 178 | 179 | IBProjectSource 180 | Classes/CA360AppDelegate.h 181 | 182 | 183 | 184 | 185 | YES 186 | 187 | NSObject 188 | 189 | IBFrameworkSource 190 | Foundation.framework/Headers/NSError.h 191 | 192 | 193 | 194 | NSObject 195 | 196 | IBFrameworkSource 197 | Foundation.framework/Headers/NSFileManager.h 198 | 199 | 200 | 201 | NSObject 202 | 203 | IBFrameworkSource 204 | Foundation.framework/Headers/NSKeyValueCoding.h 205 | 206 | 207 | 208 | NSObject 209 | 210 | IBFrameworkSource 211 | Foundation.framework/Headers/NSKeyValueObserving.h 212 | 213 | 214 | 215 | NSObject 216 | 217 | IBFrameworkSource 218 | Foundation.framework/Headers/NSKeyedArchiver.h 219 | 220 | 221 | 222 | NSObject 223 | 224 | IBFrameworkSource 225 | Foundation.framework/Headers/NSNetServices.h 226 | 227 | 228 | 229 | NSObject 230 | 231 | IBFrameworkSource 232 | Foundation.framework/Headers/NSObject.h 233 | 234 | 235 | 236 | NSObject 237 | 238 | IBFrameworkSource 239 | Foundation.framework/Headers/NSPort.h 240 | 241 | 242 | 243 | NSObject 244 | 245 | IBFrameworkSource 246 | Foundation.framework/Headers/NSRunLoop.h 247 | 248 | 249 | 250 | NSObject 251 | 252 | IBFrameworkSource 253 | Foundation.framework/Headers/NSStream.h 254 | 255 | 256 | 257 | NSObject 258 | 259 | IBFrameworkSource 260 | Foundation.framework/Headers/NSThread.h 261 | 262 | 263 | 264 | NSObject 265 | 266 | IBFrameworkSource 267 | Foundation.framework/Headers/NSURL.h 268 | 269 | 270 | 271 | NSObject 272 | 273 | IBFrameworkSource 274 | Foundation.framework/Headers/NSURLConnection.h 275 | 276 | 277 | 278 | NSObject 279 | 280 | IBFrameworkSource 281 | Foundation.framework/Headers/NSXMLParser.h 282 | 283 | 284 | 285 | NSObject 286 | 287 | IBFrameworkSource 288 | QuartzCore.framework/Headers/CAAnimation.h 289 | 290 | 291 | 292 | NSObject 293 | 294 | IBFrameworkSource 295 | QuartzCore.framework/Headers/CALayer.h 296 | 297 | 298 | 299 | NSObject 300 | 301 | IBFrameworkSource 302 | UIKit.framework/Headers/UIAccessibility.h 303 | 304 | 305 | 306 | NSObject 307 | 308 | IBFrameworkSource 309 | UIKit.framework/Headers/UINibLoading.h 310 | 311 | 312 | 313 | NSObject 314 | 315 | IBFrameworkSource 316 | UIKit.framework/Headers/UIResponder.h 317 | 318 | 319 | 320 | UIApplication 321 | UIResponder 322 | 323 | IBFrameworkSource 324 | UIKit.framework/Headers/UIApplication.h 325 | 326 | 327 | 328 | UIResponder 329 | NSObject 330 | 331 | 332 | 333 | UIView 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UITextField.h 337 | 338 | 339 | 340 | UIView 341 | UIResponder 342 | 343 | IBFrameworkSource 344 | UIKit.framework/Headers/UIView.h 345 | 346 | 347 | 348 | UIWindow 349 | UIView 350 | 351 | IBFrameworkSource 352 | UIKit.framework/Headers/UIWindow.h 353 | 354 | 355 | 356 | 357 | 0 358 | IBIPadFramework 359 | 360 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 361 | 362 | 363 | 364 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 365 | 366 | 367 | 368 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 369 | 370 | 371 | YES 372 | CA360.xcodeproj 373 | 3 374 | 87 375 | 376 | 377 | -------------------------------------------------------------------------------- /Resources/Ben.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/Ben.png -------------------------------------------------------------------------------- /Resources/CA360-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.freetimestudios.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | YES 27 | NSMainNibFile 28 | MainWindow 29 | NSMainNibFile~ipad 30 | MainWindow-iPad 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Resources/Delicious-Roman.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/Delicious-Roman.otf -------------------------------------------------------------------------------- /Resources/FTSLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/FTSLogo.png -------------------------------------------------------------------------------- /Resources/MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 768 5 | 9J61 6 | 677 7 | 949.46 8 | 353.00 9 | 10 | YES 11 | 12 | 13 | YES 14 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 15 | 16 | 17 | YES 18 | 19 | YES 20 | 21 | 22 | YES 23 | 24 | 25 | 26 | YES 27 | 28 | IBFilesOwner 29 | 30 | 31 | IBFirstResponder 32 | 33 | 34 | 35 | 36 | 1316 37 | 38 | {320, 480} 39 | 40 | 1 41 | MSAxIDEAA 42 | 43 | NO 44 | NO 45 | 46 | 47 | 48 | 49 | 50 | YES 51 | 52 | 53 | delegate 54 | 55 | 56 | 57 | 4 58 | 59 | 60 | 61 | window 62 | 63 | 64 | 65 | 5 66 | 67 | 68 | 69 | 70 | YES 71 | 72 | 0 73 | 74 | YES 75 | 76 | 77 | 78 | 79 | 80 | 2 81 | 82 | 83 | YES 84 | 85 | 86 | 87 | 88 | -1 89 | 90 | 91 | RmlsZSdzIE93bmVyA 92 | 93 | 94 | 3 95 | 96 | 97 | 98 | 99 | -2 100 | 101 | 102 | 103 | 104 | 105 | 106 | YES 107 | 108 | YES 109 | -1.CustomClassName 110 | -2.CustomClassName 111 | 2.IBAttributePlaceholdersKey 112 | 2.IBEditorWindowLastContentRect 113 | 2.IBPluginDependency 114 | 3.CustomClassName 115 | 3.IBPluginDependency 116 | 117 | 118 | YES 119 | UIApplication 120 | UIResponder 121 | 122 | YES 123 | 124 | YES 125 | 126 | 127 | YES 128 | 129 | 130 | {{673, 376}, {320, 480}} 131 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 132 | CA360AppDelegate 133 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 134 | 135 | 136 | 137 | YES 138 | 139 | YES 140 | 141 | 142 | YES 143 | 144 | 145 | 146 | 147 | YES 148 | 149 | YES 150 | 151 | 152 | YES 153 | 154 | 155 | 156 | 15 157 | 158 | 159 | 160 | YES 161 | 162 | CA360AppDelegate 163 | NSObject 164 | 165 | YES 166 | 167 | YES 168 | navigationController 169 | window 170 | 171 | 172 | YES 173 | UINavigationController 174 | UIWindow 175 | 176 | 177 | 178 | IBProjectSource 179 | Classes/CA360AppDelegate.h 180 | 181 | 182 | 183 | UIView 184 | 185 | IBProjectSource 186 | Support/FTAnimationManager.h 187 | 188 | 189 | 190 | 191 | 0 192 | CA360.xcodeproj 193 | 3 194 | 3.0 195 | 196 | 197 | -------------------------------------------------------------------------------- /Resources/Mario.acorn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/Mario.acorn -------------------------------------------------------------------------------- /Resources/Mario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/Mario.png -------------------------------------------------------------------------------- /Resources/NumberStrip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/NumberStrip.png -------------------------------------------------------------------------------- /Resources/StarMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/StarMask.png -------------------------------------------------------------------------------- /Resources/Steve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/neror/CA360/87abbcdc8894c956d4828f6246d104c25113ec22/Resources/Steve.png -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License 3 | 4 | Copyright (c) 2009 Free Time Studios and Nathan Eror 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | #import 25 | 26 | int main(int argc, char *argv[]) { 27 | 28 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 29 | int retVal = UIApplicationMain(argc, argv, nil, nil); 30 | [pool release]; 31 | return retVal; 32 | } 33 | --------------------------------------------------------------------------------