@@ -178,6 +178,10 @@ class Animation {
178178 return _currentTime;
179179 }
180180
181+ double get progress {
182+ return _effect? ._progress ?? 0.0 ;
183+ }
184+
181185 set currentTime (double ? newTime) {
182186 if (newTime == null ) return ;
183187
@@ -437,7 +441,15 @@ class _Interpolation {
437441 var begin;
438442 var end;
439443 Function lerp;
440- _Interpolation (this .property, this .startOffset, this .endOffset, this .easing, this .begin, this .end, this .lerp) {
444+
445+ _Interpolation (
446+ {required this .property,
447+ required this .startOffset,
448+ required this .endOffset,
449+ required this .easing,
450+ required this .begin,
451+ required this .end,
452+ required this .lerp}) {
441453 easing ?? = Curves .linear;
442454 }
443455
@@ -456,6 +468,7 @@ class KeyframeEffect extends AnimationEffect {
456468 RenderStyle renderStyle;
457469 Element ? target;
458470 late List <_Interpolation > _interpolations;
471+ List <_Interpolation > get interpolations => _interpolations;
459472 double ? _progress;
460473 double ? _activeTime;
461474 late Map <String , List <Keyframe >> _propertySpecificKeyframeGroups;
@@ -516,13 +529,13 @@ class KeyframeEffect extends AnimationEffect {
516529 Function parseProperty = handlers[0 ];
517530
518531 _Interpolation interpolation = _Interpolation (
519- property,
520- startOffset,
521- endOffset,
522- _parseEasing (keyframes[startIndex].easing),
523- parseProperty (left, renderStyle, property),
524- parseProperty (right, renderStyle, property),
525- handlers[1 ]);
532+ property: property ,
533+ startOffset: startOffset ,
534+ endOffset: endOffset ,
535+ easing : _parseEasing (keyframes[startIndex].easing),
536+ begin : parseProperty (left, renderStyle, property),
537+ end : parseProperty (right, renderStyle, property),
538+ lerp : handlers[1 ]);
526539
527540 interpolations.add (interpolation);
528541 }
@@ -565,7 +578,6 @@ class KeyframeEffect extends AnimationEffect {
565578 if (_progress == null ) {
566579 // If fill is backwards that will be null when animation finished
567580 _propertySpecificKeyframeGroups.forEach ((String propertyName, value) {
568- renderStyle.removeAnimationProperty (propertyName);
569581 String currentValue = renderStyle.target.style.getPropertyValue (propertyName);
570582 renderStyle.target.setRenderStyle (propertyName, currentValue);
571583 });
@@ -806,6 +818,7 @@ class KeyframeEffect extends AnimationEffect {
806818
807819 // The smallest positive double value that is greater than zero.
808820 static final double _epsilon = 4.94065645841247E-324 ;
821+
809822 // Permit 2-bits of quantization error. Threshold based on experimentation
810823 // with accuracy of fmod.
811824 static final double _calculationEpsilon = 2.0 * _epsilon;
@@ -901,32 +914,39 @@ class EffectTiming {
901914 // Defaults to 0. Although this is technically optional,
902915 // keep in mind that your animation will not run if this value is 0.
903916 double ? _duration;
917+
904918 // The number of milliseconds to delay the start of the animation.
905919 // Defaults to 0.
906920 double ? _delay;
921+
907922 // The rate of the animation's change over time.
908923 // Accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out",
909924 // or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)".
910925 // Defaults to "linear".
911926 String ? _easing;
912927 Curve ? _easingCurve;
928+
913929 // Whether the animation runs forwards (normal), backwards (reverse),
914930 // switches direction after each iteration (alternate),
915931 // or runs backwards and switches direction after each iteration (alternate-reverse).
916932 // Defaults to "normal".
917933 PlaybackDirection ? _direction;
934+
918935 // The number of milliseconds to delay after the end of an animation.
919936 // This is primarily of use when sequencing animations based on the end time of another animation.
920937 // Defaults to 0.
921938 double ? _endDelay;
939+
922940 // Dictates whether the animation's effects should be reflected by the element(s) prior to playing ("backwards"),
923941 // retained after the animation has completed playing ("forwards"), or both. Defaults to "none".
924942 FillMode ? _fill;
943+
925944 // Describes at what point in the iteration the animation should start.
926945 // 0.5 would indicate starting halfway through the first iteration for example,
927946 // and with this value set, an animation with 2 iterations would end halfway through a third iteration.
928947 // Defaults to 0.0.
929948 double ? _iterationStart;
949+
930950 // The number of times the animation should repeat.
931951 // Defaults to 1, and can also take a value of Infinity to make it repeat for as long as the element exists.
932952 double ? _iterations;
0 commit comments