Created
June 20, 2016 11:11
-
-
Save dmitry-osin/1aede4066f1d656ad75a76267cd9dcd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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