3D tilt with a dynamic shadow, like widget previews in iOS. SwiftUI & UIKit.
In Xcode: File → Add Package Dependencies → paste URL:
https://github.com/sparrowcode/PerspectiveKit
WidgetPreview()
.perspective(.widgetAnimatable)let perspectiveView = PerspectiveView(config: .widgetAnimatable)
perspectiveView.contentView.addSubview(widgetPreview).widgetStatic tilts without animation. Every value is configurable:
var config = PerspectiveConfig.widgetAnimatable
config.angle = 14
config.corner = .topLeft
config.animation = PerspectiveAnimation(duration: 10, direction: .counterclockwise)
config.shadow?.opacity = 0.4