Skip to content

Instantly share code, notes, and snippets.

@dupuyjs
Last active August 29, 2020 16:06
Show Gist options
  • Save dupuyjs/6f00e63fff5468ba1b04 to your computer and use it in GitHub Desktop.
Save dupuyjs/6f00e63fff5468ba1b04 to your computer and use it in GitHub Desktop.
Visual Layer - KeyFrame Animations
#region KeyFrame Animations
ScalarKeyFrameAnimation keyframeAnimation = _compositor.CreateScalarKeyFrameAnimation();
keyframeAnimation.InsertKeyFrame(0.0f, 0.0f); // Optional
keyframeAnimation.InsertKeyFrame(1.0f, 360.0f, _compositor.CreateLinearEasingFunction());
keyframeAnimation.Duration = TimeSpan.FromSeconds(3);
keyframeAnimation.IterationBehavior = AnimationIterationBehavior.Forever;
foreground.CenterPoint = new Vector3(150.0f, 150.0f, 0.0f);
foreground.StartAnimation("RotationAngleInDegrees", keyframeAnimation);
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment