Skip to content

Instantly share code, notes, and snippets.

@Plnda
Created September 1, 2020 11:20
Show Gist options
  • Save Plnda/a3d8c8c86ea0a9dad4c33f8ae17ab6f3 to your computer and use it in GitHub Desktop.
Save Plnda/a3d8c8c86ea0a9dad4c33f8ae17ab6f3 to your computer and use it in GitHub Desktop.
struct ParallaxModifier: ViewModifier {
@ObservedObject var manager: MotionManager = MotionManager.shared
var magnitude: Double
func body(content: Content) -> some View {
content
.offset(x: CGFloat(manager.roll * magnitude), y: CGFloat(manager.pitch * magnitude))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment