public void DoAnimation(bool isPress) { // Check the state if (isPress && _mState == SimpleTextState.Pressed) { return; } if (!isPress && _mState == SimpleTextState.Idle) { return; } // Set the state _mState = isPress ? SimpleTextState.Pressed : SimpleTextState.Idle; // Animate, the animate out duration is a bit longer to give the user more time to see it _mColorAnimation.To = isPress ? _mAccentColor : _mNormalTextColor; _mColorAnimation.From = isPress ? _mNormalTextColor : _mAccentColor; _mColorStoryboard.Duration = isPress ? _mAnimateInDuration : _mAnimateOutDuration; _mColorAnimation.Duration = isPress ? _mAnimateInDuration : _mAnimateOutDuration; _mColorStoryboard.Begin(); }
public void DoAnimation(bool isPress) { // Check the state if(isPress && m_state == SimpleTextState.Pressed) { return; } if(!isPress && m_state == SimpleTextState.Idle) { return; } // Set the state m_state = isPress ? SimpleTextState.Pressed : SimpleTextState.Idle; // Animate, the animate out duration is a bit longer to give the user more time to see it m_colorAnimation.To = isPress ? m_accentColor : m_normalTextColor; m_colorAnimation.From = isPress ? m_normalTextColor : m_accentColor; m_colorStoryboard.Duration = isPress ? m_animateInDuration : m_animateOutDuration; m_colorAnimation.Duration = isPress ? m_animateInDuration : m_animateOutDuration; m_colorStoryboard.Begin(); }