Skip to content

Commit 79cecc9

Browse files
committed
Clean Up
1 parent a45e926 commit 79cecc9

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Sources/CodeEditTextView/TextLine/LineFragmentView.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,28 @@ open class LineFragmentView: NSView {
3535
}
3636

3737
#if DEBUG_LINE_INVALIDATION
38-
/// Setup background animation from random color to clear
38+
/// Setup background animation from random color to clear when this fragment is invalidated.
3939
private func setupBackgroundAnimation() {
40-
// Ensure the view is layer-backed for animation
4140
self.wantsLayer = true
4241

43-
// Generate random color
4442
let randomColor = NSColor(
4543
red: CGFloat.random(in: 0...1),
4644
green: CGFloat.random(in: 0...1),
4745
blue: CGFloat.random(in: 0...1),
48-
alpha: 0.3 // Start with some transparency
46+
alpha: 0.3
4947
)
5048

51-
// Set initial background color
5249
self.layer?.backgroundColor = randomColor.cgColor
5350

54-
// Create animation from random color to clear
5551
let animation = CABasicAnimation(keyPath: "backgroundColor")
5652
animation.fromValue = randomColor.cgColor
5753
animation.toValue = NSColor.clear.cgColor
5854
animation.duration = 1.0
5955
animation.timingFunction = CAMediaTimingFunction(name: .easeOut)
6056
animation.fillMode = .forwards
6157
animation.isRemovedOnCompletion = false
62-
63-
// Apply animation
6458
self.layer?.add(animation, forKey: "backgroundColorAnimation")
6559

66-
// Set final state
6760
DispatchQueue.main.asyncAfter(deadline: .now() + animation.duration) {
6861
self.layer?.backgroundColor = NSColor.clear.cgColor
6962
}

0 commit comments

Comments
 (0)