Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry-osin/1aede4066f1d656ad75a76267cd9dcd9 to your computer and use it in GitHub Desktop.
Save dmitry-osin/1aede4066f1d656ad75a76267cd9dcd9 to your computer and use it in GitHub Desktop.
private void PowerCircleAnimation(double soundLevel)
{
WavesStoryboard.Stop();
_maxSoundLevel = Math.Max(soundLevel, 1d);
var radiusCoeff = _maxSoundLevel == 0.0f ? 0.0f : soundLevel/_maxSoundLevel;
var radius = _minRadius + (_maxRadius - _minRadius)*Math.Min(radiusCoeff, 1d);
var width = WavesStoryboard.Children[0] as DoubleAnimationUsingKeyFrames;
if (width != null)
{
width.KeyFrames[1].Value = radius*2;
width.KeyFrames[1].KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(600));
}
var height = WavesStoryboard.Children[1] as DoubleAnimationUsingKeyFrames;
if (height != null)
{
height.KeyFrames[1].Value = radius;
height.KeyFrames[1].KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(600));
}
Debug.WriteLine("Power circle animation begin");
WavesStoryboard.Begin();
Debug.WriteLine("Power circle animation stop");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment