├── .github └── FUNDING.yml ├── .gitignore ├── CITransitionHelper ├── CITransitionHelper.h └── CITransitionHelper.m ├── CITransitionSample.xcodeproj └── project.pbxproj ├── CITransitionSample ├── AppDelegate.h ├── AppDelegate.m ├── CITransitionSample-Info.plist ├── CITransitionSample-Prefix.pch ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── TransitionView.h ├── TransitionView.m ├── ViewController.h ├── ViewController.m ├── en.lproj │ ├── InfoPlist.strings │ └── ViewController.xib └── main.m ├── README.md ├── Resources └── images │ ├── mask.jpg │ ├── restrictedshine.tiff │ ├── sample1.jpg │ └── sample2.jpg └── ResourcesForREADME └── transitions.gif /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [shu223] 4 | custom: ['https://paypal.me/shu223'] 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/screenshots 64 | contents.xcworkspacedata 65 | -------------------------------------------------------------------------------- /CITransitionHelper/CITransitionHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // CITransitionHelper.h 3 | // 4 | // Copyright (c) 2013 Shuichi Tsutsumi. All rights reserved. 5 | // 6 | 7 | #import 8 | 9 | 10 | typedef enum { 11 | kCITransitionTypeCopyMachine, 12 | kCITransitionTypeDisintegrateWithMask, 13 | kCITransitionTypeDissolve, 14 | kCITransitionTypeFlash, 15 | kCITransitionTypeMod, 16 | kCITransitionTypeSwipe, 17 | kCITransitionTypePageCurl, 18 | kCITransitionTypePageCurlWithShadow, 19 | kCITransitionTypeRipple, 20 | 21 | // --- not supported ---- 22 | kCITransitionTypeBarSwipe, 23 | } CITransitionType; 24 | 25 | 26 | @interface CITransitionHelper : NSObject 27 | 28 | + (CIFilter *)transitionWithType:(CITransitionType)type 29 | extent:(CIVector *)extent; 30 | 31 | + (CIFilter *)transitionWithType:(CITransitionType)type 32 | extent:(CIVector *)extent 33 | optionImage:(CIImage *)optionImage; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /CITransitionHelper/CITransitionHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // CITransitionHelper.m 3 | // 4 | // Copyright (c) 2013 Shuichi Tsutsumi. All rights reserved. 5 | // 6 | 7 | #import "CITransitionHelper.h" 8 | 9 | @implementation CITransitionHelper 10 | 11 | + (CIFilter *)transitionWithType:(CITransitionType)type extent:(CIVector *)extent { 12 | 13 | return [CITransitionHelper transitionWithType:type 14 | extent:extent 15 | optionImage:nil]; 16 | } 17 | 18 | + (CIFilter *)transitionWithType:(CITransitionType)type extent:(CIVector *)extent optionImage:(CIImage *)optionImage 19 | { 20 | CIFilter *transition; 21 | 22 | switch (type) { 23 | 24 | case kCITransitionTypeDissolve: 25 | default: 26 | { 27 | transition = [CIFilter filterWithName: @"CIDissolveTransition"]; 28 | 29 | break; 30 | } 31 | case kCITransitionTypeCopyMachine: 32 | { 33 | transition = [CIFilter filterWithName:@"CICopyMachineTransition" 34 | keysAndValues: 35 | kCIInputExtentKey, extent, 36 | kCIInputColorKey, [CIColor colorWithRed:.6 green:1 blue:.8 alpha:1], 37 | kCIInputAngleKey, @0.0, 38 | kCIInputWidthKey, @40.0, 39 | @"inputOpacity", @1.0, 40 | nil]; 41 | 42 | break; 43 | } 44 | case kCITransitionTypeDisintegrateWithMask: 45 | { 46 | NSAssert(optionImage, @"no maskImage"); 47 | transition = [CIFilter filterWithName: @"CIDisintegrateWithMaskTransition" 48 | keysAndValues: 49 | kCIInputMaskImageKey, optionImage, 50 | @"inputShadowRadius", @10.0, 51 | @"inputShadowDensity", @0.7, 52 | @"inputShadowOffset", [CIVector vectorWithX:0.0 Y:-0.05 * extent.CGRectValue.size.height], 53 | nil]; 54 | 55 | break; 56 | } 57 | case kCITransitionTypeFlash: 58 | { 59 | transition = [CIFilter filterWithName: @"CIFlashTransition" 60 | keysAndValues: @"inputExtent", extent, 61 | kCIInputCenterKey,[CIVector vectorWithX:0.3*extent.CGRectValue.size.width 62 | Y:0.7*extent.CGRectValue.size.height], 63 | kCIInputColorKey, [CIColor colorWithRed:1.0 green:0.8 blue:0.6 alpha:1], 64 | @"inputMaxStriationRadius", @2.5, 65 | @"inputStriationStrength", @0.5, 66 | @"inputStriationContrast", @1.37, 67 | @"inputFadeThreshold", @0.85, 68 | nil]; 69 | 70 | break; 71 | } 72 | case kCITransitionTypeMod: 73 | { 74 | transition = [CIFilter filterWithName: @"CIModTransition" 75 | keysAndValues: 76 | kCIInputCenterKey,[CIVector vectorWithX:0.5*extent.CGRectValue.size.width 77 | Y:0.5*extent.CGRectValue.size.height], 78 | kCIInputAngleKey, @(M_PI*0.1), 79 | kCIInputRadiusKey, @30.0, 80 | @"inputCompression", @10.0, 81 | nil]; 82 | 83 | break; 84 | } 85 | case kCITransitionTypeSwipe: 86 | { 87 | transition = [CIFilter filterWithName:@"CISwipeTransition" 88 | keysAndValues: 89 | kCIInputExtentKey, extent, 90 | kCIInputColorKey, [CIColor colorWithRed:0 green:0 blue:0 alpha:0], 91 | kCIInputAngleKey, @(0.3 * M_PI), 92 | kCIInputWidthKey, @80.0, 93 | @"inputOpacity", @0.0, 94 | nil]; 95 | 96 | break; 97 | } 98 | case kCITransitionTypePageCurl: 99 | { 100 | NSAssert(optionImage, @"no shadingImage"); 101 | transition = [CIFilter filterWithName: @"CIPageCurlTransition" 102 | keysAndValues: 103 | kCIInputShadingImageKey, optionImage, 104 | kCIInputAngleKey, @(-M_PI*0.25), 105 | nil]; 106 | 107 | break; 108 | } 109 | case kCITransitionTypePageCurlWithShadow: 110 | { 111 | transition = [CIFilter filterWithName: @"CIPageCurlWithShadowTransition" 112 | keysAndValues: 113 | kCIInputAngleKey, @(-M_PI*0.25), 114 | nil]; 115 | 116 | break; 117 | } 118 | case kCITransitionTypeRipple: 119 | { 120 | NSAssert(optionImage, @"no shadingImage"); 121 | transition = [CIFilter filterWithName: @"CIRippleTransition" 122 | keysAndValues: 123 | kCIInputShadingImageKey, optionImage, 124 | kCIInputCenterKey, [CIVector vectorWithX:0.5*extent.CGRectValue.size.width 125 | Y:0.5*extent.CGRectValue.size.height], 126 | nil]; 127 | 128 | break; 129 | } 130 | } 131 | 132 | return transition; 133 | } 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /CITransitionSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8A8D99E51BC25CAD0089BCB8 /* restrictedshine.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 8A8D99E41BC25CAD0089BCB8 /* restrictedshine.tiff */; settings = {ASSET_TAGS = (); }; }; 11 | 8ADE4A2E16ECC0A900F8ABDE /* mask.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8ADE4A2D16ECC0A900F8ABDE /* mask.jpg */; }; 12 | 8ADE4A4D16ED669800F8ABDE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE4A3C16ED669800F8ABDE /* AppDelegate.m */; }; 13 | 8ADE4A5016ED669800F8ABDE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4116ED669800F8ABDE /* Default-568h@2x.png */; }; 14 | 8ADE4A5116ED669800F8ABDE /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4216ED669800F8ABDE /* Default.png */; }; 15 | 8ADE4A5216ED669800F8ABDE /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4316ED669800F8ABDE /* Default@2x.png */; }; 16 | 8ADE4A5316ED669800F8ABDE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4416ED669800F8ABDE /* InfoPlist.strings */; }; 17 | 8ADE4A5416ED669800F8ABDE /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4616ED669800F8ABDE /* ViewController.xib */; }; 18 | 8ADE4A5516ED669800F8ABDE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4816ED669800F8ABDE /* main.m */; }; 19 | 8ADE4A5616ED669800F8ABDE /* TransitionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4A16ED669800F8ABDE /* TransitionView.m */; }; 20 | 8ADE4A5716ED669800F8ABDE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE4A4C16ED669800F8ABDE /* ViewController.m */; }; 21 | 8ADE4A5C16ED66D800F8ABDE /* CITransitionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ADE4A5B16ED66D800F8ABDE /* CITransitionHelper.m */; }; 22 | 8AE3AE3B16EC1438005E65C7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AE3AE3A16EC1438005E65C7 /* UIKit.framework */; }; 23 | 8AE3AE3D16EC1438005E65C7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AE3AE3C16EC1438005E65C7 /* Foundation.framework */; }; 24 | 8AE3AE3F16EC1438005E65C7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AE3AE3E16EC1438005E65C7 /* CoreGraphics.framework */; }; 25 | 8AE3AE6316EC1757005E65C7 /* sample1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8AE3AE6116EC1757005E65C7 /* sample1.jpg */; }; 26 | 8AE3AE6416EC1757005E65C7 /* sample2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8AE3AE6216EC1757005E65C7 /* sample2.jpg */; }; 27 | 8AE3AE6616EC17F5005E65C7 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AE3AE6516EC17F5005E65C7 /* CoreImage.framework */; }; 28 | 8AE3AE6F16EC78B9005E65C7 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AE3AE6E16EC78B9005E65C7 /* OpenGLES.framework */; }; 29 | 8AE3AE7116EC796F005E65C7 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AE3AE7016EC796F005E65C7 /* GLKit.framework */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 8A8D99E41BC25CAD0089BCB8 /* restrictedshine.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = restrictedshine.tiff; sourceTree = ""; }; 34 | 8ADE4A2D16ECC0A900F8ABDE /* mask.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mask.jpg; sourceTree = ""; }; 35 | 8ADE4A3B16ED669800F8ABDE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | 8ADE4A3C16ED669800F8ABDE /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | 8ADE4A3F16ED669800F8ABDE /* CITransitionSample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "CITransitionSample-Info.plist"; sourceTree = ""; }; 38 | 8ADE4A4016ED669800F8ABDE /* CITransitionSample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CITransitionSample-Prefix.pch"; sourceTree = ""; }; 39 | 8ADE4A4116ED669800F8ABDE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 40 | 8ADE4A4216ED669800F8ABDE /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 41 | 8ADE4A4316ED669800F8ABDE /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 42 | 8ADE4A4516ED669800F8ABDE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 43 | 8ADE4A4716ED669800F8ABDE /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; }; 44 | 8ADE4A4816ED669800F8ABDE /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | 8ADE4A4916ED669800F8ABDE /* TransitionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransitionView.h; sourceTree = ""; }; 46 | 8ADE4A4A16ED669800F8ABDE /* TransitionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TransitionView.m; sourceTree = ""; }; 47 | 8ADE4A4B16ED669800F8ABDE /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 48 | 8ADE4A4C16ED669800F8ABDE /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 49 | 8ADE4A5A16ED66D800F8ABDE /* CITransitionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CITransitionHelper.h; sourceTree = ""; }; 50 | 8ADE4A5B16ED66D800F8ABDE /* CITransitionHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CITransitionHelper.m; sourceTree = ""; }; 51 | 8AE3AE3716EC1438005E65C7 /* CITransitionSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CITransitionSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 8AE3AE3A16EC1438005E65C7 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 53 | 8AE3AE3C16EC1438005E65C7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 54 | 8AE3AE3E16EC1438005E65C7 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 55 | 8AE3AE6116EC1757005E65C7 /* sample1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = sample1.jpg; sourceTree = ""; }; 56 | 8AE3AE6216EC1757005E65C7 /* sample2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = sample2.jpg; sourceTree = ""; }; 57 | 8AE3AE6516EC17F5005E65C7 /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; }; 58 | 8AE3AE6E16EC78B9005E65C7 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 59 | 8AE3AE7016EC796F005E65C7 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 8AE3AE3416EC1438005E65C7 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 8AE3AE7116EC796F005E65C7 /* GLKit.framework in Frameworks */, 68 | 8AE3AE6F16EC78B9005E65C7 /* OpenGLES.framework in Frameworks */, 69 | 8AE3AE6616EC17F5005E65C7 /* CoreImage.framework in Frameworks */, 70 | 8AE3AE3B16EC1438005E65C7 /* UIKit.framework in Frameworks */, 71 | 8AE3AE3D16EC1438005E65C7 /* Foundation.framework in Frameworks */, 72 | 8AE3AE3F16EC1438005E65C7 /* CoreGraphics.framework in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 8ADE4A3A16ED669800F8ABDE /* CITransitionSample */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 8ADE4A3B16ED669800F8ABDE /* AppDelegate.h */, 83 | 8ADE4A3C16ED669800F8ABDE /* AppDelegate.m */, 84 | 8ADE4A4B16ED669800F8ABDE /* ViewController.h */, 85 | 8ADE4A4C16ED669800F8ABDE /* ViewController.m */, 86 | 8ADE4A4616ED669800F8ABDE /* ViewController.xib */, 87 | 8ADE4A4916ED669800F8ABDE /* TransitionView.h */, 88 | 8ADE4A4A16ED669800F8ABDE /* TransitionView.m */, 89 | ); 90 | path = CITransitionSample; 91 | sourceTree = ""; 92 | }; 93 | 8ADE4A5816ED66A500F8ABDE /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 8ADE4A3F16ED669800F8ABDE /* CITransitionSample-Info.plist */, 97 | 8ADE4A4016ED669800F8ABDE /* CITransitionSample-Prefix.pch */, 98 | 8ADE4A4116ED669800F8ABDE /* Default-568h@2x.png */, 99 | 8ADE4A4216ED669800F8ABDE /* Default.png */, 100 | 8ADE4A4316ED669800F8ABDE /* Default@2x.png */, 101 | 8ADE4A4416ED669800F8ABDE /* InfoPlist.strings */, 102 | 8ADE4A4816ED669800F8ABDE /* main.m */, 103 | ); 104 | name = "Supporting Files"; 105 | path = CITransitionSample; 106 | sourceTree = ""; 107 | }; 108 | 8ADE4A5916ED66D800F8ABDE /* CITransitionHelper */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 8ADE4A5A16ED66D800F8ABDE /* CITransitionHelper.h */, 112 | 8ADE4A5B16ED66D800F8ABDE /* CITransitionHelper.m */, 113 | ); 114 | path = CITransitionHelper; 115 | sourceTree = ""; 116 | }; 117 | 8AE3AE2E16EC1438005E65C7 = { 118 | isa = PBXGroup; 119 | children = ( 120 | 8ADE4A5916ED66D800F8ABDE /* CITransitionHelper */, 121 | 8ADE4A3A16ED669800F8ABDE /* CITransitionSample */, 122 | 8ADE4A5816ED66A500F8ABDE /* Supporting Files */, 123 | 8AE3AE5F16EC1757005E65C7 /* Resources */, 124 | 8AE3AE3916EC1438005E65C7 /* Frameworks */, 125 | 8AE3AE3816EC1438005E65C7 /* Products */, 126 | ); 127 | sourceTree = ""; 128 | }; 129 | 8AE3AE3816EC1438005E65C7 /* Products */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 8AE3AE3716EC1438005E65C7 /* CITransitionSample.app */, 133 | ); 134 | name = Products; 135 | sourceTree = ""; 136 | }; 137 | 8AE3AE3916EC1438005E65C7 /* Frameworks */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 8AE3AE7016EC796F005E65C7 /* GLKit.framework */, 141 | 8AE3AE6E16EC78B9005E65C7 /* OpenGLES.framework */, 142 | 8AE3AE6516EC17F5005E65C7 /* CoreImage.framework */, 143 | 8AE3AE3A16EC1438005E65C7 /* UIKit.framework */, 144 | 8AE3AE3C16EC1438005E65C7 /* Foundation.framework */, 145 | 8AE3AE3E16EC1438005E65C7 /* CoreGraphics.framework */, 146 | ); 147 | name = Frameworks; 148 | sourceTree = ""; 149 | }; 150 | 8AE3AE5F16EC1757005E65C7 /* Resources */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 8AE3AE6016EC1757005E65C7 /* images */, 154 | ); 155 | path = Resources; 156 | sourceTree = ""; 157 | }; 158 | 8AE3AE6016EC1757005E65C7 /* images */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 8A8D99E41BC25CAD0089BCB8 /* restrictedshine.tiff */, 162 | 8ADE4A2D16ECC0A900F8ABDE /* mask.jpg */, 163 | 8AE3AE6116EC1757005E65C7 /* sample1.jpg */, 164 | 8AE3AE6216EC1757005E65C7 /* sample2.jpg */, 165 | ); 166 | path = images; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXGroup section */ 170 | 171 | /* Begin PBXNativeTarget section */ 172 | 8AE3AE3616EC1438005E65C7 /* CITransitionSample */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 8AE3AE5A16EC1438005E65C7 /* Build configuration list for PBXNativeTarget "CITransitionSample" */; 175 | buildPhases = ( 176 | 8AE3AE3316EC1438005E65C7 /* Sources */, 177 | 8AE3AE3416EC1438005E65C7 /* Frameworks */, 178 | 8AE3AE3516EC1438005E65C7 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | ); 184 | name = CITransitionSample; 185 | productName = CoreImageTransition; 186 | productReference = 8AE3AE3716EC1438005E65C7 /* CITransitionSample.app */; 187 | productType = "com.apple.product-type.application"; 188 | }; 189 | /* End PBXNativeTarget section */ 190 | 191 | /* Begin PBXProject section */ 192 | 8AE3AE2F16EC1438005E65C7 /* Project object */ = { 193 | isa = PBXProject; 194 | attributes = { 195 | LastUpgradeCheck = 0700; 196 | ORGANIZATIONNAME = "Shuichi Tsutsumi"; 197 | }; 198 | buildConfigurationList = 8AE3AE3216EC1438005E65C7 /* Build configuration list for PBXProject "CITransitionSample" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 0; 202 | knownRegions = ( 203 | en, 204 | ); 205 | mainGroup = 8AE3AE2E16EC1438005E65C7; 206 | productRefGroup = 8AE3AE3816EC1438005E65C7 /* Products */; 207 | projectDirPath = ""; 208 | projectRoot = ""; 209 | targets = ( 210 | 8AE3AE3616EC1438005E65C7 /* CITransitionSample */, 211 | ); 212 | }; 213 | /* End PBXProject section */ 214 | 215 | /* Begin PBXResourcesBuildPhase section */ 216 | 8AE3AE3516EC1438005E65C7 /* Resources */ = { 217 | isa = PBXResourcesBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | 8AE3AE6316EC1757005E65C7 /* sample1.jpg in Resources */, 221 | 8A8D99E51BC25CAD0089BCB8 /* restrictedshine.tiff in Resources */, 222 | 8AE3AE6416EC1757005E65C7 /* sample2.jpg in Resources */, 223 | 8ADE4A2E16ECC0A900F8ABDE /* mask.jpg in Resources */, 224 | 8ADE4A5016ED669800F8ABDE /* Default-568h@2x.png in Resources */, 225 | 8ADE4A5116ED669800F8ABDE /* Default.png in Resources */, 226 | 8ADE4A5216ED669800F8ABDE /* Default@2x.png in Resources */, 227 | 8ADE4A5316ED669800F8ABDE /* InfoPlist.strings in Resources */, 228 | 8ADE4A5416ED669800F8ABDE /* ViewController.xib in Resources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXResourcesBuildPhase section */ 233 | 234 | /* Begin PBXSourcesBuildPhase section */ 235 | 8AE3AE3316EC1438005E65C7 /* Sources */ = { 236 | isa = PBXSourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | 8ADE4A4D16ED669800F8ABDE /* AppDelegate.m in Sources */, 240 | 8ADE4A5516ED669800F8ABDE /* main.m in Sources */, 241 | 8ADE4A5616ED669800F8ABDE /* TransitionView.m in Sources */, 242 | 8ADE4A5716ED669800F8ABDE /* ViewController.m in Sources */, 243 | 8ADE4A5C16ED66D800F8ABDE /* CITransitionHelper.m in Sources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | /* End PBXSourcesBuildPhase section */ 248 | 249 | /* Begin PBXVariantGroup section */ 250 | 8ADE4A4416ED669800F8ABDE /* InfoPlist.strings */ = { 251 | isa = PBXVariantGroup; 252 | children = ( 253 | 8ADE4A4516ED669800F8ABDE /* en */, 254 | ); 255 | name = InfoPlist.strings; 256 | sourceTree = ""; 257 | }; 258 | 8ADE4A4616ED669800F8ABDE /* ViewController.xib */ = { 259 | isa = PBXVariantGroup; 260 | children = ( 261 | 8ADE4A4716ED669800F8ABDE /* en */, 262 | ); 263 | name = ViewController.xib; 264 | sourceTree = ""; 265 | }; 266 | /* End PBXVariantGroup section */ 267 | 268 | /* Begin XCBuildConfiguration section */ 269 | 8AE3AE5816EC1438005E65C7 /* Debug */ = { 270 | isa = XCBuildConfiguration; 271 | buildSettings = { 272 | ALWAYS_SEARCH_USER_PATHS = NO; 273 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 274 | CLANG_CXX_LIBRARY = "libc++"; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_CONSTANT_CONVERSION = YES; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INT_CONVERSION = YES; 280 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 281 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 282 | COPY_PHASE_STRIP = NO; 283 | ENABLE_TESTABILITY = YES; 284 | GCC_C_LANGUAGE_STANDARD = gnu99; 285 | GCC_DYNAMIC_NO_PIC = NO; 286 | GCC_OPTIMIZATION_LEVEL = 0; 287 | GCC_PREPROCESSOR_DEFINITIONS = ( 288 | "DEBUG=1", 289 | "$(inherited)", 290 | ); 291 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 294 | GCC_WARN_UNUSED_VARIABLE = YES; 295 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 296 | ONLY_ACTIVE_ARCH = YES; 297 | SDKROOT = iphoneos; 298 | }; 299 | name = Debug; 300 | }; 301 | 8AE3AE5916EC1438005E65C7 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 306 | CLANG_CXX_LIBRARY = "libc++"; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_WARN_CONSTANT_CONVERSION = YES; 309 | CLANG_WARN_EMPTY_BODY = YES; 310 | CLANG_WARN_ENUM_CONVERSION = YES; 311 | CLANG_WARN_INT_CONVERSION = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 314 | COPY_PHASE_STRIP = YES; 315 | GCC_C_LANGUAGE_STANDARD = gnu99; 316 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 317 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 318 | GCC_WARN_UNUSED_VARIABLE = YES; 319 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 320 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 321 | SDKROOT = iphoneos; 322 | VALIDATE_PRODUCT = YES; 323 | }; 324 | name = Release; 325 | }; 326 | 8AE3AE5B16EC1438005E65C7 /* Debug */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 330 | GCC_PREFIX_HEADER = "CITransitionSample/CITransitionSample-Prefix.pch"; 331 | INFOPLIST_FILE = "CITransitionSample/CITransitionSample-Info.plist"; 332 | PRODUCT_BUNDLE_IDENTIFIER = com.shu223.CITransitionSample; 333 | PRODUCT_NAME = CITransitionSample; 334 | WRAPPER_EXTENSION = app; 335 | }; 336 | name = Debug; 337 | }; 338 | 8AE3AE5C16EC1438005E65C7 /* Release */ = { 339 | isa = XCBuildConfiguration; 340 | buildSettings = { 341 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 342 | GCC_PREFIX_HEADER = "CITransitionSample/CITransitionSample-Prefix.pch"; 343 | INFOPLIST_FILE = "CITransitionSample/CITransitionSample-Info.plist"; 344 | PRODUCT_BUNDLE_IDENTIFIER = com.shu223.CITransitionSample; 345 | PRODUCT_NAME = CITransitionSample; 346 | WRAPPER_EXTENSION = app; 347 | }; 348 | name = Release; 349 | }; 350 | /* End XCBuildConfiguration section */ 351 | 352 | /* Begin XCConfigurationList section */ 353 | 8AE3AE3216EC1438005E65C7 /* Build configuration list for PBXProject "CITransitionSample" */ = { 354 | isa = XCConfigurationList; 355 | buildConfigurations = ( 356 | 8AE3AE5816EC1438005E65C7 /* Debug */, 357 | 8AE3AE5916EC1438005E65C7 /* Release */, 358 | ); 359 | defaultConfigurationIsVisible = 0; 360 | defaultConfigurationName = Release; 361 | }; 362 | 8AE3AE5A16EC1438005E65C7 /* Build configuration list for PBXNativeTarget "CITransitionSample" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | 8AE3AE5B16EC1438005E65C7 /* Debug */, 366 | 8AE3AE5C16EC1438005E65C7 /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | /* End XCConfigurationList section */ 372 | }; 373 | rootObject = 8AE3AE2F16EC1438005E65C7 /* Project object */; 374 | } 375 | -------------------------------------------------------------------------------- /CITransitionSample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) ViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CITransitionSample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "ViewController.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 18 | // Override point for customization after application launch. 19 | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; 20 | self.window.rootViewController = self.viewController; 21 | [self.window makeKeyAndVisible]; 22 | return YES; 23 | } 24 | 25 | - (void)applicationWillResignActive:(UIApplication *)application 26 | { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | - (void)applicationDidEnterBackground:(UIApplication *)application 32 | { 33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 35 | } 36 | 37 | - (void)applicationWillEnterForeground:(UIApplication *)application 38 | { 39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 40 | } 41 | 42 | - (void)applicationDidBecomeActive:(UIApplication *)application 43 | { 44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 45 | } 46 | 47 | - (void)applicationWillTerminate:(UIApplication *)application 48 | { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CITransitionSample/CITransitionSample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CITransitionSample/CITransitionSample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CITransitionSample' target in the 'CITransitionSample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | 16 | #ifdef DEBUG 17 | # define LOG(...) NSLog(__VA_ARGS__) 18 | # define LOG_CURRENT_METHOD NSLog(@"%@/%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd)) 19 | #else 20 | # define LOG(...) ; 21 | # define LOG_CURRENT_METHOD ; 22 | #endif 23 | 24 | #ifdef DEBUG 25 | # define NSLog(...) NSLog(__VA_ARGS__) 26 | #else 27 | # define NSLog(...) {} 28 | #endif 29 | 30 | #define L(s) NSLocalizedString(s, nil) 31 | #define Defaults [NSUserDefaults standardUserDefaults] 32 | -------------------------------------------------------------------------------- /CITransitionSample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/CITransitionSample/Default-568h@2x.png -------------------------------------------------------------------------------- /CITransitionSample/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/CITransitionSample/Default.png -------------------------------------------------------------------------------- /CITransitionSample/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/CITransitionSample/Default@2x.png -------------------------------------------------------------------------------- /CITransitionSample/TransitionView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TransitionView.h 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface TransitionView : GLKView 13 | 14 | - (void)changeTransition:(NSUInteger)transitionIndex; 15 | - (NSString *)currentFilterName; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /CITransitionSample/TransitionView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TransitionView.m 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import "TransitionView.h" 10 | #import "CITransitionHelper.h" 11 | 12 | 13 | @interface TransitionView () 14 | 15 | { 16 | NSTimeInterval base; 17 | CGRect imageRect; 18 | } 19 | @property (nonatomic, strong) CIImage *image1; 20 | @property (nonatomic, strong) CIImage *image2; 21 | @property (nonatomic, strong) CIImage *maskImage; 22 | @property (nonatomic, strong) CIImage *shadingImage; 23 | @property (nonatomic, strong) CIVector *extent; 24 | @property (nonatomic, strong) CIFilter *transition; 25 | @property (nonatomic, strong) CIContext *myContext; 26 | @end 27 | 28 | 29 | @implementation TransitionView 30 | 31 | - (void)awakeFromNib { 32 | 33 | // 遷移前後の画像とマスク画像を生成 34 | UIImage *uiImage1 = [UIImage imageNamed:@"sample1.jpg"]; 35 | UIImage *uiImage2 = [UIImage imageNamed:@"sample2.jpg"]; 36 | UIImage *uiMaskImage = [UIImage imageNamed:@"mask.jpg"]; 37 | UIImage *uiShadingImage = [UIImage imageNamed:@"restrictedshine.tiff"]; 38 | 39 | self.image1 = [CIImage imageWithCGImage:uiImage1.CGImage]; 40 | self.image2 = [CIImage imageWithCGImage:uiImage2.CGImage]; 41 | self.maskImage = [CIImage imageWithCGImage:uiMaskImage.CGImage]; 42 | self.shadingImage = [CIImage imageWithCGImage:uiShadingImage.CGImage]; 43 | 44 | // 表示領域を示す矩形(CGRect型) 45 | imageRect = CGRectMake(0, 0, uiImage1.size.width, uiImage1.size.height); 46 | 47 | 48 | // 遷移アニメーションが起こる領域を示す矩形(CIVector型) 49 | self.extent = [CIVector vectorWithX:0 50 | Y:0 51 | Z:uiImage1.size.width 52 | W:uiImage2.size.height]; 53 | 54 | // 遷移アニメーション制御の基準となる時刻 55 | base = [NSDate timeIntervalSinceReferenceDate]; 56 | 57 | // 遷移アニメーションを制御するタイマー 58 | [NSTimer scheduledTimerWithTimeInterval:1.0/30.0 59 | target:self 60 | selector:@selector(onTimer:) 61 | userInfo:nil 62 | repeats:YES]; 63 | 64 | // EAGLDelegateの設定 65 | self.delegate = self; 66 | 67 | // コンテキスト生成 68 | self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; 69 | self.myContext = [CIContext contextWithEAGLContext:self.context]; 70 | } 71 | 72 | 73 | // ============================================================================= 74 | #pragma mark - Private 75 | 76 | - (CIImage *)imageForTransitionAtTime:(float)time 77 | { 78 | // 遷移前後の画像をtimeによって切り替える 79 | if (fmodf(time, 2.0) < 1.0f) 80 | { 81 | [self.transition setValue:self.image1 forKey:@"inputImage"]; 82 | [self.transition setValue:self.image2 forKey:@"inputTargetImage"]; 83 | } 84 | else 85 | { 86 | [self.transition setValue:self.image2 forKey:@"inputImage"]; 87 | [self.transition setValue:self.image1 forKey:@"inputTargetImage"]; 88 | } 89 | 90 | // 遷移アニメーションの時間を指定 91 | CGFloat transitionTime = 0.5 * (1 - cos(fmodf(time, 1.0f) * M_PI)); 92 | 93 | [self.transition setValue:@(transitionTime) forKey:@"inputTime"]; 94 | 95 | // フィルタ処理実行 96 | CIImage *transitionImage = [self.transition valueForKey:@"outputImage"]; 97 | 98 | return transitionImage; 99 | } 100 | 101 | 102 | // ============================================================================= 103 | #pragma mark - Public 104 | 105 | - (void)changeTransition:(NSUInteger)transitionIndex { 106 | 107 | CITransitionType type; 108 | CIImage *optionImage; 109 | 110 | switch (transitionIndex) { 111 | 112 | case 0: 113 | default: 114 | type = kCITransitionTypeDissolve; 115 | break; 116 | 117 | case 1: 118 | type = kCITransitionTypeCopyMachine; 119 | break; 120 | 121 | case 2: 122 | type = kCITransitionTypeFlash; 123 | break; 124 | 125 | case 3: 126 | type = kCITransitionTypeMod; 127 | break; 128 | 129 | case 4: 130 | type = kCITransitionTypeSwipe; 131 | break; 132 | 133 | case 5: 134 | type = kCITransitionTypeDisintegrateWithMask; 135 | optionImage = self.maskImage; 136 | break; 137 | 138 | case 6: 139 | type = kCITransitionTypePageCurl; 140 | optionImage = self.shadingImage; 141 | break; 142 | 143 | case 7: 144 | type = kCITransitionTypePageCurlWithShadow; 145 | // optionImage = self.shadingImage; 146 | break; 147 | 148 | case 8: 149 | type = kCITransitionTypeRipple; 150 | optionImage = self.shadingImage; 151 | break; 152 | } 153 | 154 | if (optionImage) { 155 | self.transition = [CITransitionHelper transitionWithType:type 156 | extent:self.extent 157 | optionImage:optionImage]; 158 | } 159 | else { 160 | self.transition = [CITransitionHelper transitionWithType:type 161 | extent:self.extent]; 162 | } 163 | } 164 | 165 | - (NSString *)currentFilterName { 166 | 167 | return self.transition.name; 168 | } 169 | 170 | 171 | // ============================================================================= 172 | #pragma mark - GLKViewDelegate 173 | 174 | - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { 175 | 176 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 177 | dispatch_async(queue, ^{ 178 | 179 | // 遷移前後の画像をtimeによって切り替える 180 | float t = 0.4 * ([NSDate timeIntervalSinceReferenceDate] - base); 181 | 182 | CIImage *image = [self imageForTransitionAtTime:t]; 183 | 184 | // 描画領域を示す矩形 185 | CGFloat scale = [[UIScreen mainScreen] scale]; 186 | CGRect destRect = CGRectMake(0, self.bounds.size.height * scale - imageRect.size.height, 187 | imageRect.size.width, 188 | imageRect.size.height); 189 | 190 | dispatch_async(dispatch_get_main_queue(), ^{ 191 | 192 | [self.myContext drawImage:image 193 | inRect:destRect 194 | fromRect:imageRect]; 195 | }); 196 | }); 197 | } 198 | 199 | 200 | // ============================================================================= 201 | #pragma mark - Timer Handler 202 | 203 | - (void)onTimer:(NSTimer *)timer { 204 | 205 | [self setNeedsDisplay]; 206 | } 207 | 208 | 209 | 210 | 211 | @end 212 | -------------------------------------------------------------------------------- /CITransitionSample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /CITransitionSample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TransitionView.h" 11 | 12 | 13 | @interface ViewController () 14 | @property (nonatomic, weak) IBOutlet TransitionView *transitionView; 15 | @property (nonatomic, weak) IBOutlet UILabel *nameLabel; 16 | @end 17 | 18 | 19 | @implementation ViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | 25 | [self.transitionView changeTransition:0]; 26 | self.nameLabel.text = [self.transitionView currentFilterName]; 27 | } 28 | 29 | - (void)didReceiveMemoryWarning 30 | { 31 | [super didReceiveMemoryWarning]; 32 | } 33 | 34 | 35 | // ============================================================================= 36 | #pragma mark - Actions 37 | 38 | - (IBAction)segmentChanged:(UISegmentedControl *)sender { 39 | 40 | [self.transitionView changeTransition:sender.selectedSegmentIndex]; 41 | 42 | self.nameLabel.text = [self.transitionView currentFilterName]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CITransitionSample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CITransitionSample/en.lproj/ViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | AvenirNext-Medium 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /CITransitionSample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CITransitionSample 4 | // 5 | // Created by shuichi on 13/03/10. 6 | // Copyright (c) 2013年 Shuichi Tsutsumi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Core Image Transition 2 | 3 | [![Platform](http://img.shields.io/badge/platform-ios-green.svg?style=flat 4 | )](https://developer.apple.com/iphone/index.action) 5 | [![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat 6 | )](http://mit-license.org) 7 | [![Twitter](https://img.shields.io/badge/twitter-@shu223-blue.svg?style=flat)](http://twitter.com/shu223) 8 | 9 | 10 | A sample app for transition effects using Core Image, including a useful helper class. 11 | 12 | ![](ResourcesForREADME/transitions.gif) 13 | 14 | ## Tutorial 15 | 16 | [Using Core Image Transition Effects (Japanese)](http://d.hatena.ne.jp/shu223/20130311/1362962817) 17 | 18 | ## License 19 | 20 | MIT 21 | 22 | ## Author 23 | 24 | **Shuichi Tsutsumi** 25 | 26 | iOS freelancer in Japan. Welcome works from abroad! 27 | 28 | - PAST WORKS: [My Profile Summary](https://medium.com/@shu223/my-profile-summary-f14bfc1e7099#.vdh0i7clr) 29 | - PROFILES: [LinkedIn](https://www.linkedin.com/profile/view?id=214896557) 30 | - BLOGS: [English](https://medium.com/@shu223/) / [Japanese](http://d.hatena.ne.jp/shu223/) 31 | - CONTACTS: [Twitter](https://twitter.com/shu223) / [Facebook](https://www.facebook.com/shuichi.tsutsumi) 32 | 33 | -------------------------------------------------------------------------------- /Resources/images/mask.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/Resources/images/mask.jpg -------------------------------------------------------------------------------- /Resources/images/restrictedshine.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/Resources/images/restrictedshine.tiff -------------------------------------------------------------------------------- /Resources/images/sample1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/Resources/images/sample1.jpg -------------------------------------------------------------------------------- /Resources/images/sample2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/Resources/images/sample2.jpg -------------------------------------------------------------------------------- /ResourcesForREADME/transitions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shu223/CoreImageTransition/2871a564dda55f416ab71e04edfb2cfd0ee3ed3f/ResourcesForREADME/transitions.gif --------------------------------------------------------------------------------