Created
January 21, 2021 02:44
-
-
Save amosgyamfi/30e133581d3c3e5ed4d6fe988d3558ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// OrientOnPath WatchKit Extension | |
// | |
// Created by Amos Gyamfi on 21.1.2021. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State var moveOnPath = false | |
var body: some View { | |
ZStack { | |
Circle() | |
.stroke() | |
.frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/) | |
Circle() | |
.frame(width: 15, height: 15, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/) | |
.foregroundColor(/*@START_MENU_TOKEN@*/.blue/*@END_MENU_TOKEN@*/) | |
.offset(x: -50) | |
.rotationEffect(.degrees(moveOnPath ? 0 : 360)) | |
.animation(Animation.linear(duration: 4).repeatForever(autoreverses: false)) | |
.onAppear() { | |
moveOnPath.toggle() | |
} | |
} | |
.rotation3DEffect( | |
.degrees(70), | |
axis: (x: 10, y: 0.5, z: 0.0)) | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment