Hi everyone,
I have been trying to animate a 3D rotation for a  viewport3d object On one of its edges. My animation rotates the object around its centre axis but not around the desired edge. I need to do this on either sides of the object, it will rotate on a specific edge. Below is my animation. Thanks for the help.

  1. <Window x:Class="Sepis.MainWindow"  
  2.         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  4. Title="MainWindow" Height="768" MinWidth="800" Width="1000" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">  
  5. <Window.Resources>  
  6. Window.Resources>  
  7. Name="rectangle1" Width="100" Height="100" Fill="Red">  
  8. Rectangle>  
  9.   
  10.         <Viewport3D Name="BAckgroundWindow" ClipToBound  
  11.     <Grid Height="Auto" Width="1400" MinWidth="1280" Name="MainGrid" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Stretch" Opacity="1">  
  12. <Grid.ColumnDefinitions>  
  13. <ColumnDefinition Width="0*" />  
  14. <ColumnDefinition Width="1210*" />  
  15. Grid.ColumnDefinitions>  
  16. <Button Name="btnOper">  
  17. Button>  
  18. <Rectangle  
  19.  s="True" Margin="353,0,747,180" Grid.Column="1" Width="300" Height="300" HorizontalAlignment="Center" VerticalAlignment="Bottom">  
  20.   
  21. <Viewport3D.Camera>  
  22. <PerspectiveCamera UpDirection="0,1,0" Position="0,0,2" LookDirection="0,0,-1" FieldOfView="33" />  
  23. Viewport3D.Camera>  
  24.   
  25. <Viewport3D.Children>  
  26.   
  27. <GeometryModel3D.Geometry>  
  28. <MeshGeometry3D TriangleIndices="0,1,2 2,3,0 2,1,0 0,3,2" Normals="0,0,1 0,1,1 0,0,1 0,0,1" TextureCoordinates="0,1 1,1 1,0 0,0" Positions="-0.5,-0.5,0 0.5,-0.5,0 0.5,0.5,0 -0.5,0.5,0" />  
  29. GeometryModel3D.Geometry>  
  30.   
  31. <DoubleAnimation RepeatBehavior="0:0:0.5" Storyboard.TargetName="rotation3" Storyboard.TargetProperty="(AxisAngleRotation3D.Angle)" From="-85" To="0" Duration="0:0:0.5"/>  
  32. Storyboard>  
  33. BeginStoryboard>  
  34. EventTrigger>  
  35. Window.Triggers>  
  36. Window>