Swiftpack.co - Package - peterminant/HeatHazedImageView

HeatHazedImageView

Image view simulating refraction of light passing through heated air, i.e. heat haze or burning effect.

Usage

  1. Link HeatHazedImageView library to your project as Swift Package Manager dependency in Package.swift or using Xcode
dependencies: [
    .package(url: "https://github.com/peterminant/HeatHazedImageView.git", from: "2.0.0")
],
targets: [
    .target(name: "YourTarget", dependencies: ["HeatHazedImageView"])
]
  1. Create view programatically or via Interface Builder
import HeatHazedImageView
...
let imageView: HeatHazedImageView!
  1. Set animation parameters
imageView.speed = 200 // speed of rising air: min = 0, max = 1000
imageView.distortion = 500 // intensity of distortion effect: min = 0, max = 1000
imageView.evaporation = 0 // controls how the effect diminishes as the air rises to the top: 0 = no evaporation, 1 = effect is nullified at view's top border
  1. Set source image
imageView.dataSource = .image(image) // use CGImage or UIImage
imageView.dataSource = .layer(caLayer) // render CALayer (e.g. CAGradientLayer) using screen scale
imageView.dataSource = .view(uiView, scale: 2) // render UIView (e.g. UILabel) using given scale
  1. Start / stop the animation
imageView.isPaused = false // false by default
  1. Refresh source image if needed
label.text = "1"
imageView.dataSource = .view(label)
...
label.text = "2"
imageView.dataSource?.setNeedsDisplay()

Requirements

Supported platforms are iOS 11.0 or later and tvOS 11.0 or later. If Metal is not available on target device, HeatHazedImageView will fallback to using plain UIImageView without additional effects.

Github

link
Stars: 0

Dependencies

Used By

Total: 0