// // FortuneWheelModel.swift // SodaLive // // Created by klaus on 2023/12/07. // import SwiftUI struct FortuneWheelModel { let titles: [String] let size: CGFloat let onSpinEnd: ((Int) -> ())? let colors: [Color] let pointerColor: Color let strokeWidth: CGFloat let strokeColor: Color let animDuration: Double let animation: Animation let getWheelItemIndex: (() -> (Int))? public init( titles: [String], size: CGFloat, onSpinEnd: ((Int) -> ())?, colors: [Color]? = nil, pointerColor: Color = .red, strokeWidth: CGFloat = 5, strokeColor: Color = .white, animDuration: Double = Double(2), animation: Animation? = nil, getWheelItemIndex: (() -> (Int))? = nil ) { self.titles = titles self.size = size self.onSpinEnd = onSpinEnd self.colors = colors ?? [ Color(hex: "#D73535"), Color(hex: "#FF5151"), Color(hex: "#FF7C32"), Color(hex: "#FFAF13"), Color(hex: "#FFC658"), Color(hex: "#8BDA70"), Color(hex: "#06AB97"), Color(hex: "#12AAFF"), Color(hex: "#0052B3"), Color(hex: "#7444FF"), ] self.pointerColor = pointerColor self.strokeWidth = strokeWidth self.strokeColor = strokeColor self.animDuration = animDuration self.animation = animation ?? Animation.timingCurve(0.51, 0.97, 0.56, 0.99, duration: animDuration) self.getWheelItemIndex = getWheelItemIndex } }