mirror of
https://github.com/avatsaev/touchbar_nyancat
synced 2024-11-21 18:53:06 +00:00
Merge pull request #30 from iCarambaa/patch-1
Make nycan cat move back- and forwards.
This commit is contained in:
commit
1b3fafacd0
1 changed files with 6 additions and 2 deletions
|
@ -47,9 +47,13 @@ class NyanCatCanvas: NSImageView {
|
|||
|
||||
}
|
||||
|
||||
var direction: CGFloat = 1
|
||||
@objc public func moveNyancat() {
|
||||
if (xPosition < 0) {
|
||||
xPosition += 1
|
||||
xPosition += direction
|
||||
if xPosition > 0 {
|
||||
direction = -1
|
||||
} else if xPosition < -680 {
|
||||
direction = 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue