Update animation.go

This commit is contained in:
Alexei Anoshenko 2024-12-06 20:00:53 +03:00
parent 5971cd9105
commit 0bdfe48f09
1 changed files with 5 additions and 3 deletions

View File

@ -319,8 +319,8 @@ func NewTransitionAnimation(timingFunc string, duration float64, delay float64)
// or alternate back and forth between playing the sequence forward and backward. Only the following values can be used: // or alternate back and forth between playing the sequence forward and backward. Only the following values can be used:
// 0 (NormalAnimation), 1 (ReverseAnimation), 2 (AlternateAnimation), and 3 (AlternateReverseAnimation); // 0 (NormalAnimation), 1 (ReverseAnimation), 2 (AlternateAnimation), and 3 (AlternateReverseAnimation);
// - iterationCount - specifies the number of times an animation sequence should be played before stopping. A negative value specifies infinite repetition; // - iterationCount - specifies the number of times an animation sequence should be played before stopping. A negative value specifies infinite repetition;
// - property - describes a scenario for changing a View's property. // - property, properties - describes a scenario for changing a View's property.
func NewAnimation(id string, timingFunc string, duration float64, delay float64, direction int, iterationCount int, property ...AnimatedProperty) AnimationProperty { func NewAnimation(id string, timingFunc string, duration float64, delay float64, direction int, iterationCount int, property AnimatedProperty, properties ...AnimatedProperty) AnimationProperty {
animation := new(animationData) animation := new(animationData)
animation.init() animation.init()
@ -353,7 +353,9 @@ func NewAnimation(id string, timingFunc string, duration float64, delay float64,
animation.Set(IterationCount, iterationCount) animation.Set(IterationCount, iterationCount)
} }
if len(property) > 0 { if len(properties) > 0 {
animation.Set(PropertyTag, append([]AnimatedProperty{property}, properties...))
} else {
animation.Set(PropertyTag, property) animation.Set(PropertyTag, property)
} }