本文整理汇总了C#中Visual.ConnectAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Visual.ConnectAnimation方法的具体用法?C# Visual.ConnectAnimation怎么用?C# Visual.ConnectAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visual
的用法示例。
在下文中一共展示了Visual.ConnectAnimation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnimateOpacity
// Creates and defines Expression Animation to modify target object's property by referencing another Visual's property
private void AnimateOpacity(Visual sourceVisual, Visual targetVisual)
{
// Reference the Opacity property of another Composition Visual in the expression
var expression = _compositor.CreateExpressionAnimation("source.Opacity");
expression.SetReferenceParameter("source", sourceVisual);
targetVisual.ConnectAnimation("Opacity", expression).Start();
}
示例2: Parallax_Animation
// Creates and Defines Expression Animation for basic Parallax principle
private void Parallax_Animation(Visual foreground, Visual background)
{
var animation = _compositor.CreateExpressionAnimation("background.Offset.x * (foreground.Size.X / background.Size.X)");
animation.SetReferenceParameter("foreground", foreground);
animation.SetReferenceParameter("background", background);
background.ConnectAnimation("Offset.x", animation).Start();
}
示例3: AnimateFromCurrentByValue
// Creates and defines the Keyframe animation using a current value of target Visual and animating by a value
private void AnimateFromCurrentByValue(Visual targetVisual, Vector3 delta)
{
var animation = _compositor.CreateVector3KeyFrameAnimation();
// Utilize a current value of the target visual in Expression KeyFrame and modify by a value
animation.InsertExpressionKeyFrame(1.00f, "this.StartingValue + delta");
// Define the value variable
animation.SetVector3Parameter("delta", delta);
animation.Duration = TimeSpan.FromMilliseconds(1000);
targetVisual.ConnectAnimation("Offset", animation).Start();
}
示例4: AnimateFromCurrentValue
// Creates and defines the Keyframe animation using a current value of target Visual
private void AnimateFromCurrentValue(Visual targetVisual, Vector3 finalOffset)
{
var animation = _compositor.CreateVector3KeyFrameAnimation();
// Utilize a current value of the target visual in Expression KeyFrame
// Note: If a keyframe at 0.0f not defined, we will auto define it using this.StartingValue.
animation.InsertExpressionKeyFrame(0.00f, "this.StartingValue");
animation.InsertKeyFrame(1.00f, finalOffset);
animation.Duration = TimeSpan.FromMilliseconds(3000);
targetVisual.ConnectAnimation("Offset", animation).Start();
}