项目
在 GitHub 查看 
sparrowcode/PerspectiveKit
关于
实现带动态阴影的 3D 倾斜效果,类似 iOS 中的小组件预览。支持 UIKit 和 SwiftUI。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文PerspectiveKit
3D tilt with a dynamic shadow, like widget previews in iOS. SwiftUI & UIKit.

Installation
In Xcode: File → Add Package Dependencies → paste URL:
https://github.com/sparrowcode/PerspectiveKit
Usage
SwiftUI
WidgetPreview()
.perspective(.widgetAnimatable)
UIKit
// Content goes into contentView, like in UIVisualEffectView
let perspectiveView = PerspectiveView(config: .widgetAnimatable)
perspectiveView.contentView.addSubview(widgetPreview)
// A single rounded card with a background gets a cheaper shadow from its shape
widgetPreview.layer.cornerRadius = 22
widgetPreview.clipsToBounds = true
// Tilt off and on with a transition
perspectiveView.setTilted(false, animated: true)
perspectiveView.setTilted(true, animated: true)
// Start the transition later
perspectiveView.setTilted(true, animated: true, delay: 0.3)
// Appear: grayscale right away, color returns together with the tilt
perspectiveView.setTilted(true, animated: true, fromGrayscale: true, delay: 0.3)
// Without animation
perspectiveView.isTilted = false
Config
// .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
探索相关项目
加载中…