Skip to content

Commit

Permalink
Add PauseRender
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakr233 committed Aug 16, 2024
1 parent d5cb915 commit bfbafcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public struct AnimatedMulticolorGradientViewRepresentable {
@Binding var transitionSpeed: Double
@Binding var frameLimit: Int
@Binding var renderScale: Double
@Binding var pauseRender: Bool

let repeatToFillColorSlots: Bool

Expand All @@ -27,6 +28,7 @@ public struct AnimatedMulticolorGradientViewRepresentable {
transitionSpeed: Binding<Double> = .constant(3.25),
frameLimit: Binding<Int> = .constant(0),
renderScale: Binding<Double> = .constant(1),
pauseRender: Binding<Bool> = .constant(false),
repeatToFillColorSlots: Bool = true
) {
_color = color
Expand All @@ -36,6 +38,7 @@ public struct AnimatedMulticolorGradientViewRepresentable {
_transitionSpeed = transitionSpeed
_frameLimit = frameLimit
_renderScale = renderScale
_pauseRender = pauseRender

self.repeatToFillColorSlots = repeatToFillColorSlots
}
Expand All @@ -53,6 +56,7 @@ public struct AnimatedMulticolorGradientViewRepresentable {
view.bias = bias
view.noise = noise
view.transitionSpeed = transitionSpeed
view.renderExecutionStatus = pauseRender ? .temporaryStopped : .normal
}
}

Expand Down
4 changes: 4 additions & 0 deletions Sources/ColorfulX/ColorfulView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public struct ColorfulView: View {
@Binding var transitionSpeed: Double
@Binding var frameLimit: Int
@Binding var renderScale: Double
@Binding var pauseRender: Bool

let repeatToFillColorSlots: Bool

Expand All @@ -27,6 +28,7 @@ public struct ColorfulView: View {
transitionSpeed: Binding<Double> = .constant(5),
frameLimit: Binding<Int> = .constant(0),
renderScale: Binding<Double> = .constant(1.0),
pauseRender: Binding<Bool> = .constant(false),
repeatToFillColorSlots: Bool = true
) {
_color = color
Expand All @@ -36,6 +38,7 @@ public struct ColorfulView: View {
_transitionSpeed = transitionSpeed
_frameLimit = frameLimit
_renderScale = renderScale
_pauseRender = pauseRender

self.repeatToFillColorSlots = repeatToFillColorSlots
}
Expand All @@ -51,6 +54,7 @@ public struct ColorfulView: View {
transitionSpeed: $transitionSpeed,
frameLimit: $frameLimit,
renderScale: $renderScale,
pauseRender: $pauseRender,
repeatToFillColorSlots: repeatToFillColorSlots
)
}
Expand Down

0 comments on commit bfbafcf

Please sign in to comment.