Permalink
Browse files

fix flickering

  • Loading branch information...
lkzhao committed Jun 6, 2018
1 parent 0918c28 commit f4dab9ed2ab88ae065605199d5aca7706b07c2ad
Showing with 1 addition and 0 deletions.
  1. +1 −0 Sources/Animator/HeroCoreAnimationViewContext.swift
@@ -40,6 +40,7 @@ extension CALayer {
let copiedAnim = anim.copy() as! CAAnimation
copiedAnim.delegate = nil // having delegate resulted some weird animation behavior
CALayer.heroAddedAnimations!.append((self, forKey!, copiedAnim))
hero_add(anim: anim, forKey: forKey)
} else {
hero_add(anim: anim, forKey: forKey)
}

1 comment on commit f4dab9e

@happiness9721

This comment has been minimized.

Show comment
Hide comment
@happiness9721

happiness9721 Jul 27, 2018

how about merge line 43 and 45, the full function will be looks like:

@objc dynamic func hero_add(anim: CAAnimation, forKey: String?) {
  if CALayer.heroAddedAnimations != nil {
    let copiedAnim = anim.copy() as! CAAnimation
    copiedAnim.delegate = nil // having delegate resulted some weird animation behavior
    CALayer.heroAddedAnimations!.append((self, forKey!, copiedAnim))
  }
  hero_add(anim: anim, forKey: forKey)
}

happiness9721 commented on f4dab9e Jul 27, 2018

how about merge line 43 and 45, the full function will be looks like:

@objc dynamic func hero_add(anim: CAAnimation, forKey: String?) {
  if CALayer.heroAddedAnimations != nil {
    let copiedAnim = anim.copy() as! CAAnimation
    copiedAnim.delegate = nil // having delegate resulted some weird animation behavior
    CALayer.heroAddedAnimations!.append((self, forKey!, copiedAnim))
  }
  hero_add(anim: anim, forKey: forKey)
}
Please sign in to comment.