Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Last active March 29, 2024 01:17
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/a5e094c083ab947128db91ee0e32fabb to your computer and use it in GitHub Desktop.
Save amosgyamfi/a5e094c083ab947128db91ee0e32fabb to your computer and use it in GitHub Desktop.
//
// LoadFromRemoteURL.swift
// OpenvisionOS
//
// Created by Amos Gyamfi on 24.3.2024.
//
import SwiftUI
import RealityKit
import RealityKitContent
/* MARK: Get 3D Models (usdz)
1. https://developer.apple.com/augmented-reality/quick-look/
2. https://developer.apple.com/augmented-reality/object-capture/
*/
struct LoadFromRemoteURL: View {
let modelURL = URL(string: "https://developer.apple.com/augmented-reality/quick-look/models/nike-pegasus/sneaker_pegasustrail.usdz")!
var body: some View {
Model3D(url: modelURL) { model in
model.resizable()
.aspectRatio(contentMode: .fit)
.scaleEffect(0.5)
.phaseAnimator([false, true]) { nikeSneaker, rotate in
nikeSneaker
.rotation3DEffect(.degrees( rotate ? 720 : 0), axis: (x: -5, y: 5, z: 5))
} animation: { rotate in
.easeInOut(duration: 8)
}
} placeholder: {
ProgressView()
}
}
}
#Preview {
LoadFromRemoteURL()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment