Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anthonylatsis/sombra

A simple retroaction on CALayer to support vibrant image projections as shadows.
https://github.com/anthonylatsis/sombra

calayer image ios layer shadow shadows swift xcode

Last synced: 9 days ago
JSON representation

A simple retroaction on CALayer to support vibrant image projections as shadows.

Awesome Lists containing this project

README

        

# Sombra

A light native-style retroaction on `CALayer` to support vibrant image projections as shadows.

## Usage

To have an image projection instead of a plane color as a shadow, you use `shadowImage`. The rest is set up the usual way using existing shadow properties.

``` swift
view.layer.shadowOpacity = 0.8
view.layer.shadowOffset = CGSize(width: 0, height: 15)
view.layer.shadowRadius = 30
view.layer.shadowImage = UIImage().cgImage
```
### Considerations

While using an image projection as a shadow, the value of `shadowOpacity` will be cached and the property itself set to zero. This is done for the regular shadow not to appear. Setting the image to `nil` will leave you with a regular shadow, if any (`shadowOpacity > 0`).
The image projection currently doesn't support animating through shadow properties.

## Requirements

* Xcode 9 +
* Swift 4 +
* iOS 10 +

## Installation

Sombra can be integrated using [CocoaPods](https://cocoapods.org/). Specify it in your `Podfile` and run `$ pod install`.

``` ruby
platform :ios, '10.0'
use_frameworks!

target '' do
pod 'Sombra'
end
```