Created
February 17, 2024 00:19
-
-
Save amosgyamfi/91bc97d1533dc2648df2c680b5c29e4a 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
// | |
// VisionPro3DRotation.swift | |
// OpenvisionOS | |
// | |
// Created by Amos Gyamfi on 16.2.2024. | |
// | |
import SwiftUI | |
import RealityKit | |
struct VisionPro3DRotation: View { | |
@State private var isRotating = 0.0 | |
var body: some View { | |
NavigationStack { | |
Model3D(named: "Apple_Vision_Pro") { model in | |
model | |
.resizable() | |
.aspectRatio(contentMode: .fit) | |
.scaleEffect(0.3) | |
.rotation3DEffect(.degrees(isRotating * 2), axis: (x: 15, y: -15, z: 15)) | |
} placeholder: { | |
ProgressView() | |
} | |
.toolbar { | |
ToolbarItemGroup(placement: .bottomOrnament) { | |
VStack { | |
Slider(value: $isRotating, in: 0...359) | |
.frame(width: 360) | |
.padding() | |
Text("Take a closeer look") | |
} | |
} | |
} | |
} | |
} | |
} | |
#Preview { | |
VisionPro3DRotation() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment