Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crossDissolve animation not working #510

Open
4 of 8 tasks
xygkevin opened this issue Sep 7, 2022 · 3 comments
Open
4 of 8 tasks

crossDissolve animation not working #510

xygkevin opened this issue Sep 7, 2022 · 3 comments

Comments

@xygkevin
Copy link

xygkevin commented Sep 7, 2022

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

**SkeletonView version:1.30.2
**Xcode version:13.4.1
**Swift version:swift5

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

view.showSkeleton(transition: .crossDissolve(0.25))
view.hideSkeleton(transition: .crossDissolve(0.25))

All show or hide cross dissolve animation are not working, the same problem with the demo project

both

Expected result:

Please replace this with what you expected to happen.

Actual result:

Please replace this with of what happened instead.

Attachments:

Logs, screenshots, sample project, funny gif, etc.

@ardavydov
Copy link

Confirm, it doesn't work even in the demo project

@Serg-Pogrebnyak
Copy link

same on my end

@Serg-Pogrebnyak
Copy link

@ardavydov and @xygkevin Here is the fix for hiding:
in CALayer extension find next function:
func setOpacity(from: Int, to: Int, duration: TimeInterval, completion: (() -> Void)?)
and change it code on the next:

DispatchQueue.main.async { [weak self] in
    guard let strongSelf = self else { return }
    CATransaction.begin ()
    let animation = CABasicAnimation (keyPath: #keyPath (CALayer.opacity))
    animation.fromValue = from
    animation.toValue = to
    animation.duration = duration
    animation.timingFunction = CAMediaTimingFunction (name:
    CAMediaTimingFunctionName.easeInEaseOut)
    animation.fillMode = .forwards
    animation.isRemovedOnCompletion = false
    CATransaction.setCompletionBlock(completion)
    strongSelf.add(animation, forKey: "setOpacityAnimation")
    CATransaction.commit ()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants