Skip to content
Proyectos

Acerca de

Efecto de inclinación 3D con sombra dinámica, como en las vistas previas de widgets de iOS. Para UIKit y SwiftUI.

Desarrollo web y de aplicaciones

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

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

Explorar proyectos relacionados

Cargando…