Giter Club home page Giter Club logo

Comments (1)

warpling avatar warpling commented on June 20, 2024

Two potential workarounds using the above code as an example:

A (best workaround)

Use animationDidStartBlock to set the target's value to match the fromValue. This will work even if the animation has a delayed beginTime. (If referencing self you may want to consider including [weak self] at the beginning of the block.)

flashAndFadeAnimation.animationDidStartBlock = { (animation) in
    view.alpha = flashAndFadeAnimation.fromValue as! CGFloat
}

B (simplest workaround if you aren't relying on beginTime)

Since POP actually changes the target's properties (unlike CAAnimation), you can set the target's property to the animation's fromValue before the animation is added:

view.alpha = flashAndFadeAnimation.fromValue as! CGFloat
view.pop_add(flashAndFadeAnimation, forKey: "flashAndFade")

C (quick, dirty, and error prone)

Set the toValue to something like 0.00001. But now if you then try to run this flash animation a second time the current value will now be the same as the toValue and the same problem can occur! To avoid this you might be able to set the target's value to 0.0 in the completionBlock.

from pop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.