Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created February 17, 2024 00:19
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/91bc97d1533dc2648df2c680b5c29e4a to your computer and use it in GitHub Desktop.
Save amosgyamfi/91bc97d1533dc2648df2c680b5c29e4a to your computer and use it in GitHub Desktop.
//
// 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