Skip to content

Commit 1b3fafa

Browse files
authored
Merge pull request #30 from iCarambaa/patch-1
Make nycan cat move back- and forwards.
2 parents b4d2ac4 + 22ecae8 commit 1b3fafa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

touchbar_nyancat/NyanCatCanvas.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,13 @@ class NyanCatCanvas: NSImageView {
4747

4848
}
4949

50+
var direction: CGFloat = 1
5051
@objc public func moveNyancat() {
51-
if (xPosition < 0) {
52-
xPosition += 1
52+
xPosition += direction
53+
if xPosition > 0 {
54+
direction = -1
55+
} else if xPosition < -680 {
56+
direction = 1
5357
}
5458
}
5559

0 commit comments

Comments
 (0)