Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of NotificationCenter #15

Merged
merged 3 commits into from
Jan 31, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
move public functions up in file
amiantos committed Jan 31, 2022
commit 53b9f5e97b14f202a7ba6a69d3ab4bcb34929efd
96 changes: 49 additions & 47 deletions Shared/Scene/Animations.swift
Original file line number Diff line number Diff line change
@@ -60,6 +60,54 @@ class Animation {

}

// Static methods for queuing animations

static func spinBothHands(by degrees: CGFloat) -> Animation {
let animation = Animation(animation: .spinBothHands)
animation.degrees = degrees
return animation
}

static func printString(string: String) -> Animation {
let animation = Animation(animation: .print)
animation.string = string
return animation
}

static func currentTimePrint() -> Animation {
return Animation(animation: .currentTimePrint)
}

static func currentTimeClock() -> Animation {
return Animation(animation: .currentTimeClock)
}

static func wait(duration: TimeInterval) -> Animation {
let animation = Animation(animation: .wait)
animation.duration = duration
return animation
}

static func positionBothHands(minuteDegrees: CGFloat, hourDegrees: CGFloat) -> Animation {
let animation = Animation(animation: .positionBothHands)
animation.minuteDegrees = minuteDegrees
animation.hourDegrees = hourDegrees
return animation
}

static func spinBothHandsWithDelay(by degrees: CGFloat, delay: TimeInterval) -> Animation {
let animation = Animation(animation: .spinBothHandsWithDelay)
animation.degrees = degrees
animation.delay = delay
return animation
}

static func display(pattern: [Int: [(CGFloat, CGFloat)]]) -> Animation {
let animation = Animation(animation: .displayPattern)
animation.pattern = pattern
return animation
}

// Animations

private func wait(clocks: [ClockNode]) -> SKAction {
@@ -273,53 +321,7 @@ class Animation {
return distanceInDegrees.degreesToRadians()
}

// Static methods for queuing animations

static func spinBothHands(by degrees: CGFloat) -> Animation {
let animation = Animation(animation: .spinBothHands)
animation.degrees = degrees
return animation
}

static func printString(string: String) -> Animation {
let animation = Animation(animation: .print)
animation.string = string
return animation
}

static func currentTimePrint() -> Animation {
return Animation(animation: .currentTimePrint)
}

static func currentTimeClock() -> Animation {
return Animation(animation: .currentTimeClock)
}

static func wait(duration: TimeInterval) -> Animation {
let animation = Animation(animation: .wait)
animation.duration = duration
return animation
}

static func positionBothHands(minuteDegrees: CGFloat, hourDegrees: CGFloat) -> Animation {
let animation = Animation(animation: .positionBothHands)
animation.minuteDegrees = minuteDegrees
animation.hourDegrees = hourDegrees
return animation
}

static func spinBothHandsWithDelay(by degrees: CGFloat, delay: TimeInterval) -> Animation {
let animation = Animation(animation: .spinBothHandsWithDelay)
animation.degrees = degrees
animation.delay = delay
return animation
}

static func display(pattern: [Int: [(CGFloat, CGFloat)]]) -> Animation {
let animation = Animation(animation: .displayPattern)
animation.pattern = pattern
return animation
}
// Pattern Generators

static func randomizedPattern() -> [Int: [(CGFloat, CGFloat)]] {
return [