Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a storyboard running a Point3DAnimation with a duration in Helix3D but it does not make any differance in the length of duration it always play the same speed (very fast). Do I need to set more in the Timelines or anything else?
VB
 Dim Last_Point As Point3D = New Point3D(0, 0, 0)
        Dim Next_Point As Point3D = New Point3D(0, 0, 10)
		
		
Dim Test As SphereVisual3D = New SphereVisual3D()
        Test.Radius = 5
        Test.Center = New Point3D(0, 0, 0)
        Test.Fill = Brushes.Red
        Test.PhiDiv = 20
        Test.ThetaDiv = 20
        Test.Material = MaterialHelper.CreateMaterial(Brushes.Transparent, Brushes.White, Brushes.Gray, 0.5, 20)
        ViewPort.Children.Add(Test)
		

 Move_Points.From = Last_Point
            Move_Points.To = Next_Point
            Move_Points.AutoReverse = False
            Move_Points.Duration = TimeSpan.FromSeconds(10)


     
            Move.Children.Add(Move_Points)
            Storyboard.SetTarget(Move_Points, Test)
            Storyboard.SetTargetProperty(Move_Points, New PropertyPath(SphereVisual3D.CenterProperty))
			
			
			
            Move.Begin()
			
			Move.Children.Remove(Move_Points)
			
			
			'Loop to next point


I would like to load an array points with there own duration as full storyboard but WPF is very new & differant. So I am very green to this & I am still having to use VB code. Maybe one step at a time.

This is my eyes should play for 10 seconds & move "Test" in Z axis 10 units. It move 10 units in Z axis but at light speed. I tried everything I can find (At least what can understand).
Thanks in advance

What I have tried:

I have tried setting ratio & tried to set the duration on the storyboard (Readonly dead end). I also added a label update to slow it down. Which worked but was irregular result (Not the correct way but was desperant) as it was just tying thing up & was intermitant. I can't over the thought this a storyboard error but I may be wrong
Posted
Updated 12-Jun-20 6:06am

1 solution

The following shows how to set the Duration to five seconds in code.

myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));

Animation Overview - WPF | Microsoft Docs[^]
 
Share this answer
 
Comments
Knight school 13-Jun-20 13:26pm    
Thanks. This solved the Time issue but the problem materailised as next move not waiting for the finish of the first/last move. I solved it with a DoEvent (or as sub dispatcher) which I think is using memory but works. The problem I have now is moving the Sphere was a test but I need to move a Modelvisual3D which was made up of a geometrymodel3D

Before I started with animation I used this to move it point to point but I can't work the code out for animation as it is for 2 differant thing.

What I used to do:-
Rev_Model_Tool1.Transform = New TranslateTransform3D(X, Y, Z)
Rev_Tool1.Content = Rev_Model_Tool1


And the DoEnvent I used to stall the next move
Do Until Move.GetCurrentTime.TotalMilliseconds >= TimeSpan.FromMilliseconds(Sim_Line_Time).TotalMilliseconds

DoEvents()
Loop

Public Sub DoEvents()
Dim frame As New DispatcherFrame()
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, New DispatcherOperationCallback(AddressOf ExitFrame), frame)
Dispatcher.PushFrame(frame)
End Sub


Can you give me any guide or direction (there is lots of rotaion example but nothing like this)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900