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.
- <Window x:Class="Sepis.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- 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">
- <Window.Resources>
- Window.Resources>
- Name="rectangle1" Width="100" Height="100" Fill="Red">
- Rectangle>
- <Viewport3D Name="BAckgroundWindow" ClipToBound
- <Grid Height="Auto" Width="1400" MinWidth="1280" Name="MainGrid" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Stretch" Opacity="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0*" />
- <ColumnDefinition Width="1210*" />
- Grid.ColumnDefinitions>
- <Button Name="btnOper">
- Button>
- <Rectangle
- s="True" Margin="353,0,747,180" Grid.Column="1" Width="300" Height="300" HorizontalAlignment="Center" VerticalAlignment="Bottom">
- <Viewport3D.Camera>
- <PerspectiveCamera UpDirection="0,1,0" Position="0,0,2" LookDirection="0,0,-1" FieldOfView="33" />
- Viewport3D.Camera>
- <Viewport3D.Children>
- <GeometryModel3D.Geometry>
- <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" />
- GeometryModel3D.Geometry>
- <DoubleAnimation RepeatBehavior="0:0:0.5" Storyboard.TargetName="rotation3" Storyboard.TargetProperty="(AxisAngleRotation3D.Angle)" From="-85" To="0" Duration="0:0:0.5"/>
- Storyboard>
- BeginStoryboard>
- EventTrigger>
- Window.Triggers>
- Window>
Replies
Know the answer? Post it — somebody with the same question will find it here.