public override void Perform() { RotateTransform3D RotateTransform3D = GetRotateTransform3DFromViewport3D(Viewport3D); switch (PropertyToAnimate) { case Properties.CenterXProperty: RotateTransform3D.BeginAnimation(RotateTransform3D.CenterXProperty, DoubleAnimation, HandoffBehavior); break; case Properties.CenterYProperty: RotateTransform3D.BeginAnimation(RotateTransform3D.CenterYProperty, DoubleAnimation, HandoffBehavior); break; case Properties.CenterZProperty: RotateTransform3D.BeginAnimation(RotateTransform3D.CenterZProperty, DoubleAnimation, HandoffBehavior); break; } }
public void Rotate(double angle) { RotateTransform3D _rotateTransform = new RotateTransform3D(); var _axisAngleRotation3D = new AxisAngleRotation3D { Axis = new Vector3D(0, 1, 0), Angle = 360 - angle }; this.DressCamera.Transform = _rotateTransform; Rotation3DAnimation _rotateAnimation = new Rotation3DAnimation(_axisAngleRotation3D, TimeSpan.FromSeconds(0)); _rotateTransform.BeginAnimation(RotateTransform3D.RotationProperty, _rotateAnimation); }
public static void AnimateRotation(ModelVisual3D model, Rotation3D oldRotation, Rotation3D newRotation, Vector3D center) { RotateTransform3D transform = new RotateTransform3D(oldRotation, center.ToPoint3D()); Rotation3DAnimation animation = new Rotation3DAnimation(oldRotation, newRotation, AnimationDuration) { AccelerationRatio = AnimationAccelerationRatio, DecelerationRatio = AnimationDecelerationRatio, FillBehavior = FillBehavior.HoldEnd }; transform.BeginAnimation(RotateTransform3D.RotationProperty, animation); AddTransformationAnimation(model, transform); }
public void startAnimation() { mydefaultAnimation.From = startRotation; mydefaultAnimation.To = endRotation; mydefaultAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(3000)); mydefaultAnimation.FillBehavior = FillBehavior.HoldEnd; baseRotateTransform3D.BeginAnimation(RotateTransform3D.RotationProperty, mydefaultAnimation); myprocTransformGroup.Children.Add(baseRotateTransform3D); topModelVisual3D.Transform = myprocTransformGroup; //Update text boxes //TransformMatrix.Text = myprocTransformGroup.Value.ToString(); //TransformMatrix.Text = baseRotateTransform3D.Value.ToString(); AxisAngleString.Text = endQuaternion.ToString(); //resulting string is (x,y,z,w) }
private Transform3D CreateAnimatedTransform1(Vector3D translate, Vector3D axis, double speed = 4) { var lightTrafo = new Transform3DGroup(); lightTrafo.Children.Add(new TranslateTransform3D(translate)); var rotateAnimation = new Rotation3DAnimation { RepeatBehavior = RepeatBehavior.Forever, By = new AxisAngleRotation3D(axis, 90), Duration = TimeSpan.FromSeconds(speed / 4), IsCumulative = true, }; var rotateTransform = new RotateTransform3D(); rotateTransform.BeginAnimation(RotateTransform3D.RotationProperty, rotateAnimation); lightTrafo.Children.Add(rotateTransform); return(lightTrafo); }