public void DrawAnimation(Graphics graphics) { if (_effectsManager.IsAnimating() && _animation) { graphics.SmoothingMode = SmoothingMode.AntiAlias; for (var i = 0; i < _effectsManager.GetAnimationCount(); i++) { double animationValue = _effectsManager.GetProgress(i); Point animationSource = _effectsManager.GetSource(i); using (Brush rippleBrush = new SolidBrush(Color.FromArgb((int)(101 - (animationValue * 100)), Color.Black))) { var rippleSize = (int)(animationValue * Width * 2); graphics.SetClip(ControlGraphicsPath); graphics.FillEllipse(rippleBrush, new Rectangle(animationSource.X - (rippleSize / 2), animationSource.Y - (rippleSize / 2), rippleSize, rippleSize)); } } graphics.SmoothingMode = SmoothingMode.None; } }
public void DrawAnimation(Graphics graphics) { if (_animation && _rippleEffectsManager.IsAnimating()) { for (var i = 0; i < _rippleEffectsManager.GetAnimationCount(); i++) { double animationValue = _rippleEffectsManager.GetProgress(i); Point animationSource = new Point(_box.X + (_box.Width / 2), _box.Y + (_box.Height / 2)); SolidBrush animationBrush = new SolidBrush(Color.FromArgb((int)(animationValue * 40), (bool)_rippleEffectsManager.GetData(i)[0] ? Color.Black : _checkStyle.CheckColor)); int height = _box.Height; int size = _rippleEffectsManager.GetDirection(i) == AnimationDirection.InOutIn ? (int)(height * (0.8d + (0.2d * animationValue))) : height; Rectangle _animationBox = new Rectangle(animationSource.X - (size / 2), animationSource.Y - (size / 2), size, size); GraphicsPath _path = VisualBorderRenderer.CreateBorderTypePath(_animationBox, _border); graphics.FillPath(animationBrush, _path); animationBrush.Dispose(); } } }