Почему не работает анимация? Пробовал все закоментированные варианты. Не чего не получилось.
import SwiftUI
struct ContentView: View {
var width = UIScreen . main . bounds . width
var height = UIScreen . main . bounds . height
var coefficientShape = UIScreen . main . bounds . width/ UIScreen . main . bounds . height
@ State var isPortrait : Bool = true
@ State var progress : Double = 0.0
@ State var temperature : Double = 0.0
var body : some View {
VStack {
Path {path in
path. move (to: CGPoint (x: isPortrait ? width ***** 0.53 : height ***** 0.52, y: isPortrait ? ( height ***** 0.25 - 0.25 ***** height ***** CGFloat (self. progress ) ***** CGFloat ( coefficientShape ) - 20) : ( width ***** (0.25 - 0.25 ***** CGFloat (self. progress ) ***** CGFloat ( coefficientShape )))))
path. addLine (to: CGPoint (x: isPortrait ? width ***** 0.57 : height ***** 0.54, y: isPortrait ? (0.25 ***** height - 0.25 ***** height ***** CGFloat (self. progress ) ***** CGFloat ( coefficientShape ) - 16) : ( width ***** (0.25 - 0.25 ***** CGFloat (self. progress ) ***** CGFloat ( coefficientShape )) + 5)))
path. addLine (to: CGPoint (x: isPortrait ? width ***** 0.57 : height ***** 0.54, y: isPortrait ? ( height ***** 0.25 - height ***** 0.25 ***** CGFloat (self. progress ) ***** CGFloat ( coefficientShape ) - 27) : ( width ***** (0.25 - 0.25 ***** CGFloat (self. progress ) ***** CGFloat ( coefficientShape )) - 5)))
path. closeSubpath ()
}
//.animation(.linear(duration: 7.0))
Slider (value: $temperature , in: -1.0 … 1.0, step: 0.1)
// .animation(.linear(duration: 5.0))
Text ("( temperature )")
}
. onChange (of: temperature , perform: { value in
self. progress = self. temperature ***** 2
}). animation (. linear (duration: 25.0))
}
}
struct ContentView_Previews: PreviewProvider {
static var previews : some View {
ContentView (progress: Double ())
}
}