예제 #1
0
        void SetDisplay(Vector3D position, Rotation3D rotation, Vector3D scale, bool always)
        {
            if (Model != null)
            {
                ContentAnimator.SetPosition(Model, Position, position, always);
                ContentAnimator.SetScale(Model, Scale, scale, position, always);
                ContentAnimator.SetRotation(Model, Rotation, rotation, position, always);
            }

            Position = position;
            Rotation = rotation;
            Scale    = scale;
        }
 public static void SetRotation(ModelVisual3D model, Rotation3D oldRotation, Rotation3D newRotation, Vector3D center, bool always)
 {
     if (always || !RotationEquals(newRotation, oldRotation))
     {
         if (AnimationDuration.TimeSpan == TimeSpan.Zero)
         {
             ContentAnimator.AddTransformation(model, new RotateTransform3D(newRotation));
         }
         else
         {
             AnimateRotation(model, oldRotation, newRotation, center);
         }
     }
 }
 public static void SetScale(ModelVisual3D model, Vector3D oldScale, Vector3D newScale, Vector3D center, bool always)
 {
     if (always || newScale != oldScale)
     {
         if (AnimationDuration.TimeSpan == TimeSpan.Zero)
         {
             ContentAnimator.AddTransformation(model, new ScaleTransform3D(newScale));
         }
         else
         {
             AnimateScale(model, oldScale, newScale, center);
         }
     }
 }
 public static void SetPosition(ModelVisual3D model, Vector3D oldPosition, Vector3D newPosition, bool always)
 {
     if (always || newPosition != oldPosition)
     {
         if (AnimationDuration.TimeSpan == TimeSpan.Zero)
         {
             ContentAnimator.AddTransformation(model, new TranslateTransform3D(newPosition));
         }
         else
         {
             AnimatePosition(model, oldPosition, newPosition);
         }
     }
 }