Skip to content

Commit

Permalink
Update Speed 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakr233 committed Aug 13, 2024
1 parent 6f2223c commit e35ee81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ extension AnimatedMulticolorGradientView {
var inplaceEdit = colorElements[idx]
defer { colorElements[idx] = inplaceEdit }

if inplaceEdit.transitionProgress.context.currentPos < 1 {
if speed <= 0 {
inplaceEdit.transitionProgress.setCurrent(1)
} else if inplaceEdit.transitionProgress.context.currentPos < 1 {
inplaceEdit.transitionProgress.update(withDeltaTime: deltaTime * transitionSpeed)
}
if moveDelta > 0 {
Expand Down
3 changes: 3 additions & 0 deletions Sources/ColorfulX/AnimatedMulticolorGradientView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ open class AnimatedMulticolorGradientView: MulticolorGradientView {
if colors.isEmpty { colors.append(.init(v: .zero, space: .rgb)) }
colors = colors.map { $0.color(in: .lab) }

var interpolationEnabled = interpolationEnabled
if speed <= 0 { interpolationEnabled = false }

let endingIndex = repeatToFillColorSlots ? Uniforms.COLOR_SLOT : min(colors.count, Uniforms.COLOR_SLOT)
guard endingIndex > 0 else { return }
for idx in 0 ..< endingIndex {
Expand Down

0 comments on commit e35ee81

Please sign in to comment.