beforeRunningAnimation method

void beforeRunningAnimation()
inherited

Implementation

void beforeRunningAnimation() {
  for (var i = 0; i < animationName.length; i++) {
    final name = animationName[i];
    if (name == NONE) {
      return;
    }
    final fillMode = camelize(_getSingleString(animationFillMode, i));
    List<Keyframe>? keyframes = _getKeyFrames(name);
    if (keyframes == null) {
      return;
    }
    FillMode mode = FillMode.values.firstWhere((element) {
      return element.toString().split('.').last == fillMode;
    });
    Animation? animation = _runningAnimation[name];
    if (animation != null) {
      return;
    }

    if (mode == FillMode.backwards || mode == FillMode.both) {
      final styles = getAnimationInitStyle(keyframes);

      styles.forEach((property, value) {
        String? originStyle = target.inlineStyle[property];
        if (originStyle != null) {
          _cacheOriginProperties.putIfAbsent(property, () => originStyle);
        }
        target.setInlineStyle(property, value);
      });
    }
  }
  target.style.flushPendingProperties();
}