function checkAnimatedStateInitialization(node, componentAnimations) {
    const stateProperty = _getStateInitialization(node);
    if (stateProperty) {
      // If initializing state with an animation directly, record the animation
      const expression = node.value.callee;
      const isAnimation = astHelpers.isAnimationDeclaration(expression);
      if (isAnimation) {
        _updateAnimationRecord(node, stateProperty);
      } else if (node.value.type === "Identifier") {
        const allVariablesInScope = context.getScope().variables;
        // If we're setting state to a variable, check the current scope
        // to determine if that variable has been set to an animated value.
        allVariablesInScope.forEach(variable => {
          if (variable.name !== node.value.name) {
            return;
          }
          const isAnimatedState = _checkIsStateVariableAnimated(variable);
          if (isAnimatedState) {
            _updateAnimationRecord(node, stateProperty);
          }
        });
      }
    }
  }
/**
   * Check state initialization. If state is set to an animated value
   * directly we record the animation.
   */
Check state initialization. If state is set to an animated value
directly we record the animation.
Check state initialization . If state is set to an animated value directly we record the animation .
function checkAnimatedStateInitialization(node, componentAnimations) {
    const stateProperty = _getStateInitialization(node);
    if (stateProperty) {
      const expression = node.value.callee;
      const isAnimation = astHelpers.isAnimationDeclaration(expression);
      if (isAnimation) {
        _updateAnimationRecord(node, stateProperty);
      } else if (node.value.type === "Identifier") {
        const allVariablesInScope = context.getScope().variables;
        allVariablesInScope.forEach(variable => {
          if (variable.name !== node.value.name) {
            return;
          }
          const isAnimatedState = _checkIsStateVariableAnimated(variable);
          if (isAnimatedState) {
            _updateAnimationRecord(node, stateProperty);
          }
        });
      }
    }
  }
function checkAnimatedStateInitialization ( node , componentAnimations ) { const stateProperty = _getStateInitialization ( node ) ; if ( stateProperty ) { const expression = node . value . callee ; const isAnimation = astHelpers . isAnimationDeclaration ( expression ) ; if ( isAnimation ) { _updateAnimationRecord ( node , stateProperty ) ; } else if ( node . value . type === "Identifier" ) { const allVariablesInScope = context . getScope ( ) . variables ; allVariablesInScope . forEach ( variable => { if ( variable . name !== node . value . name ) { return ; } const isAnimatedState = _checkIsStateVariableAnimated ( variable ) ; if ( isAnimatedState ) { _updateAnimationRecord ( node , stateProperty ) ; } } ) ; } } }
Check state initialization.
Check state initialization .
// If initializing state with an animation directly, record the animation // If we're setting state to a variable, check the current scope // to determine if that variable has been set to an animated value.