Music_Player3/relax.offline.mp3.music/MP/Common/Base(公用基类)/Views/MP_WaveAnimationMaskView.swift
2024-08-09 17:48:28 +08:00

50 lines
1.3 KiB
Swift

//
// MP_WaveAnimationMaskView.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/8/9.
//
import UIKit
import Lottie
class MP_WaveAnimationMaskView: UIView {
///View
private lazy var lotView:LottieAnimationView = {
//View
let json = Bundle.main.path(forResource: "Wave_Animation", ofType: "json")
let animationView:LottieAnimationView = .init(filePath: json ?? "")
//
animationView.loopMode = .loop
//
animationView.contentMode = .scaleAspectFill
animationView.backgroundColor = .clear
return animationView
}()
init(frame: CGRect, cornerRadius:CGFloat) {
super.init(frame: frame)
backgroundColor = .init(hex: "#000000", alpha: 0.6)
layer.masksToBounds = true
layer.cornerRadius = cornerRadius
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
//
func configure() {
addSubview(lotView)
lotView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.height.equalToSuperview().multipliedBy(0.35)
}
}
//
func startAnimation() {
lotView.play()
}
//
func stopAnimation() {
lotView.stop()
}
}