Last active
March 29, 2024 01:17
-
-
Save amosgyamfi/a5e094c083ab947128db91ee0e32fabb 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
// | |
// 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