diff --git a/Clocker/Onboarding/Onboarding Animated Views/CLFavouriteAnimatedView.h b/Clocker/Onboarding/Onboarding Animated Views/CLFavouriteAnimatedView.h new file mode 100644 index 0000000..b1d7e5f --- /dev/null +++ b/Clocker/Onboarding/Onboarding Animated Views/CLFavouriteAnimatedView.h @@ -0,0 +1,17 @@ +// +// CLFavouriteAnimatedView.h +// +// Code generated using QuartzCode 1.39.17 on 5/16/16. +// www.quartzcodeapp.com +// + +#import + +IB_DESIGNABLE +@interface CLFavouriteAnimatedView : NSView + +- (void)addUntitled1Animation; +- (void)removeAnimationsForAnimationId:(NSString *)identifier; +- (void)removeAllAnimations; + +@end diff --git a/Clocker/Onboarding/Onboarding Animated Views/CLFavouriteAnimatedView.m b/Clocker/Onboarding/Onboarding Animated Views/CLFavouriteAnimatedView.m new file mode 100644 index 0000000..78a4384 --- /dev/null +++ b/Clocker/Onboarding/Onboarding Animated Views/CLFavouriteAnimatedView.m @@ -0,0 +1,134 @@ +// +// CLFavouriteAnimatedView.m +// +// Code generated using QuartzCode 1.39.17 on 5/16/16. +// www.quartzcodeapp.com +// + +#import "CLFavouriteAnimatedView.h" +#import "QCMethod.h" + +@interface CLFavouriteAnimatedView () + +@property (nonatomic, strong) NSMutableDictionary * layers; + + +@end + +@implementation CLFavouriteAnimatedView + +#pragma mark - Life Cycle + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self setupProperties]; + [self setupLayers]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + [self setupProperties]; + [self setupLayers]; + } + return self; +} + + + +- (void)setupProperties{ + self.layers = [NSMutableDictionary dictionary]; + +} + +- (void)setupLayers{ + [self setWantsLayer:YES]; + + CALayer * ScreenShot20160515at113112PM = [CALayer layer]; + ScreenShot20160515at113112PM.frame = CGRectMake(0, -115, 400, 358.62); + ScreenShot20160515at113112PM.contents = [NSImage imageNamed:@"Screen Shot 2016-05-15 at 11.31.12 PM"]; + [self.layer addSublayer:ScreenShot20160515at113112PM]; + self.layers[@"ScreenShot20160515at113112PM"] = ScreenShot20160515at113112PM; + + CAShapeLayer * rectangle = [CAShapeLayer layer]; + rectangle.frame = CGRectMake(63, 140, 10, 11); + rectangle.fillColor = [NSColor blueColor].CGColor; + rectangle.strokeColor = [NSColor colorWithRed:0.329 green: 0.329 blue:0.329 alpha:1].CGColor; + rectangle.path = [self rectanglePath].quartzPath; + [self.layer addSublayer:rectangle]; + self.layers[@"rectangle"] = rectangle; + + CALayer * MenuBar = [CALayer layer]; + MenuBar.frame = CGRectMake(85, 261, 296, 23); + MenuBar.masksToBounds = YES; + MenuBar.contents = [NSImage imageNamed:@"MenuBar"]; + MenuBar.contentsGravity = kCAGravityResizeAspect; + [self.layer addSublayer:MenuBar]; + self.layers[@"MenuBar"] = MenuBar; +} + + + +#pragma mark - Animation Setup + +- (void)addUntitled1Animation{ + NSString * fillMode = kCAFillModeForwards; + + ////Rectangle animation + CAKeyframeAnimation * rectangleFillColorAnim = [CAKeyframeAnimation animationWithKeyPath:@"fillColor"]; + rectangleFillColorAnim.values = @[(id)[NSColor whiteColor].CGColor, + (id)[NSColor colorWithRed:0.263 green: 0.541 blue:0.98 alpha:1].CGColor]; + rectangleFillColorAnim.keyTimes = @[@0, @1]; + rectangleFillColorAnim.duration = 1; + rectangleFillColorAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; + + CAAnimationGroup * rectangleUntitled1Anim = [QCMethod groupAnimations:@[rectangleFillColorAnim] fillMode:fillMode]; + [self.layers[@"rectangle"] addAnimation:rectangleUntitled1Anim forKey:@"rectangleUntitled1Anim"]; + + ////MenuBar animation + CAKeyframeAnimation * MenuBarHiddenAnim = [CAKeyframeAnimation animationWithKeyPath:@"hidden"]; + MenuBarHiddenAnim.values = @[@YES, @NO]; + MenuBarHiddenAnim.keyTimes = @[@0, @1]; + MenuBarHiddenAnim.duration = 2.82; + MenuBarHiddenAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; + + CAAnimationGroup * MenuBarUntitled1Anim = [QCMethod groupAnimations:@[MenuBarHiddenAnim] fillMode:fillMode]; + [self.layers[@"MenuBar"] addAnimation:MenuBarUntitled1Anim forKey:@"MenuBarUntitled1Anim"]; +} + +#pragma mark - Animation Cleanup + +- (void)updateLayerValuesForAnimationId:(NSString *)identifier{ + if([identifier isEqualToString:@"Untitled1"]){ + [QCMethod updateValueFromPresentationLayerForAnimation:[self.layers[@"rectangle"] animationForKey:@"rectangleUntitled1Anim"] theLayer:self.layers[@"rectangle"]]; + [QCMethod updateValueFromPresentationLayerForAnimation:[self.layers[@"MenuBar"] animationForKey:@"MenuBarUntitled1Anim"] theLayer:self.layers[@"MenuBar"]]; + } +} + +- (void)removeAnimationsForAnimationId:(NSString *)identifier{ + if([identifier isEqualToString:@"Untitled1"]){ + [self.layers[@"rectangle"] removeAnimationForKey:@"rectangleUntitled1Anim"]; + [self.layers[@"MenuBar"] removeAnimationForKey:@"MenuBarUntitled1Anim"]; + } +} + +- (void)removeAllAnimations{ + [self.layers enumerateKeysAndObjectsUsingBlock:^(id key, CALayer *layer, BOOL *stop) { + [layer removeAllAnimations]; + }]; +} + +#pragma mark - Bezier Path + +- (NSBezierPath*)rectanglePath{ + NSBezierPath * rectanglePath = [NSBezierPath bezierPathWithRect:CGRectMake(0, 0, 10, 11)]; + return rectanglePath; +} + + +@end diff --git a/Clocker/Onboarding/Onboarding Animated Views/CLShortcutAnimatedView.h b/Clocker/Onboarding/Onboarding Animated Views/CLShortcutAnimatedView.h new file mode 100644 index 0000000..018e9c1 --- /dev/null +++ b/Clocker/Onboarding/Onboarding Animated Views/CLShortcutAnimatedView.h @@ -0,0 +1,19 @@ +// +// CLShortcutAnimatedView.h +// +// Code generated using QuartzCode 1.39.17 on 5/16/16. +// www.quartzcodeapp.com +// + +#import + +IB_DESIGNABLE +@interface CLShortcutAnimatedView : NSView + + + +- (void)addScaleAnimationAnimation; +- (void)removeAnimationsForAnimationId:(NSString *)identifier; +- (void)removeAllAnimations; + +@end diff --git a/Clocker/Onboarding/Onboarding Animated Views/CLShortcutAnimatedView.m b/Clocker/Onboarding/Onboarding Animated Views/CLShortcutAnimatedView.m new file mode 100644 index 0000000..4f3c6ee --- /dev/null +++ b/Clocker/Onboarding/Onboarding Animated Views/CLShortcutAnimatedView.m @@ -0,0 +1,148 @@ +// +// CLShortcutAnimatedView.m +// +// Code generated using QuartzCode 1.39.17 on 5/16/16. +// www.quartzcodeapp.com +// + +#import "CLShortcutAnimatedView.h" +#import "QCMethod.h" + +@interface CLShortcutAnimatedView () + +@property (nonatomic, strong) NSMutableDictionary * layers; +@property (nonatomic, strong) NSMapTable * completionBlocks; +@property (nonatomic, assign) BOOL updateLayerValueForCompletedAnimation; + + +@end + +@implementation CLShortcutAnimatedView + +#pragma mark - Life Cycle + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self setupProperties]; + [self setupLayers]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + [self setupProperties]; + [self setupLayers]; + } + return self; +} + + + +- (void)setupProperties{ + self.completionBlocks = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaqueMemory valueOptions:NSPointerFunctionsStrongMemory];; + self.layers = [NSMutableDictionary dictionary]; + +} + +- (void)setupLayers{ + [self setWantsLayer:YES]; + + CALayer * MainScreen = [CALayer layer]; + MainScreen.frame = CGRectMake(0, -45, 400, 358.62); + MainScreen.contents = [NSImage imageNamed:@"MainScreen"]; + [self.layer addSublayer:MainScreen]; + self.layers[@"MainScreen"] = MainScreen; + + CAShapeLayer * rectangle = [CAShapeLayer layer]; + rectangle.frame = CGRectMake(212.58, 15.4, 157, 44); + rectangle.opacity = 0.3; + rectangle.fillColor = [NSColor colorWithRed:0.922 green: 0.922 blue:0.922 alpha:1].CGColor; + rectangle.strokeColor = [NSColor blueColor].CGColor; + rectangle.lineWidth = 3; + rectangle.path = [self rectanglePath].quartzPath; + [self.layer addSublayer:rectangle]; + self.layers[@"rectangle"] = rectangle; +} + + + +#pragma mark - Animation Setup + +- (void)addScaleAnimationAnimation{ + NSString * fillMode = kCAFillModeForwards; + + ////An infinity animation + + ////Rectangle animation + CAKeyframeAnimation * rectangleStrokeEndAnim = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"]; + rectangleStrokeEndAnim.values = @[@0, @1]; + rectangleStrokeEndAnim.keyTimes = @[@0, @1]; + rectangleStrokeEndAnim.duration = 1.59; + rectangleStrokeEndAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; + + CAKeyframeAnimation * rectangleTransformAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; + rectangleTransformAnim.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.95, 0.95, 1)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.1, 1.1, 1)]]; + rectangleTransformAnim.keyTimes = @[@0, @1]; + rectangleTransformAnim.duration = 1.4; + rectangleTransformAnim.beginTime = 1.59; + rectangleTransformAnim.repeatCount = INFINITY; + rectangleTransformAnim.autoreverses = YES; + + CAAnimationGroup * rectangleScaleAnimationAnim = [QCMethod groupAnimations:@[rectangleStrokeEndAnim, rectangleTransformAnim] fillMode:fillMode]; + [self.layers[@"rectangle"] addAnimation:rectangleScaleAnimationAnim forKey:@"rectangleScaleAnimationAnim"]; +} + +#pragma mark - Animation Cleanup + +- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{ + void (^completionBlock)(BOOL) = [self.completionBlocks objectForKey:anim];; + if (completionBlock){ + [self.completionBlocks removeObjectForKey:anim]; + if ((flag && self.updateLayerValueForCompletedAnimation) || [[anim valueForKey:@"needEndAnim"] boolValue]){ + [self updateLayerValuesForAnimationId:[anim valueForKey:@"animId"]]; + [self removeAnimationsForAnimationId:[anim valueForKey:@"animId"]]; + } + completionBlock(flag); + } +} + +- (void)updateLayerValuesForAnimationId:(NSString *)identifier{ + if([identifier isEqualToString:@"scaleAnimation"]){ + [QCMethod updateValueFromPresentationLayerForAnimation:[self.layers[@"rectangle"] animationForKey:@"rectangleScaleAnimationAnim"] theLayer:self.layers[@"rectangle"]]; + } +} + +- (void)removeAnimationsForAnimationId:(NSString *)identifier{ + if([identifier isEqualToString:@"scaleAnimation"]){ + [self.layers[@"rectangle"] removeAnimationForKey:@"rectangleScaleAnimationAnim"]; + } +} + +- (void)removeAllAnimations{ + [self.layers enumerateKeysAndObjectsUsingBlock:^(id key, CALayer *layer, BOOL *stop) { + [layer removeAllAnimations]; + }]; +} + +#pragma mark - Bezier Path + +- (NSBezierPath*)rectanglePath{ + NSBezierPath *rectanglePath = [NSBezierPath bezierPath]; + [rectanglePath moveToPoint:CGPointMake(0, 0)]; + [rectanglePath lineToPoint:CGPointMake(157, 0)]; + [rectanglePath lineToPoint:CGPointMake(157, 44)]; + [rectanglePath lineToPoint:CGPointMake(0, 44)]; + [rectanglePath closePath]; + [rectanglePath moveToPoint:CGPointMake(0, 0)]; + + return rectanglePath; +} + + +@end diff --git a/Clocker/Onboarding/Onboarding Animated Views/FloatingView.h b/Clocker/Onboarding/Onboarding Animated Views/FloatingView.h new file mode 100644 index 0000000..218a7d0 --- /dev/null +++ b/Clocker/Onboarding/Onboarding Animated Views/FloatingView.h @@ -0,0 +1,17 @@ +// +// FloatingView.h +// +// Code generated using QuartzCode 1.39.17 on 5/16/16. +// www.quartzcodeapp.com +// + +#import + +IB_DESIGNABLE +@interface FloatingView : NSView + +- (void)addUntitled1Animation; +- (void)removeAnimationsForAnimationId:(NSString *)identifier; +- (void)removeAllAnimations; + +@end diff --git a/Clocker/Onboarding/Onboarding Animated Views/FloatingView.m b/Clocker/Onboarding/Onboarding Animated Views/FloatingView.m new file mode 100644 index 0000000..b5b7e0f --- /dev/null +++ b/Clocker/Onboarding/Onboarding Animated Views/FloatingView.m @@ -0,0 +1,159 @@ +// +// FloatingView.m +// +// Code generated using QuartzCode 1.39.17 on 5/16/16. +// www.quartzcodeapp.com +// + +#import "FloatingView.h" +#import "QCMethod.h" + +@interface FloatingView () + +@property (nonatomic, strong) NSMutableDictionary * layers; +@property (nonatomic, strong) NSMapTable * completionBlocks; +@property (nonatomic, assign) BOOL updateLayerValueForCompletedAnimation; + + +@end + +@implementation FloatingView + +#pragma mark - Life Cycle + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self setupProperties]; + [self setupLayers]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + [self setupProperties]; + [self setupLayers]; + } + return self; +} + + + +- (void)setupProperties{ + self.completionBlocks = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaqueMemory valueOptions:NSPointerFunctionsStrongMemory];; + self.layers = [NSMutableDictionary dictionary]; + +} + +- (void)setupLayers{ + [self setWantsLayer:YES]; + + CALayer * ActualScreen = [CALayer layer]; + ActualScreen.frame = CGRectMake(-1.5, 80, 403, 122); + ActualScreen.contents = [NSImage imageNamed:@"ActualScreen"]; + [self.layer addSublayer:ActualScreen]; + self.layers[@"ActualScreen"] = ActualScreen; + + CAShapeLayer * oval = [CAShapeLayer layer]; + oval.frame = CGRectMake(220.5, 69.89, 128.04, 130); + oval.opacity = 0.42; + oval.fillColor = nil; + oval.strokeColor = [NSColor blueColor].CGColor; + oval.lineWidth = 5; + oval.path = [self ovalPath].quartzPath; + + CAGradientLayer * ovalGradient = [CAGradientLayer layer]; + CAShapeLayer * ovalMask = [CAShapeLayer layer]; + ovalMask.path = oval.path; + ovalGradient.mask = ovalMask; + ovalGradient.frame = oval.bounds; + ovalGradient.colors = @[(id)[NSColor colorWithRed:0.922 green: 0.922 blue:0.922 alpha:1].CGColor, (id)[NSColor whiteColor].CGColor]; + ovalGradient.startPoint = CGPointMake(0.5, 1); + ovalGradient.endPoint = CGPointMake(0.5, 0); + [oval addSublayer:ovalGradient]; + [self.layer addSublayer:oval]; + self.layers[@"oval"] = oval; + self.layers[@"ovalGradient"] = ovalGradient; +} + + + +#pragma mark - Animation Setup + +- (void)addUntitled1Animation +{ + NSString * fillMode = kCAFillModeForwards; + + ////An infinity animation + + ////Oval animation + CAKeyframeAnimation * ovalStrokeStartAnim = [CAKeyframeAnimation animationWithKeyPath:@"strokeStart"]; + ovalStrokeStartAnim.values = @[@1, @0]; + ovalStrokeStartAnim.keyTimes = @[@0, @1]; + ovalStrokeStartAnim.duration = 1; + + CAKeyframeAnimation * ovalTransformAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; + ovalTransformAnim.values = @[[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.7, 0.7, 1)], + [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.2)]]; + ovalTransformAnim.keyTimes = @[@0, @1]; + ovalTransformAnim.duration = 1; + ovalTransformAnim.beginTime = 1.01; + ovalTransformAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; + ovalTransformAnim.repeatCount = INFINITY; + ovalTransformAnim.autoreverses = YES; + + CAAnimationGroup * ovalUntitled1Anim = [QCMethod groupAnimations:@[ovalStrokeStartAnim, ovalTransformAnim] fillMode:fillMode]; + [self.layers[@"oval"] addAnimation:ovalUntitled1Anim forKey:@"ovalUntitled1Anim"]; +} + +#pragma mark - Animation Cleanup + +- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{ + void (^completionBlock)(BOOL) = [self.completionBlocks objectForKey:anim];; + if (completionBlock){ + [self.completionBlocks removeObjectForKey:anim]; + if ((flag && self.updateLayerValueForCompletedAnimation) || [[anim valueForKey:@"needEndAnim"] boolValue]){ + [self updateLayerValuesForAnimationId:[anim valueForKey:@"animId"]]; + [self removeAnimationsForAnimationId:[anim valueForKey:@"animId"]]; + } + completionBlock(flag); + } +} + +- (void)updateLayerValuesForAnimationId:(NSString *)identifier{ + if([identifier isEqualToString:@"Untitled1"]){ + [QCMethod updateValueFromPresentationLayerForAnimation:[self.layers[@"oval"] animationForKey:@"ovalUntitled1Anim"] theLayer:self.layers[@"oval"]]; + } +} + +- (void)removeAnimationsForAnimationId:(NSString *)identifier{ + if([identifier isEqualToString:@"Untitled1"]){ + [self.layers[@"oval"] removeAnimationForKey:@"ovalUntitled1Anim"]; + } +} + +- (void)removeAllAnimations{ + [self.layers enumerateKeysAndObjectsUsingBlock:^(id key, CALayer *layer, BOOL *stop) { + [layer removeAllAnimations]; + }]; +} + +#pragma mark - Bezier Path + +- (NSBezierPath*)ovalPath{ + NSBezierPath *ovalPath = [NSBezierPath bezierPath]; + [ovalPath moveToPoint:CGPointMake(64.018, 130)]; + [ovalPath curveToPoint:CGPointMake(0, 65) controlPoint1:CGPointMake(28.662, 130) controlPoint2:CGPointMake(0, 100.899)]; + [ovalPath curveToPoint:CGPointMake(64.018, 0) controlPoint1:CGPointMake(0, 29.101) controlPoint2:CGPointMake(28.662, 0)]; + [ovalPath curveToPoint:CGPointMake(128.035, 65) controlPoint1:CGPointMake(99.374, 0) controlPoint2:CGPointMake(128.035, 29.101)]; + [ovalPath curveToPoint:CGPointMake(64.018, 130) controlPoint1:CGPointMake(128.035, 100.899) controlPoint2:CGPointMake(99.374, 130)]; + + return ovalPath; +} + + +@end