Skip to content

Commit

Permalink
Add the function setColors(_ preset: ColorfulPreset) to the Animate…
Browse files Browse the repository at this point in the history
…dMulticolorGradientView.
  • Loading branch information
linhey committed Aug 29, 2024
1 parent 4425033 commit 2a5f7ef
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public extension AnimatedMulticolorGradientView {
}

public extension AnimatedMulticolorGradientView {

func setColors(_ preset: ColorfulPreset, animated: Bool = true, repeats: Bool = true) {
setColors(preset.colors.map { ColorVector(ColorElement($0)) },
animated: animated,
repeats: repeats)
}

func setColors(_ colors: [ColorVector], animated: Bool = true, repeats: Bool = true) {
var colors = colors
if colors.isEmpty { colors.append(.init(v: .zero, space: .lab)) }
Expand Down

0 comments on commit 2a5f7ef

Please sign in to comment.