Make animation duration configurable.
This commit is contained in:
parent
021f4184a6
commit
de60fdfaf9
@ -84,7 +84,7 @@ import UIKit
|
||||
}
|
||||
|
||||
// show circular progress view with animation.
|
||||
showProgressWithAnimation(duration: 0.5, value: Float(graphModel?.percent ?? 0) / 100)
|
||||
showProgressWithAnimation(duration: graphModel?.duration ?? 1.0, value: Float(graphModel?.percent ?? 0) / 100)
|
||||
|
||||
// show progress percentage label.
|
||||
showProgressPercentage()
|
||||
|
||||
@ -21,6 +21,7 @@ public class CircularProgressBarModel: MoleculeModelProtocol {
|
||||
}
|
||||
public var diameter: CGFloat = 84
|
||||
public var lineWidth: CGFloat = 5
|
||||
public var duration : Double = 1.0
|
||||
public var color: Color?
|
||||
public var trackColor: Color?
|
||||
public var percent: Int?
|
||||
@ -35,6 +36,7 @@ public class CircularProgressBarModel: MoleculeModelProtocol {
|
||||
case size
|
||||
case diameter
|
||||
case lineWidth
|
||||
case duration
|
||||
case color
|
||||
case trackColor
|
||||
case percent
|
||||
@ -59,6 +61,10 @@ public class CircularProgressBarModel: MoleculeModelProtocol {
|
||||
self.lineWidth = lineWidth
|
||||
}
|
||||
|
||||
if let duration = try typeContainer.decodeIfPresent(Double.self, forKey: .duration) {
|
||||
self.duration = duration
|
||||
}
|
||||
|
||||
color = try typeContainer.decodeIfPresent(Color.self, forKey: .color)
|
||||
trackColor = try typeContainer.decodeIfPresent(Color.self, forKey: .trackColor)
|
||||
percent = try typeContainer.decodeIfPresent(Int.self, forKey: .percent)
|
||||
@ -73,6 +79,7 @@ public class CircularProgressBarModel: MoleculeModelProtocol {
|
||||
try container.encode(size, forKey: .size)
|
||||
try container.encode(diameter, forKey: .diameter)
|
||||
try container.encode(lineWidth, forKey: .lineWidth)
|
||||
try container.encode(duration, forKey: .duration)
|
||||
try container.encodeIfPresent(trackColor, forKey: .trackColor)
|
||||
try container.encodeIfPresent(color, forKey: .color)
|
||||
try container.encodeIfPresent(percent, forKey: .percent)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user