Like most people here on channel9 I watched Daniel's avalon video and thought that's pretty cool so set out to do it myself. I have watched the video over and over now and managed to get the static rectangle perfect, however when I try to animate there's
nothing happening.
I've used the following code (which is as close to the video as I can see):
<Window x:Class="AvalonApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Text="AvalonApplication1"
>
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Up="0,1,0" LookAtPoint="0,0,0" FieldOfView="45">
<PerspectiveCamera.Position>
<Point3DAnimation From="0,0,5" To="5,5,5" Duration="2" RepeatBehavior="Forever" AutoReverse="true"></Point3DAnimation>
</PerspectiveCamera.Position>
</PerspectiveCamera>
</Viewport3D.Camera>
<Viewport3D.Models>
<AmbientLight Color="White"></AmbientLight>
<GeometryModel3D>
<GeometryModel3D.Material>
<BrushMaterial Brush="Red"/>
</GeometryModel3D.Material>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="-1,1,0 1,1,0 1,-1,0 -1,-1,0"
TriangleIndices="0 1 2 0 2 3">
</MeshGeometry3D>
</GeometryModel3D.Geometry>
</GeometryModel3D>
</Viewport3D.Models>
</Viewport3D>
</Window>
Any ideas as to why this isn't working? I see the rectangle but no movement
Also, since avalon uses the XAML language, I'm guessing this could probably be ported over to asp.net webpages...so my other question is would it be possible to load Avalon into say an ActiveX control (or any other method) and create a website that would use
this technology?
-
-
If this is the Avalon video from some time ago, then it is very likely that the animation calls have changed in this build. Take a look at the Animation Overview from the online version of the WinFX SDK Documentation. I'll check the local version of the documentation that is installed with the SDK tomorrow when I get back to Ottawa, as I believe it is more extensive.
-
That's a fair possibility actually, should have thought of that!

-
I found that if you remove the duration property it works, its looks like the duration property is broken, because it does not work with anything... Even if I specificly create the duration
-
Be warned: the ability to do nested animations will likely go away in future releases of Avalon. The recommendation is to use storyboards to wire up all animations. Below is a sample of wiring up a 3D animation in XAML from the introducing Avalon article on MSDN: http://msdn.microsoft.com/Longhorn/archive/default.aspx?pull=/library/en-us/dnlong/html/avalonmarch2005ctp.asp
The sample also shows off VisualBrush, which is a pretty nifty feature...
<Window xmlns="http://schemas.microsoft.com/winfx/avalon/2005" xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005" > < Window.Storyboards> <ParallelTimeline> <SetterTimeline TargetID="myViewport3D" Path="(Viewport3D.Models).(Model3DGroup.Children)[2].(GeometryModel3D.Transform).(RotateTransform3D.Rotation).Angle"> <DoubleAnimation From="0" To="360" Duration="0:0:5" RepeatBehavior="Forever" /> </SetterTimeline> </ParallelTimeline> </ Window.Storyboards> <Grid Background="#333399"> <Grid.Resources> <MeshGeometry3D x:Key="PlaneMesh" Positions="-1 -1 -0.5 1 -1 -0.5 -1 1 -0.5 1 1 -0.5 0 0 1" Normals="-1 -1 1 1 -1 1 -1 1 1 1 1 1 0 0 1" TextureCoordinates="0 1 1 1 0 0 1 0 0.5 0.5 " TriangleIndices="0 4 2 2 4 3 4 1 3 0 1 4" /> </Grid.Resources> <Viewport3D ID="myViewport3D" ClipToBounds="true" Height="480" Width="640" Focusable="true"> <Viewport3D.Camera> <PerspectiveCamera LookAtPoint="0,0,0" Position="0,0,5.0" Up="0,1,0" NearPlaneDistance="0.25" FarPlaneDistance="20" FieldOfView="60" > </PerspectiveCamera> </Viewport3D.Camera> <Viewport3D.Models > <AmbientLight Color="#FF0F0F0F" /> <DirectionalLight Direction="1 1 -1" /> <GeometryModel3D Geometry="{PlaneMesh}" StatusOfNextUse="ChangeableReference" > <GeometryModel3D.Material> <BrushMaterial > <BrushMaterial.Brush> <VisualBrush Viewbox="0,0,100,100"> <VisualBrush.Visual> <Grid Background="green"> <StackPanel Width="200" Height="200" Background="yellow"> <Button></Button> <TextFlow>This is some text. Watch how it wraps around the 3d model.</TextFlow> </StackPanel> </Grid> </VisualBrush.Visual> </VisualBrush> </BrushMaterial.Brush> </BrushMaterial> </GeometryModel3D.Material> <GeometryModel3D.Transform > <RotateTransform3D Center="0 0 0" > <RotateTransform3D.Rotation> <Rotation3D Axis="0 1 1" Angle="40" > </Rotation3D> </RotateTransform3D.Rotation> </RotateTransform3D> </GeometryModel3D.Transform> </GeometryModel3D> </Viewport3D.Models> </Viewport3D> </Grid> </ Window >
-
awww, makes sence they just move the animation to the mesh level and not up in the camera level. Which would make more sence. but the code first posted hear does work if you rid yourself of the duration property.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.