calm / KenBurns

A little Swift utility that performs the Ken Burns effect on an image
http://calm.com/jobs
MIT License
31 stars 18 forks source link

Initial Delay #11

Open a-v-ebrahimi opened 7 years ago

a-v-ebrahimi commented 7 years ago

Initially KenBurnsImageView shows nothing, but after a while starts to animate.

curest0x1021 commented 4 years ago

I found same issue, but can't resolve this.

PeterAlanoca commented 4 years ago
var kenBurns = KenBurnsImageView();

override func viewDidLoad() {
    super.viewDidLoad()
    let image = #imageLiteral(resourceName: "loginBackground1")
    kenBurns = newKenBurnsImageView(image: image)
    self.view.addSubview(kenBurns)
}

func newKenBurnsImageView(image: UIImage) -> KenBurnsImageView {
    let ken = KenBurnsImageView()
    ken.setImage(image)
    ken.zoomIntensity = 1.5
    ken.setDuration(min: 5, max: 13)
    ken.frame = view.bounds
    ken.startAnimating()
    return ken
}
steve111MV commented 4 years ago

I can't yet resolve it but i used a simple trick as i'm using SwiftUI

ZStack {
          Image("my_asset_image")
                        .resizable()
                        .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 240, alignment: .top)

          CustomKenBurnsImageView(imageName: "my_asset_image")
                          .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 240, alignment: .top)
}

And during the delay i have a static image in the background. And the EndUser does't experiment the 4 seconds delay

andreybutov commented 3 years ago

I put in a quick/hacky workaround resolving the crash related to the queue and the delay on initial animation. PR is pending. You can find it here in the meantime: https://github.com/Antair/KenBurns/commit/e14510a09e20957723e6ab0dfbd0a60474b9143b