Music_Player3/Pods/JXSegmentedView/Sources/Indicator/JXSegmentedIndicatorRainbowLineView.swift
2024-06-03 09:48:39 +08:00

40 lines
1.3 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// JXSegmentedIndicatorRainbowLineView.swift
// JXSegmentedView
//
// Created by jiaxin on 2018/12/28.
// Copyright © 2018 jiaxin. All rights reserved.
//
import UIKit
/// indicatorColorindicatorColors
open class JXSegmentedIndicatorRainbowLineView: JXSegmentedIndicatorLineView {
/// itemsegmentedViewreloadData
open var indicatorColors = [UIColor]()
open override func refreshIndicatorState(model: JXSegmentedIndicatorSelectedParams) {
super.refreshIndicatorState(model: model)
backgroundColor = indicatorColors[model.currentSelectedIndex]
}
open override func contentScrollViewDidScroll(model: JXSegmentedIndicatorTransitionParams) {
super.contentScrollViewDidScroll(model: model)
guard canHandleTransition(model: model) else {
return
}
backgroundColor = JXSegmentedViewTool.interpolateColor(from: indicatorColors[model.leftIndex], to: indicatorColors[model.rightIndex], percent: model.percent)
}
open override func selectItem(model: JXSegmentedIndicatorSelectedParams) {
super.selectItem(model: model)
backgroundColor = indicatorColors[model.currentSelectedIndex]
}
}