本文整理汇总了C#中System.Windows.Media.Media3D.DiffuseMaterial.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# DiffuseMaterial.BeginAnimation方法的具体用法?C# DiffuseMaterial.BeginAnimation怎么用?C# DiffuseMaterial.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.DiffuseMaterial
的用法示例。
在下文中一共展示了DiffuseMaterial.BeginAnimation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
/// <summary>
/// Add a 3D model to the instance
/// </summary>
private void Init()
{
MeshGeometry3D m1 = (MeshGeometry3D)Core.Instance.Models["Road"];
SolidColorBrush b = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0));
DiffuseMaterial material = new DiffuseMaterial(b);
GeometryModel3D model1 = new GeometryModel3D(m1, material);
Model3DGroup group = new Model3DGroup();
group.Children.Add(model1);
this.Content = group;
ScaleTransform3D scale = new ScaleTransform3D();
TranslateTransform3D move = new TranslateTransform3D();
TranslateTransform3D move2 = new TranslateTransform3D();
AxisAngleRotation3D rotate = new AxisAngleRotation3D();
AxisAngleRotation3D rotate2 = new AxisAngleRotation3D();
Transform3DGroup t = new Transform3DGroup();
double angle = 0;
switch (_Location.Direction)
{
case ESideDirection.SlopeDown: angle = 60; break;
case ESideDirection.UpDown: angle = 0; break;
case ESideDirection.SlopeUp: angle = -60; break;
}
scale.ScaleZ = 1.2;
scale.ScaleX = 3;
move.OffsetX = _Point.X;
move.OffsetZ = _Point.Y;
move.OffsetY = 0.5;
rotate.Axis = new Vector3D(0, 1, 0);
rotate.Angle = angle;
t.Children.Add(scale);
t.Children.Add(new RotateTransform3D(rotate));
t.Children.Add(move);
t.Children.Add(_Scale);
ColorAnimation da = new ColorAnimation(Color.FromArgb(255, 255, 255, 0), Color.FromArgb(150, 255, 255, 0), new Duration(new TimeSpan(0, 0, 1)));
da.RepeatBehavior = RepeatBehavior.Forever;
da.AutoReverse = true;
material.BeginAnimation(DiffuseMaterial.ColorProperty, da);
this.Transform = t;
}