Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created January 21, 2021 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amosgyamfi/30e133581d3c3e5ed4d6fe988d3558ce to your computer and use it in GitHub Desktop.
Save amosgyamfi/30e133581d3c3e5ed4d6fe988d3558ce to your computer and use it in GitHub Desktop.
//
// 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