Skip to content

Commit

Permalink
Merge pull request #202 from ikesyo/isRemovedOnCompletion-and-fillMode
Browse files Browse the repository at this point in the history
Use `isRemovedOnCompletion = false` and `fillMode = kCAFillModeForwards` for `.left` and `.right` types
  • Loading branch information
cbpowell committed Dec 2, 2017
2 parents 47c5c9a + 659aeeb commit f854be8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/Swift/MarqueeLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,7 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
FadeStep(timeStep: -0.2, edgeFades: [.leading, .trailing]), // Maintain fade state until 0.2 sec before reaching away position
ScrollStep(timeStep: animationDuration, timingFunction: animationCurve, // Away position, using animationCurve transition, with only leading edge faded in
position: .away, edgeFades: .leading),
ScrollStep(timeStep: 60*60*24*365.0, // "Delay" at away, for huge time to effectie stay at away permanently
position: .away, edgeFades: .leading),
ScrollStep(timeStep: animationDelay, position: .away, edgeFades: .leading), // "Delay" at away, maintaining fade state
]
}
}
Expand Down Expand Up @@ -876,6 +875,11 @@ open class MarqueeLabel: UILabel, CAAnimationDelegate {
// Perform scroll animation
scroller.anim.setValue(true, forKey: MarqueeKeys.CompletionClosure.rawValue)
scroller.anim.delegate = self
if type == .left || type == .right {
// Make it stay at away permanently
scroller.anim.isRemovedOnCompletion = false
scroller.anim.fillMode = kCAFillModeForwards
}
sublabel.layer.add(scroller.anim, forKey: "position")

CATransaction.commit()
Expand Down

0 comments on commit f854be8

Please sign in to comment.