67 Commits

Author SHA1 Message Date
Adam Bell a7eba17652 Merge pull request #109 from olejnjak/share_schemes
Really share build schemes
2020-01-28 13:36:46 -08:00
Jakub Olejník a557a5cdff Really share build schemes 2019-10-22 22:38:56 +02:00
Individual Person ddde760011 Update README.md 2019-08-06 16:09:03 -07:00
Individual Person e05bc50c51 Delete PATENTS 2019-08-06 16:05:18 -07:00
Adam Bell 2e469fa630 Merge pull request #108 from facebook/automated_fixup_code_of_conduct_file_exists
Adding Code of Conduct file
2019-07-11 10:30:04 -07:00
Facebook Community Bot 404fb9c14c OSS Automated Fix: Addition of Code of Conduct 2019-03-27 16:04:10 -07:00
Klaas Pieter Annema bfeedb79a8 Add Carthage support (#74)
* Add Carthage support

Support Carthage by adding a framework scheme and target.

* Set deployment target to 8.0
2017-01-06 09:09:22 -08:00
Grant Paul 3589bd7ca0 Set frame on the content view, rather than layer, for autolayout.
Autolayout requires using the UIView geometry methods for changes
to be correctly propagated. Use that for the shimmering content view.
2016-10-29 22:01:30 -07:00
Natansh Verma 1130a2da95 Fix warnings due to API changes in iOS 10, Beta 2 (#65)
iOS 10, Beta 2 introduced changes to `CALayerDelegate` and
`CAAnimationDelegate`, both of which are now proper protocols instead of
informal ones.

This can be seen in the API diffs:
https://developer.apple.com/library/prerelease/content/releasenotes/General/iOS10APIDiffs/Objective-C/QuartzCore.html

This change fixes the warnings by introducing a macro which compiles to
those two delegate protocols when on the iOS 10 SDK but compiles to
placeholder protocols when using the iOS 9 SDK or below.
2016-07-19 10:57:20 -07:00
Grant Paul ad579d96bb Merge pull request #57 from ejensen/master
Documentation and framework linking clean up
2016-04-12 18:21:29 -07:00
Eric Jensen 5fc7ee0228 Set the SDK in the example project 2016-04-12 15:39:48 -07:00
Eric Jensen b493db97ab Set deployment target to iOS 6 (the minimum target version specified the read me & pod spec) 2016-04-12 15:36:50 -07:00
Eric Jensen 0711a8778a Make the UIKit.framework path relative to SDKROOT 2016-04-12 15:31:35 -07:00
Eric Jensen 57615b05c1 Indentation corrections 2016-04-12 10:52:19 -07:00
Eric Jensen c4bb281016 Typo fixes and documentation improvements 2016-04-12 10:49:21 -07:00
Eric Jensen 614c03adaa Remove unnecessary framework linking 2016-04-12 10:48:19 -07:00
Grant Paul aee5bfa869 Merge pull request #56 from guillaume-algis/shimmeringHighlightWidth-deprecated-fix
Fix shimmeringHighlightWidth documentation and deprecation attribute
2016-03-18 13:10:44 -07:00
Guillaume Algis 15f7acf21a Fix shimmeringHighlightWidth documentation and deprecation attribute 2016-03-18 15:34:04 +01:00
Grant Paul bc2c19c59d Remove possible retain cycle with animation delegate. 2015-10-21 17:49:28 -07:00
Grant Paul 32ded5bf7b Fix retain cycle between shimmering layer and the shimmer animation.
CAAnimation retains its delegate, so only set the delegate on the one
animation it's needed on. Avoiding setting it on the indefinite slide
animation avoids the retain cycle. Since the fade animations are not
infinitely repeated, they will be cleaned up after completion.
2015-08-24 16:06:30 -07:00
Grant Paul 95fd9feee1 Merge pull request #49 from larrytjok/master
[Shimmer] fix shimmer view speed when frame change
2015-05-18 16:00:01 -07:00
Lawrence Tjok ceb9c80f77 [Shimmer] fix shimmer view speed when frame change 2015-05-18 18:48:36 -04:00
Grant Paul 7dc7f8eb54 Merge pull request #47 from arigreen/master
Add ability to synchronize multiple shimmers
2015-05-11 14:50:05 -07:00
Ari Greenberg 70506f3d09 set _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct valueset _shimmeringBeginTime to the correct value 2015-05-11 13:51:09 -07:00
Ari Greenberg 1baad61fd2 Merge branch 'master' of https://github.com/arigreen/Shimmer 2015-05-08 09:37:14 -07:00
Ari Greenberg 0d3a7c0db9 Merge branch 'master' of https://github.com/arigreen/Shimmer
Conflicts:
	FBShimmering/FBShimmeringLayer.m
2015-05-08 09:36:31 -07:00
Ari Greenberg f4aa7a9ab5 Merge branch 'master' of https://github.com/arigreen/Shimmer
Conflicts:
	FBShimmering/FBShimmeringLayer.m
2015-05-07 16:23:37 -07:00
Ari Greenberg fd2abb9c37 Add ability to synchronize multiple shimmers 2015-05-07 16:19:32 -07:00
Ari Greenberg 08445aa4de Add ability to synchronize multiple shimmers 2015-05-07 14:09:06 -07:00
Grant Paul f4158b87d2 Merge pull request #46 from pixyzehn/master
Fixed a warning due to fabsf on example
2015-05-03 21:10:14 -07:00
Nagasawa Hiroki 050c099198 Fixed a warning due to fabsf on example 2015-05-02 19:14:09 +09:00
Nagasawa Hiroki d061caea51 Tidy up FBShimmering.h 2015-05-02 19:06:28 +09:00
Grant Paul e21c2e05bf Merge pull request #43 from fumoboy007/master
Added CoreGraphics import to FBShimmering.h
2015-04-28 12:02:45 -07:00
fumoboy007 8605de99e9 Added CoreGraphics import to FBShimmering.h 2015-04-27 23:55:41 -07:00
Grant Paul 782f268e1c Merge pull request #41 from jbinney/fix_documented_defaults
[documentation] Fix the documented default property values
2015-04-14 14:25:21 -07:00
Joe Binney 8065d0a559 [documentation] Fix the documented default property values 2015-04-13 23:45:26 -07:00
Grant Paul b71e31443a Update patent grant: http://fb.me/patents2 2015-04-10 12:15:16 -07:00
Grant Paul 127942fbb3 Add link to Shimmer for Android. 2015-03-09 12:31:41 -07:00
Grant Paul eb3719c5ef Add license for examples. 2015-02-23 10:21:26 -08:00
Grant Paul f48e93ed26 Merge pull request #37 from spromicky/master
Get super method from if.
2014-11-24 23:17:55 -08:00
spromicky c1a8e992c8 Get super method from if. 2014-11-24 11:58:14 +02:00
Grant Paul 4ae7f17da8 Shimmer 1.0.2 2014-11-16 22:31:53 -08:00
Grant Paul 4188decad2 Merge pull request #36 from nicksnyder/master
fix speed of up/down shimmer
2014-10-15 10:51:56 -07:00
Nick Snyder 86872744cd fix speed of up/down shimmer 2014-10-14 16:04:43 -07:00
Grant Paul 97ef47c730 Merge pull request #34 from paweldudek/master
layoutSubviews never gets called on FBShimmeringView
2014-10-10 10:07:42 -07:00
Pawel Dudek eafbee08b8 Added missing super call 2014-10-10 17:55:33 +02:00
Grant Paul 18c66221b4 Use the right absolute value function. 2014-08-07 18:00:42 -07:00
Grant Paul df9efc20c1 Merge pull request #30 from danielniemeyer/master
Added option to customize shimmeringAnimationOpacity
2014-07-16 22:25:12 -07:00
Daniel Niemeyer 6a7c402ebb Added shimmeringAnimationOpacity 2014-07-15 09:52:08 -07:00
Daniel Niemeyer 2b2fc43f52 Flipped back values 2014-07-09 18:22:16 -07:00
Daniel Niemeyer aab60584d0 Added option to customize base shimmering effect 2014-07-09 18:04:44 -07:00
Grant Paul 55abc20f5d Avoid warnings with -Wshadow. Fixes #28. 2014-05-16 09:46:09 -07:00
Grant Paul 247b72637d Merge pull request #27 from xuzhe/master
Adding two more shimmer animation direction (Up and Down) to FBShimmerin...
2014-05-01 18:40:19 -07:00
xuzhe e87f4d70c0 Adding two more shimmer animation direction (Up and Down) to FBShimmering protocol. 2014-05-01 14:21:08 +09:00
James Pearce 15f7298182 New CLA form 2014-04-22 09:10:40 -07:00
Grant Paul 45b56528a8 Add iOS 6 support to Example project. Fixes #22. 2014-04-21 20:47:54 -07:00
Grant Paul 16f267cbe0 Fix shimmering if the bounds are set after shimmering begins. Fixes #13. 2014-03-24 19:16:44 -07:00
Grant Paul cf2df623db Merge pull request #19 from laud/master
Adding shimmer animation direction to FBShimmering protocol.
2014-03-19 23:39:28 -07:00
Daniel Lau cbfcf82a41 Adding shimmer animation direction to FBShimmering protocol. FBShimmerDirectionRight (the original animation direction) is set as default. Shimmer direction may be changed at anytime. 2014-03-19 17:33:11 -07:00
Grant Paul cd7b8fec76 Merge pull request #14 from danielamitay/master
Remove extra ';' outside of function macros
2014-03-13 22:25:43 -07:00
Daniel Amitay 364178a024 Remove extra ';' outside of function macros 2014-03-14 01:05:27 -04:00
Grant Paul 80174f920a Fix a few issues with initial setup.
- Always apply shimmering width.
 - Update default shimmering width.
 - Set duration properly for fade. (#12)
2014-03-11 23:28:27 -07:00
Grant Paul 0959467783 Fix a bug where the fade out duration wasn't respected. 2014-03-11 21:23:35 -07:00
Grant Paul e247c0d532 Clarify example project usage. 2014-03-08 17:06:51 -08:00
Grant Paul d8d07721ce Merge pull request #10 from croath/master
add shimmeringHighlightWidth property
2014-03-07 17:43:45 -08:00
Croath 666dcd756b add shimmeringHighlightWidth property 2014-03-07 18:21:24 +08:00
Grant Paul ef6b16a51a Update podspec for 1.0.1. 2014-03-05 18:47:16 -08:00
18 changed files with 667 additions and 192 deletions
+2
View File
@@ -0,0 +1,2 @@
# Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
+1 -1
View File
@@ -14,7 +14,7 @@ possible. If you run into problems, please open an issue. We also actively welco
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.
Complete your CLA here: <https://developers.facebook.com/opensource/cla>
Complete your CLA here: <https://code.facebook.com/cla>
## Issues
We use GitHub issues to track public bugs. Please ensure your description is
+14 -27
View File
@@ -7,9 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
077ACA6E1CBD6B7200B3A708 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 077ACA6D1CBD6B7200B3A708 /* UIKit.framework */; };
EC45CACE18ADC7CE0063DD11 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC45CACD18ADC7CE0063DD11 /* Foundation.framework */; };
EC45CAD018ADC7CE0063DD11 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC45CACF18ADC7CE0063DD11 /* CoreGraphics.framework */; };
EC45CAD218ADC7CE0063DD11 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC45CAD118ADC7CE0063DD11 /* UIKit.framework */; };
EC45CAD818ADC7CE0063DD11 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EC45CAD618ADC7CE0063DD11 /* InfoPlist.strings */; };
EC45CADA18ADC7CE0063DD11 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EC45CAD918ADC7CE0063DD11 /* main.m */; };
EC45CADE18ADC7CE0063DD11 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EC45CADD18ADC7CE0063DD11 /* AppDelegate.m */; };
@@ -21,10 +21,10 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
077ACA6D1CBD6B7200B3A708 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
EC45CACA18ADC7CE0063DD11 /* Logo-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Logo-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
EC45CACD18ADC7CE0063DD11 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
EC45CACF18ADC7CE0063DD11 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
EC45CAD118ADC7CE0063DD11 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
EC45CAD518ADC7CE0063DD11 /* Logo-iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Logo-iOS-Info.plist"; sourceTree = "<group>"; };
EC45CAD718ADC7CE0063DD11 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
EC45CAD918ADC7CE0063DD11 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@@ -36,12 +36,7 @@
EC45CAE518ADC7CE0063DD11 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
EC45CAE618ADC7CE0063DD11 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
EC45CAE818ADC7CE0063DD11 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
EC45CAEF18ADC7CE0063DD11 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
EC45CB0318ADC7E80063DD11 /* libFBShimmering.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libFBShimmering.a; path = "../../../Library/Developer/Xcode/DerivedData/FBShimmering-amnevtoymcgzwwazjmzbwvbeduoi/Build/Products/Debug-iphoneos/libFBShimmering.a"; sourceTree = "<group>"; };
EC45CB0A18ADC8570063DD11 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
EC45CB0D18ADC8570063DD11 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
EC45CB0E18ADC8570063DD11 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
EC45CB0F18ADC8570063DD11 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -49,9 +44,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
077ACA6E1CBD6B7200B3A708 /* UIKit.framework in Frameworks */,
EC45CB0418ADC7E80063DD11 /* libFBShimmering.a in Frameworks */,
EC45CAD018ADC7CE0063DD11 /* CoreGraphics.framework in Frameworks */,
EC45CAD218ADC7CE0063DD11 /* UIKit.framework in Frameworks */,
EC45CACE18ADC7CE0063DD11 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -66,7 +61,9 @@
EC45CACC18ADC7CE0063DD11 /* Frameworks */,
EC45CACB18ADC7CE0063DD11 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
};
EC45CACB18ADC7CE0063DD11 /* Products */ = {
isa = PBXGroup;
@@ -82,10 +79,7 @@
EC45CB0318ADC7E80063DD11 /* libFBShimmering.a */,
EC45CACD18ADC7CE0063DD11 /* Foundation.framework */,
EC45CACF18ADC7CE0063DD11 /* CoreGraphics.framework */,
EC45CAD118ADC7CE0063DD11 /* UIKit.framework */,
EC45CAEF18ADC7CE0063DD11 /* XCTest.framework */,
EC45CB0A18ADC8570063DD11 /* Cocoa.framework */,
EC45CB0C18ADC8570063DD11 /* Other Frameworks */,
077ACA6D1CBD6B7200B3A708 /* UIKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -116,16 +110,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
EC45CB0C18ADC8570063DD11 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
EC45CB0D18ADC8570063DD11 /* AppKit.framework */,
EC45CB0E18ADC8570063DD11 /* CoreData.framework */,
EC45CB0F18ADC8570063DD11 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
ECC5761518ADEDFC00C2BFB8 /* Logo */ = {
isa = PBXGroup;
children = (
@@ -160,7 +144,7 @@
EC45CAC018ADC7920063DD11 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
LastUpgradeCheck = 0510;
};
buildConfigurationList = EC45CAC318ADC7920063DD11 /* Build configuration list for PBXProject "Examples" */;
compatibilityVersion = "Xcode 3.2";
@@ -238,12 +222,17 @@
EC45CAC418ADC7920063DD11 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
EC45CAC518ADC7920063DD11 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
};
name = Release;
};
@@ -251,7 +240,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -289,7 +277,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Logo-iOS/Logo-iOS-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/FBShimmering-amnevtoymcgzwwazjmzbwvbeduoi/Build/Products/Debug-iphoneos",
@@ -306,7 +294,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -338,7 +325,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Logo-iOS/Logo-iOS-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/FBShimmering-amnevtoymcgzwwazjmzbwvbeduoi/Build/Products/Debug-iphoneos",
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EC45CAC918ADC7CE0063DD11"
BuildableName = "Logo-iOS.app"
BlueprintName = "Logo-iOS"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EC45CAC918ADC7CE0063DD11"
BuildableName = "Logo-iOS.app"
BlueprintName = "Logo-iOS"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EC45CAC918ADC7CE0063DD11"
BuildableName = "Logo-iOS.app"
BlueprintName = "Logo-iOS"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+9
View File
@@ -0,0 +1,9 @@
This file provided by Facebook is for non-commercial testing and evaluation
purposes only. Facebook reserves all rights not expressly granted.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+17 -6
View File
@@ -19,7 +19,6 @@
{
UIImageView *_wallpaperView;
FBShimmeringView *_shimmeringView;
UIView *_contentView;
UILabel *_logoLabel;
UILabel *_valueLabel;
@@ -52,13 +51,10 @@
_valueLabel.textAlignment = NSTextAlignmentCenter;
_valueLabel.numberOfLines = 0;
_valueLabel.alpha = 0.0;
_valueLabel.backgroundColor = [UIColor clearColor];
[self.view addSubview:_valueLabel];
CGRect shimmeringFrame = self.view.bounds;
shimmeringFrame.origin.y = shimmeringFrame.size.height * 0.68;
shimmeringFrame.size.height = shimmeringFrame.size.height * 0.32;
_shimmeringView = [[FBShimmeringView alloc] initWithFrame:shimmeringFrame];
_shimmeringView = [[FBShimmeringView alloc] init];
_shimmeringView.shimmering = YES;
_shimmeringView.shimmeringBeginFadeDuration = 0.3;
_shimmeringView.shimmeringOpacity = 0.3;
@@ -69,6 +65,7 @@
_logoLabel.font = [UIFont fontWithName:@"HelveticaNeue-UltraLight" size:60.0];
_logoLabel.textColor = [UIColor whiteColor];
_logoLabel.textAlignment = NSTextAlignmentCenter;
_logoLabel.backgroundColor = [UIColor clearColor];
_shimmeringView.contentView = _logoLabel;
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_tapped:)];
@@ -78,6 +75,16 @@
[self.view addGestureRecognizer:panRecognizer];
}
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
CGRect shimmeringFrame = self.view.bounds;
shimmeringFrame.origin.y = shimmeringFrame.size.height * 0.68;
shimmeringFrame.size.height = shimmeringFrame.size.height * 0.32;
_shimmeringView.frame = shimmeringFrame;
}
- (void)_tapped:(UITapGestureRecognizer *)tapRecognizer
{
_shimmeringView.shimmering = !_shimmeringView.shimmering;
@@ -89,7 +96,11 @@
CGPoint velocity = [panRecognizer velocityInView:self.view];
if (panRecognizer.state == UIGestureRecognizerStateBegan) {
#if CGFLOAT_IS_DOUBLE
_panVertical = (fabs(velocity.y) > fabs(velocity.x));
#else
_panVertical = (fabsf(velocity.y) > fabsf(velocity.x));
#endif
if (_panVertical) {
_panStartValue = _shimmeringView.shimmeringSpeed;
+168 -82
View File
@@ -6,40 +6,23 @@
objectVersion = 46;
objects = {
/* Begin PBXAggregateTarget section */
ECEA612C18A4A7360064AFF4 /* Framework */ = {
isa = PBXAggregateTarget;
buildConfigurationList = ECEA612D18A4A7360064AFF4 /* Build configuration list for PBXAggregateTarget "Framework" */;
buildPhases = (
ECEA613218A4A76E0064AFF4 /* ShellScript */,
);
dependencies = (
ECEA613118A4A73D0064AFF4 /* PBXTargetDependency */,
);
name = Framework;
productName = Framework;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
077ACA6A1CBD6B4300B3A708 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 077ACA691CBD6B4300B3A708 /* UIKit.framework */; };
077ACA6C1CBD6B5800B3A708 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 077ACA6B1CBD6B5800B3A708 /* CoreGraphics.framework */; };
1899D26B18BD1CFB0035A1B0 /* FBShimmeringView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1899D26718BD1CFB0035A1B0 /* FBShimmeringView.m */; };
1899D26C18BD1CFB0035A1B0 /* FBShimmeringLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1899D26918BD1CFB0035A1B0 /* FBShimmeringLayer.m */; };
1899D27418BD201B0035A1B0 /* FBShimmering.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1899D26D18BD1D070035A1B0 /* FBShimmering.h */; };
1899D27518BD201B0035A1B0 /* FBShimmeringView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1899D26818BD1CFB0035A1B0 /* FBShimmeringView.h */; };
1899D27618BD201B0035A1B0 /* FBShimmeringLayer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1899D26A18BD1CFB0035A1B0 /* FBShimmeringLayer.h */; };
A1C8E0BF1E13C0C9002D6069 /* Shimmer.h in Headers */ = {isa = PBXBuildFile; fileRef = A1C8E0BD1E13C0C9002D6069 /* Shimmer.h */; settings = {ATTRIBUTES = (Public, ); }; };
A1C8E0C31E13C0D3002D6069 /* FBShimmering.h in Headers */ = {isa = PBXBuildFile; fileRef = 1899D26D18BD1D070035A1B0 /* FBShimmering.h */; settings = {ATTRIBUTES = (Public, ); }; };
A1C8E0C41E13C0D3002D6069 /* FBShimmeringView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1899D26818BD1CFB0035A1B0 /* FBShimmeringView.h */; settings = {ATTRIBUTES = (Public, ); }; };
A1C8E0C51E13C0D3002D6069 /* FBShimmeringLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1899D26A18BD1CFB0035A1B0 /* FBShimmeringLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
A1C8E0C61E13C0D8002D6069 /* FBShimmeringView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1899D26718BD1CFB0035A1B0 /* FBShimmeringView.m */; };
A1C8E0C71E13C0D8002D6069 /* FBShimmeringLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1899D26918BD1CFB0035A1B0 /* FBShimmeringLayer.m */; };
ECEA610218A49C620064AFF4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECEA610118A49C620064AFF4 /* Foundation.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
ECEA613018A4A73D0064AFF4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = ECEA60F618A49C620064AFF4 /* Project object */;
proxyType = 1;
remoteGlobalIDString = ECEA60FD18A49C620064AFF4;
remoteInfo = FBShimmering;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
ECEA60FC18A49C620064AFF4 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
@@ -56,12 +39,16 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
077ACA691CBD6B4300B3A708 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
077ACA6B1CBD6B5800B3A708 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
1899D26718BD1CFB0035A1B0 /* FBShimmeringView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBShimmeringView.m; sourceTree = "<group>"; };
1899D26818BD1CFB0035A1B0 /* FBShimmeringView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmeringView.h; sourceTree = "<group>"; };
1899D26918BD1CFB0035A1B0 /* FBShimmeringLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBShimmeringLayer.m; sourceTree = "<group>"; };
1899D26A18BD1CFB0035A1B0 /* FBShimmeringLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmeringLayer.h; sourceTree = "<group>"; };
1899D26D18BD1D070035A1B0 /* FBShimmering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBShimmering.h; sourceTree = "<group>"; };
5CEF702BB5574A90B448BF09 /* libPods-FBShimmeringTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FBShimmeringTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A1C8E0BB1E13C0C9002D6069 /* Shimmer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Shimmer.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A1C8E0BD1E13C0C9002D6069 /* Shimmer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Shimmer.h; sourceTree = "<group>"; };
A1C8E0BE1E13C0C9002D6069 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EC8BB5B318A5A1EE00EB2793 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
EC8BB5B418A5A1F500EB2793 /* PATENTS */ = {isa = PBXFileReference; lastKnownFileType = text; path = PATENTS; sourceTree = "<group>"; };
EC8BB5B518A5A30700EB2793 /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = text; path = CONTRIBUTING.md; sourceTree = "<group>"; };
@@ -69,15 +56,22 @@
ECEA60FE18A49C620064AFF4 /* libFBShimmering.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFBShimmering.a; sourceTree = BUILT_PRODUCTS_DIR; };
ECEA610118A49C620064AFF4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
ECEA610518A49C620064AFF4 /* FBShimmering-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FBShimmering-Prefix.pch"; sourceTree = "<group>"; };
ECEA610F18A49C620064AFF4 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
ECEA611218A49C620064AFF4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
A1C8E0B71E13C0C9002D6069 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
ECEA60FB18A49C620064AFF4 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
077ACA6C1CBD6B5800B3A708 /* CoreGraphics.framework in Frameworks */,
077ACA6A1CBD6B4300B3A708 /* UIKit.framework in Frameworks */,
ECEA610218A49C620064AFF4 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -85,6 +79,15 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
A1C8E0BC1E13C0C9002D6069 /* Framework */ = {
isa = PBXGroup;
children = (
A1C8E0BD1E13C0C9002D6069 /* Shimmer.h */,
A1C8E0BE1E13C0C9002D6069 /* Info.plist */,
);
path = Framework;
sourceTree = "<group>";
};
ECEA60F518A49C620064AFF4 = {
isa = PBXGroup;
children = (
@@ -93,15 +96,19 @@
EC8BB5B318A5A1EE00EB2793 /* LICENSE */,
EC8BB5B418A5A1F500EB2793 /* PATENTS */,
ECEA610318A49C620064AFF4 /* FBShimmering */,
A1C8E0BC1E13C0C9002D6069 /* Framework */,
ECEA610018A49C620064AFF4 /* Frameworks */,
ECEA60FF18A49C620064AFF4 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
};
ECEA60FF18A49C620064AFF4 /* Products */ = {
isa = PBXGroup;
children = (
ECEA60FE18A49C620064AFF4 /* libFBShimmering.a */,
A1C8E0BB1E13C0C9002D6069 /* Shimmer.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -109,10 +116,9 @@
ECEA610018A49C620064AFF4 /* Frameworks */ = {
isa = PBXGroup;
children = (
077ACA6B1CBD6B5800B3A708 /* CoreGraphics.framework */,
077ACA691CBD6B4300B3A708 /* UIKit.framework */,
ECEA610118A49C620064AFF4 /* Foundation.framework */,
ECEA610F18A49C620064AFF4 /* XCTest.framework */,
ECEA611218A49C620064AFF4 /* UIKit.framework */,
5CEF702BB5574A90B448BF09 /* libPods-FBShimmeringTests.a */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -140,7 +146,39 @@
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
A1C8E0B81E13C0C9002D6069 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
A1C8E0BF1E13C0C9002D6069 /* Shimmer.h in Headers */,
A1C8E0C31E13C0D3002D6069 /* FBShimmering.h in Headers */,
A1C8E0C41E13C0D3002D6069 /* FBShimmeringView.h in Headers */,
A1C8E0C51E13C0D3002D6069 /* FBShimmeringLayer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
A1C8E0BA1E13C0C9002D6069 /* Shimmer */ = {
isa = PBXNativeTarget;
buildConfigurationList = A1C8E0C01E13C0C9002D6069 /* Build configuration list for PBXNativeTarget "Shimmer" */;
buildPhases = (
A1C8E0B61E13C0C9002D6069 /* Sources */,
A1C8E0B71E13C0C9002D6069 /* Frameworks */,
A1C8E0B81E13C0C9002D6069 /* Headers */,
A1C8E0B91E13C0C9002D6069 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = Shimmer;
productName = Shimmer;
productReference = A1C8E0BB1E13C0C9002D6069 /* Shimmer.framework */;
productType = "com.apple.product-type.framework";
};
ECEA60FD18A49C620064AFF4 /* FBShimmering */ = {
isa = PBXNativeTarget;
buildConfigurationList = ECEA612118A49C620064AFF4 /* Build configuration list for PBXNativeTarget "FBShimmering" */;
@@ -165,8 +203,9 @@
ECEA60F618A49C620064AFF4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Kimon Tsinteris";
CLASSPREFIX = FB;
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = Facebook;
};
buildConfigurationList = ECEA60F918A49C620064AFF4 /* Build configuration list for PBXProject "FBShimmering" */;
compatibilityVersion = "Xcode 3.2";
@@ -181,11 +220,21 @@
projectRoot = "";
targets = (
ECEA60FD18A49C620064AFF4 /* FBShimmering */,
ECEA612C18A4A7360064AFF4 /* Framework */,
A1C8E0BA1E13C0C9002D6069 /* Shimmer */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
A1C8E0B91E13C0C9002D6069 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
ECEA612718A49DDD0064AFF4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -200,22 +249,18 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers\"\n\n# Link the \"Current\" version to \"A\"\n/bin/ln -sfh A \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/Current\"\n/bin/ln -sfh Versions/Current/Headers \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Headers\"\n/bin/ln -sfh \"Versions/Current/${PRODUCT_NAME}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\"\n\n# The -a ensures that the headers maintain the source modification date so that we don't constantly\n# cause propagating rebuilds of files that import these headers.\n/bin/cp -a \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Versions/A/Headers\"";
};
ECEA613218A4A76E0064AFF4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nset +u\n# Avoid recursively calling this script.\nif [[ $SF_MASTER_SCRIPT_RUNNING ]]\nthen\nexit 0\nfi\nset -u\nexport SF_MASTER_SCRIPT_RUNNING=1\n\nSF_TARGET_NAME=${PROJECT_NAME}\nSF_EXECUTABLE_PATH=\"lib${SF_TARGET_NAME}.a\"\nSF_WRAPPER_NAME=\"${SF_TARGET_NAME}.framework\"\n\n# The following conditionals come from\n# https://github.com/kstenerud/iOS-Universal-Framework\n\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]\nthen\nSF_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho \"Could not find platform name from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]\nthen\nSF_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$SF_SDK_PLATFORM\" = \"iphoneos\" ]]\nthen\nSF_OTHER_PLATFORM=iphonesimulator\nelse\nSF_OTHER_PLATFORM=iphoneos\nfi\n\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$SF_SDK_PLATFORM$ ]]\nthen\nSF_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${SF_OTHER_PLATFORM}\"\nelse\necho \"Could not find platform name from build products directory: $BUILT_PRODUCTS_DIR\"\nexit 1\nfi\n\n# Build the other platform.\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${SF_OTHER_PLATFORM}${SF_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" OBJROOT=\"${OBJROOT}\" BUILD_ROOT=\"${BUILD_ROOT}\" SYMROOT=\"${SYMROOT}\" $ACTION\n\n# Smash the two static libraries into one fat binary and store it in the .framework\nlipo -create \"${BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}\" \"${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_EXECUTABLE_PATH}\" -output \"${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/${FRAMEWORK_VERSION}/${SF_TARGET_NAME}\"\n\n# Copy the binary to the other architecture folder to have a complete framework in both.\ncp -a \"${BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/${FRAMEWORK_VERSION}/${SF_TARGET_NAME}\" \"${SF_OTHER_BUILT_PRODUCTS_DIR}/${SF_WRAPPER_NAME}/Versions/${FRAMEWORK_VERSION}/${SF_TARGET_NAME}\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
A1C8E0B61E13C0C9002D6069 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A1C8E0C71E13C0D8002D6069 /* FBShimmeringLayer.m in Sources */,
A1C8E0C61E13C0D8002D6069 /* FBShimmeringView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
ECEA60FA18A49C620064AFF4 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -227,20 +272,76 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
ECEA613118A4A73D0064AFF4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = ECEA60FD18A49C620064AFF4 /* FBShimmering */;
targetProxy = ECEA613018A4A73D0064AFF4 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
A1C8E0C11E13C0C9002D6069 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = Framework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Shimmer;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
A1C8E0C21E13C0C9002D6069 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = Framework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.Shimmer;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
ECEA611F18A49C620064AFF4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -268,7 +369,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
@@ -278,7 +379,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -300,7 +400,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
@@ -338,23 +438,18 @@
};
name = Release;
};
ECEA612E18A4A7360064AFF4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
ECEA612F18A4A7360064AFF4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A1C8E0C01E13C0C9002D6069 /* Build configuration list for PBXNativeTarget "Shimmer" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1C8E0C11E13C0C9002D6069 /* Debug */,
A1C8E0C21E13C0C9002D6069 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
ECEA60F918A49C620064AFF4 /* Build configuration list for PBXProject "FBShimmering" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -373,15 +468,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
ECEA612D18A4A7360064AFF4 /* Build configuration list for PBXAggregateTarget "Framework" */ = {
isa = XCConfigurationList;
buildConfigurations = (
ECEA612E18A4A7360064AFF4 /* Debug */,
ECEA612F18A4A7360064AFF4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = ECEA60F618A49C620064AFF4 /* Project object */;
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ECEA60FD18A49C620064AFF4"
BuildableName = "libFBShimmering.a"
BlueprintName = "FBShimmering"
ReferencedContainer = "container:FBShimmering.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ECEA60FD18A49C620064AFF4"
BuildableName = "libFBShimmering.a"
BlueprintName = "FBShimmering"
ReferencedContainer = "container:FBShimmering.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A1C8E0BA1E13C0C9002D6069"
BuildableName = "Shimmer.framework"
BlueprintName = "Shimmer"
ReferencedContainer = "container:FBShimmering.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A1C8E0BA1E13C0C9002D6069"
BuildableName = "Shimmer.framework"
BlueprintName = "Shimmer"
ReferencedContainer = "container:FBShimmering.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A1C8E0BA1E13C0C9002D6069"
BuildableName = "Shimmer.framework"
BlueprintName = "Shimmer"
ReferencedContainer = "container:FBShimmering.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
+33 -1
View File
@@ -7,22 +7,48 @@
of patent rights can be found in the PATENTS file in the same directory.
*/
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, FBShimmerDirection) {
//! Shimmer animation goes from left to right
FBShimmerDirectionRight,
//! Shimmer animation goes from right to left
FBShimmerDirectionLeft,
//! Shimmer animation goes from below to above
FBShimmerDirectionUp,
//! Shimmer animation goes from above to below
FBShimmerDirectionDown,
};
static const float FBShimmerDefaultBeginTime = CGFLOAT_MAX;
@protocol FBShimmering <NSObject>
//! @abstract Set this to YES to start shimming and NO to stop. Defaults to NO.
@property (nonatomic, assign, readwrite, getter = isShimmering) BOOL shimmering;
@property (assign, nonatomic, readwrite, getter = isShimmering) BOOL shimmering;
//! @abstract The time interval between shimmerings in seconds. Defaults to 0.4.
@property (assign, nonatomic, readwrite) CFTimeInterval shimmeringPauseDuration;
//! @abstract The opacity of the content while it is shimmering. Defaults to 0.5.
@property (assign, nonatomic, readwrite) CGFloat shimmeringAnimationOpacity;
//! @abstract The opacity of the content before it is shimmering. Defaults to 1.0.
@property (assign, nonatomic, readwrite) CGFloat shimmeringOpacity;
//! @abstract The speed of shimmering, in points per second. Defaults to 230.
@property (assign, nonatomic, readwrite) CGFloat shimmeringSpeed;
//! @abstract The highlight length of shimmering. Range of [0,1], defaults to 1.0.
@property (assign, nonatomic, readwrite) CGFloat shimmeringHighlightLength;
//! @abstract Same as "shimmeringHighlightLength", just for downward compatibility. @deprecated
@property (assign, nonatomic, readwrite, getter = shimmeringHighlightLength, setter = setShimmeringHighlightLength:) CGFloat shimmeringHighlightWidth DEPRECATED_MSG_ATTRIBUTE("Use shimmeringHighlightLength");
//! @abstract The direction of shimmering animation. Defaults to FBShimmerDirectionRight.
@property (assign, nonatomic, readwrite) FBShimmerDirection shimmeringDirection;
//! @abstract The duration of the fade used when shimmer begins. Defaults to 0.1.
@property (assign, nonatomic, readwrite) CFTimeInterval shimmeringBeginFadeDuration;
@@ -35,5 +61,11 @@
*/
@property (assign, nonatomic, readonly) CFTimeInterval shimmeringFadeTime;
/**
@abstract The absolute CoreAnimation media time when the shimmer will begin.
@discussion Only valid after setting {@ref shimmering} to YES.
*/
@property (assign, nonatomic) CFTimeInterval shimmeringBeginTime;
@end
+128 -41
View File
@@ -47,47 +47,39 @@ static NSString *const kFBShimmerSlideAnimationKey = @"slide";
static NSString *const kFBFadeAnimationKey = @"fade";
static NSString *const kFBEndFadeAnimationKey = @"fade-end";
static CABasicAnimation *fade_animation(id delegate, CALayer *layer, CGFloat opacity, CFTimeInterval duration)
static CABasicAnimation *fade_animation(CALayer *layer, CGFloat opacity, CFTimeInterval duration)
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
animation.delegate = delegate;
animation.fromValue = @([layer.presentationLayer opacity]);
animation.fromValue = @([(layer.presentationLayer ?: layer) opacity]);
animation.toValue = @(opacity);
animation.fillMode = kCAFillModeBoth;
animation.removedOnCompletion = NO;
animation.duration = duration;
FBShimmeringLayerAnimationApplyDragCoefficient(animation);
return animation;
}
static CABasicAnimation *shimmer_begin_fade_animation(id delegate, CALayer *layer, CGFloat opacity, CGFloat duration)
{
return fade_animation(delegate, layer, opacity, duration);
}
static CABasicAnimation *shimmer_end_fade_animation(id delegate, CALayer *layer, CGFloat opacity, CGFloat duration)
{
CABasicAnimation *animation = fade_animation(delegate, layer, opacity, duration);
[animation setValue:@YES forKey:kFBEndFadeAnimationKey];
return animation;
}
static CABasicAnimation *shimmer_slide_animation(id delegate, CFTimeInterval duration)
static CABasicAnimation *shimmer_slide_animation(CFTimeInterval duration, FBShimmerDirection direction)
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.delegate = delegate;
animation.toValue = [NSValue valueWithCGPoint:CGPointZero];
animation.duration = duration;
animation.repeatCount = HUGE_VALF;
FBShimmeringLayerAnimationApplyDragCoefficient(animation);
if (direction == FBShimmerDirectionLeft ||
direction == FBShimmerDirectionUp) {
animation.speed = -fabsf(animation.speed);
}
return animation;
}
// take a shimmer slide animation and turns into repeating
static CAAnimation *shimmer_slide_repeat(CAAnimation *a, CFTimeInterval duration)
static CAAnimation *shimmer_slide_repeat(CAAnimation *a, CFTimeInterval duration, FBShimmerDirection direction)
{
CAAnimation *anim = [a copy];
anim.repeatCount = HUGE_VALF;
anim.duration = duration;
anim.speed = (direction == FBShimmerDirectionRight || direction == FBShimmerDirectionDown) ? fabsf(anim.speed) : -fabsf(anim.speed);
return anim;
}
@@ -127,6 +119,11 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
@end
@interface FBShimmeringLayer ()
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
// iOS 10 SDK has CALayerDelegate and CAAnimationDelegate as proper protocols.
<CALayerDelegate, CAAnimationDelegate>
#endif
@property (strong, nonatomic) FBShimmeringMaskLayer *maskLayer;
@end
@@ -140,11 +137,16 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
@synthesize shimmering = _shimmering;
@synthesize shimmeringPauseDuration = _shimmeringPauseDuration;
@synthesize shimmeringAnimationOpacity = _shimmeringAnimationOpacity;
@synthesize shimmeringOpacity = _shimmeringOpacity;
@synthesize shimmeringSpeed = _shimmeringSpeed;
@synthesize shimmeringHighlightLength = _shimmeringHighlightLength;
@synthesize shimmeringDirection = _shimmeringDirection;
@synthesize shimmeringFadeTime = _shimmeringFadeTime;
@synthesize shimmeringBeginFadeDuration = _shimmeringBeginFadeDuration;
@synthesize shimmeringEndFadeDuration = _shimmeringEndFadeDuration;
@synthesize shimmeringBeginTime = _shimmeringBeginTime;
@dynamic shimmeringHighlightWidth;
- (instancetype)init
{
@@ -153,9 +155,13 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
// default configuration
_shimmeringPauseDuration = 0.4;
_shimmeringSpeed = 230.0;
_shimmeringOpacity = 0.5;
_shimmeringHighlightLength = 1.0;
_shimmeringAnimationOpacity = 0.5;
_shimmeringOpacity = 1.0;
_shimmeringDirection = FBShimmerDirectionRight;
_shimmeringBeginFadeDuration = 0.1;
_shimmeringEndFadeDuration = 0.3;
_shimmeringBeginTime = FBShimmerDefaultBeginTime;
}
return self;
}
@@ -191,6 +197,22 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
}
}
- (void)setShimmeringHighlightLength:(CGFloat)length
{
if (length != _shimmeringHighlightLength) {
_shimmeringHighlightLength = length;
[self _updateShimmering];
}
}
- (void)setShimmeringDirection:(FBShimmerDirection)direction
{
if (direction != _shimmeringDirection) {
_shimmeringDirection = direction;
[self _updateShimmering];
}
}
- (void)setShimmeringPauseDuration:(CFTimeInterval)duration
{
if (duration != _shimmeringPauseDuration) {
@@ -199,6 +221,14 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
}
}
- (void)setShimmeringAnimationOpacity:(CGFloat)shimmeringAnimationOpacity
{
if (shimmeringAnimationOpacity != _shimmeringAnimationOpacity) {
_shimmeringAnimationOpacity = shimmeringAnimationOpacity;
[self _updateMaskColors];
}
}
- (void)setShimmeringOpacity:(CGFloat)shimmeringOpacity
{
if (shimmeringOpacity != _shimmeringOpacity) {
@@ -207,17 +237,37 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
}
}
- (void)setShimmeringBeginTime:(CFTimeInterval)beginTime
{
if (beginTime != _shimmeringBeginTime) {
_shimmeringBeginTime = beginTime;
[self _updateShimmering];
}
}
- (void)layoutSublayers
{
[super layoutSublayers];
CGRect r = self.bounds;
_contentLayer.anchorPoint = CGPointMake(0.5, 0.5);
_contentLayer.bounds = r;
_contentLayer.position = CGPointMake(CGRectGetMidX(r), CGRectGetMidY(r));
if (nil != _maskLayer) {
[self _updateMaskLayout];
}
}
- (void)setBounds:(CGRect)bounds
{
CGRect oldBounds = self.bounds;
[super setBounds:bounds];
if (!CGRectEqualToRect(oldBounds, bounds)) {
[self _updateShimmering];
}
}
#pragma mark - Internal
- (void)_clearMask
@@ -255,7 +305,7 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
// We create a gradient to be used as a mask.
// In a mask, the colors do not matter, it's the alpha that decides the degree of masking.
UIColor *maskedColor = [UIColor colorWithWhite:1.0 alpha:_shimmeringOpacity];
UIColor *unmaskedColor = [UIColor whiteColor];
UIColor *unmaskedColor = [UIColor colorWithWhite:1.0 alpha:_shimmeringAnimationOpacity];
// Create a gradient from masked to unmasked to masked.
_maskLayer.colors = @[(__bridge id)maskedColor.CGColor, (__bridge id)unmaskedColor.CGColor, (__bridge id)maskedColor.CGColor];
@@ -264,26 +314,47 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
- (void)_updateMaskLayout
{
// Everything outside the mask layer is hidden, so we need to create a mask long enough for the shimmered layer to be always covered by the mask.
CGFloat width = CGRectGetWidth(_contentLayer.bounds);
if (0 == width) {
CGFloat length = 0.0f;
if (_shimmeringDirection == FBShimmerDirectionDown ||
_shimmeringDirection == FBShimmerDirectionUp) {
length = CGRectGetHeight(_contentLayer.bounds);
} else {
length = CGRectGetWidth(_contentLayer.bounds);
}
if (0 == length) {
return;
}
// extra distance for the gradient to travel during the pause.
CGFloat extraDistance = width + _shimmeringSpeed * _shimmeringPauseDuration;
CGFloat extraDistance = length + _shimmeringSpeed * _shimmeringPauseDuration;
// compute how far the shimmering goes
CGFloat fullShimmerLength = width * 3.0f + extraDistance;
CGFloat travelDistance = width * 2.0f + extraDistance;
// setup the gradient for shimmering
_maskLayer.startPoint = CGPointMake((width + extraDistance) / fullShimmerLength, 0.0);
_maskLayer.endPoint = CGPointMake(travelDistance / fullShimmerLength, 0.0);
CGFloat fullShimmerLength = length * 3.0f + extraDistance;
CGFloat travelDistance = length * 2.0f + extraDistance;
// position the gradient for the desired width
CGFloat highlightOutsideLength = (1.0 - _shimmeringHighlightLength) / 2.0;
_maskLayer.locations = @[@(highlightOutsideLength),
@(0.5),
@(1.0 - highlightOutsideLength)];
CGFloat startPoint = (length + extraDistance) / fullShimmerLength;
CGFloat endPoint = travelDistance / fullShimmerLength;
// position for the start of the animation
_maskLayer.anchorPoint = CGPointZero;
_maskLayer.position = CGPointMake(-travelDistance, 0.0);
_maskLayer.bounds = CGRectMake(0.0, 0.0, fullShimmerLength, CGRectGetHeight(_contentLayer.bounds));
if (_shimmeringDirection == FBShimmerDirectionDown ||
_shimmeringDirection == FBShimmerDirectionUp) {
_maskLayer.startPoint = CGPointMake(0.0, startPoint);
_maskLayer.endPoint = CGPointMake(0.0, endPoint);
_maskLayer.position = CGPointMake(0.0, -travelDistance);
_maskLayer.bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_contentLayer.bounds), fullShimmerLength);
} else {
_maskLayer.startPoint = CGPointMake(startPoint, 0.0);
_maskLayer.endPoint = CGPointMake(endPoint, 0.0);
_maskLayer.position = CGPointMake(-travelDistance, 0.0);
_maskLayer.bounds = CGRectMake(0.0, 0.0, fullShimmerLength, CGRectGetHeight(_contentLayer.bounds));
}
}
- (void)_updateShimmering
@@ -296,7 +367,7 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
return;
}
// ensure layed out
// ensure layout
[self layoutIfNeeded];
BOOL disableActions = [CATransaction disableActions];
@@ -310,7 +381,8 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
CAAnimation *slideAnimation = [_maskLayer animationForKey:kFBShimmerSlideAnimationKey];
if (slideAnimation != nil) {
// determing total time sliding
// determine total time sliding
CFTimeInterval now = CACurrentMediaTime();
CFTimeInterval slideTotalDuration = now - slideAnimation.beginTime;
@@ -329,7 +401,9 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
}
// fade in text at slideEndTime
CABasicAnimation *fadeInAnimation = shimmer_end_fade_animation(self, _maskLayer.fadeLayer, 1.0, _shimmeringEndFadeDuration);
CABasicAnimation *fadeInAnimation = fade_animation(_maskLayer.fadeLayer, 1.0, _shimmeringEndFadeDuration);
fadeInAnimation.delegate = self;
[fadeInAnimation setValue:@YES forKey:kFBEndFadeAnimationKey];
fadeInAnimation.beginTime = slideEndTime;
[_maskLayer.fadeLayer addAnimation:fadeInAnimation forKey:kFBFadeAnimationKey];
@@ -340,33 +414,44 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
// fade out text, optionally animated
CABasicAnimation *fadeOutAnimation = nil;
if (_shimmeringBeginFadeDuration > 0.0 && !disableActions) {
fadeOutAnimation = shimmer_begin_fade_animation(self, _maskLayer.fadeLayer, 0.0, _shimmeringBeginFadeDuration);
fadeOutAnimation = fade_animation(_maskLayer.fadeLayer, 0.0, _shimmeringBeginFadeDuration);
[_maskLayer.fadeLayer addAnimation:fadeOutAnimation forKey:kFBFadeAnimationKey];
} else {
BOOL disableActions = [CATransaction disableActions];
BOOL innerDisableActions = [CATransaction disableActions];
[CATransaction setDisableActions:YES];
_maskLayer.fadeLayer.opacity = 0.0;
[_maskLayer.fadeLayer removeAllAnimations];
[CATransaction setDisableActions:disableActions];
[CATransaction setDisableActions:innerDisableActions];
}
// begin slide animation
CAAnimation *slideAnimation = [_maskLayer animationForKey:kFBShimmerSlideAnimationKey];
// compute shimmer duration
CFTimeInterval animationDuration = (CGRectGetWidth(_contentLayer.bounds) / _shimmeringSpeed) + _shimmeringPauseDuration;
CGFloat length = 0.0f;
if (_shimmeringDirection == FBShimmerDirectionDown ||
_shimmeringDirection == FBShimmerDirectionUp) {
length = CGRectGetHeight(_contentLayer.bounds);
} else {
length = CGRectGetWidth(_contentLayer.bounds);
}
CFTimeInterval animationDuration = (length / _shimmeringSpeed) + _shimmeringPauseDuration;
if (slideAnimation != nil) {
// ensure existing slide animation repeats
[_maskLayer addAnimation:shimmer_slide_repeat(slideAnimation, animationDuration) forKey:kFBShimmerSlideAnimationKey];
[_maskLayer addAnimation:shimmer_slide_repeat(slideAnimation, animationDuration, _shimmeringDirection) forKey:kFBShimmerSlideAnimationKey];
} else {
// add slide animation
slideAnimation = shimmer_slide_animation(self, animationDuration);
slideAnimation = shimmer_slide_animation(animationDuration, _shimmeringDirection);
slideAnimation.fillMode = kCAFillModeForwards;
slideAnimation.removedOnCompletion = NO;
slideAnimation.beginTime = CACurrentMediaTime() + fadeOutAnimation.duration;
if (_shimmeringBeginTime == FBShimmerDefaultBeginTime) {
_shimmeringBeginTime = CACurrentMediaTime() + fadeOutAnimation.duration;
}
slideAnimation.beginTime = _shimmeringBeginTime;
[_maskLayer addAnimation:slideAnimation forKey:kFBShimmerSlideAnimationKey];
}
}
@@ -385,6 +470,8 @@ static CAAnimation *shimmer_slide_finish(CAAnimation *a)
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
if (flag && [[anim valueForKey:kFBEndFadeAnimationKey] boolValue]) {
[_maskLayer.fadeLayer removeAnimationForKey:kFBFadeAnimationKey];
[self _clearMask];
}
}
+22 -7
View File
@@ -38,13 +38,17 @@
LAYER_ACCESSOR (accessor, ctype) \
LAYER_MUTATOR (mutator, ctype)
LAYER_RW_PROPERTY(isShimmering, setShimmering:, BOOL);
LAYER_RW_PROPERTY(shimmeringPauseDuration, setShimmeringPauseDuration:, CFTimeInterval);
LAYER_RW_PROPERTY(shimmeringOpacity, setShimmeringOpacity:, CGFloat);
LAYER_RW_PROPERTY(shimmeringSpeed, setShimmeringSpeed:, CGFloat);
LAYER_ACCESSOR(shimmeringFadeTime, CFTimeInterval);
LAYER_RW_PROPERTY(shimmeringBeginFadeDuration, setShimmeringBeginFadeDuration:, CFTimeInterval);
LAYER_RW_PROPERTY(shimmeringEndFadeDuration, setShimmeringEndFadeDuration:, CFTimeInterval);
LAYER_RW_PROPERTY(isShimmering, setShimmering:, BOOL)
LAYER_RW_PROPERTY(shimmeringPauseDuration, setShimmeringPauseDuration:, CFTimeInterval)
LAYER_RW_PROPERTY(shimmeringAnimationOpacity, setShimmeringAnimationOpacity:, CGFloat)
LAYER_RW_PROPERTY(shimmeringOpacity, setShimmeringOpacity:, CGFloat)
LAYER_RW_PROPERTY(shimmeringSpeed, setShimmeringSpeed:, CGFloat)
LAYER_RW_PROPERTY(shimmeringHighlightLength, setShimmeringHighlightLength:, CGFloat)
LAYER_RW_PROPERTY(shimmeringDirection, setShimmeringDirection:, FBShimmerDirection)
LAYER_ACCESSOR(shimmeringFadeTime, CFTimeInterval)
LAYER_RW_PROPERTY(shimmeringBeginFadeDuration, setShimmeringBeginFadeDuration:, CFTimeInterval)
LAYER_RW_PROPERTY(shimmeringEndFadeDuration, setShimmeringEndFadeDuration:, CFTimeInterval)
LAYER_RW_PROPERTY(shimmeringBeginTime, setShimmeringBeginTime:, CFTimeInterval)
- (void)setContentView:(UIView *)contentView
{
@@ -55,4 +59,15 @@ LAYER_RW_PROPERTY(shimmeringEndFadeDuration, setShimmeringEndFadeDuration:, CFTi
}
}
- (void)layoutSubviews
{
// Autolayout requires these to be set on the UIView, not the CALayer.
// Do this *before* the layer has a chance to set the properties, as the
// setters would be ignored (even for autolayout) if set to the same value.
_contentView.bounds = self.bounds;
_contentView.center = self.center;
[super layoutSubviews];
}
@end
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
+12
View File
@@ -0,0 +1,12 @@
/**
Copyright (c) 2014-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Shimmer/FBShimmering.h>
#import <Shimmer/FBShimmeringView.h>
#import <Shimmer/FBShimmeringLayer.h>
-23
View File
@@ -1,23 +0,0 @@
Additional Grant of Patent Rights
"Software" means the Shimmer software distributed by Facebook, Inc.
Facebook hereby grants you a perpetual, worldwide, royalty-free, non-exclusive,
irrevocable (subject to the termination provision below) license under any
rights in any patent claims owned by Facebook, to make, have made, use, sell,
offer to sell, import, and otherwise transfer the Software. For avoidance of
doubt, no license is granted under Facebooks rights in any patent claims that
are infringed by (i) modifications to the Software made by you or a third party,
or (ii) the Software in combination with any software or other technology
provided by you or a third party.
The license granted hereunder will terminate, automatically and without notice,
for anyone that makes any claim (including by filing any lawsuit, assertion or
other action) alleging (a) direct, indirect, or contributory infringement or
inducement to infringe any patent: (i) by Facebook or any of its subsidiaries or
affiliates, whether or not such claim is related to the Software, (ii) by any
party if such claim arises in whole or in part from any software, product or
service of Facebook or any of its subsidiaries or affiliates, whether or not
such claim is related to the Software, or (iii) by any party relating to the
Software; or (b) that any right in any patent claim of Facebook is invalid or
unenforceable.
+6 -2
View File
@@ -23,7 +23,7 @@ shimmeringView.contentView = loadingLabel;
shimmeringView.shimmering = YES;
```
There's also an example project. In the example, you can swipe horizontally and vertically to try various shimmering parameters, or tap to start or stop shimmering.
There's also an example project. In the example, you can swipe horizontally and vertically to try various shimmering parameters, or tap to start or stop shimmering. (To build the example locally, you'll need to open `FBShimmering.xcworkpace` rather than the `.xcodeproj`.)
## Installation
There are two options:
@@ -36,9 +36,13 @@ Shimmer requires iOS 6 or later.
## How it works
Shimmer uses the `-[CALayer mask]` property to enable shimmering, similar to what's described in John Harper's 2009 WWDC talk (unfortunately no longer online). Shimmer uses CoreAnimation's timing features to smoothly transition "on-beat" when starting and stopping the shimmer.
## Other Platforms
We have a version of Shimmer for Android, too! It's [also available on GitHub](https://github.com/facebook/shimmer-android).
## Contributing
See the CONTRIBUTING file for how to help out.
## License
Shimmer is BSD-licensed. We also provide an additional patent grant.
Shimmer is BSD-licensed.
+2 -2
View File
@@ -1,11 +1,11 @@
Pod::Spec.new do |spec|
spec.name = 'Shimmer'
spec.version = '1.0.0'
spec.version = '1.0.2'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/facebook/Shimmer'
spec.authors = { 'Grant Paul' => 'shimmer@grantpaul.com', 'Kimon Tsinteris' => 'kimon@mac.com' }
spec.summary = 'Simple shimmering effect.'
spec.source = { :git => 'https://github.com/facebook/Shimmer.git', :tag => '1.0.0' }
spec.source = { :git => 'https://github.com/facebook/Shimmer.git', :tag => '1.0.2' }
spec.source_files = 'FBShimmering/FBShimmering{,View,Layer}.{h,m}'
spec.requires_arc = true