Click here to Skip to main content
15,665,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have many Double Animation in a StoryBoard & all work on the same time duration but appart from the rotation transfrom for the model which should be in unision with the othe axis moves. This is the code I am using the Rotation but it seems to wait till all the other moves are finished then jumps (i.e. not at a duration) to the end angle. I have been trying everything for weeks but no soultion. Thanks in advance.

I can add X,Y & Z to Storyboard (Via Double Animation) and they all work in unison i.e. all at the same time (Exactly what I need) but the C axis (i.e. rotation is not moving in sync (i.e at the end of the other & not smooth - More of a jump to end)

I think its the Property path don't know whats best to change it to or how find out the properties at all.

Snippet explaination:-
C_Axis_Move is the Rotation
Z_Tran is the Axis move (There would be more but they are just duplicate of whats here.
Sim_Dur is the duration for all moves to be done in.

What I have tried:

'C axis
           Dim C_Rot As RotateTransform3D = New RotateTransform3D
           C_Rot.CenterX = 0
           C_Rot.CenterY = 0
           C_Rot.CenterZ = 0
           Dim myAxisAngleRotation3dC As AxisAngleRotation3D = New AxisAngleRotation3D
           myAxisAngleRotation3dC.Axis = New Vector3D(0, 0, 1)
           myAxisAngleRotation3dC.Angle = C
           C_Rot.Rotation = myAxisAngleRotation3dC

           If LastC <> C Then
               element.RegisterName("rotationC", myAxisAngleRotation3dC)

               Dim C_Axis_Move As DoubleAnimation = New DoubleAnimation()
               C_Axis_Move.Name = "C"
               C_Axis_Move.From = LastC
               C_Axis_Move.To = C
               C_Axis_Move.Duration = New Duration(TimeSpan.FromSeconds(10)) 'Sim_Dur +

               Storyboard.SetTargetProperty(C_Axis_Move, New PropertyPath("Angle"))
               Storyboard.SetTargetName(C_Axis_Move, "rotationC")

           End If

           '******************* Z
           If Machine_Tool_Axis.Contains("Z") Then
               element.RegisterName("TranslateZ", Tran)
               Dim Z_Tran As DoubleAnimation = New DoubleAnimation()
               Z_Tran.Name = "Z_T"
               Z_Tran.From = Last_Point.Z
               Z_Tran.To = Next_Point.Z
               Z_Tran.Duration = Sim_Dur

               Storyboard.SetTargetProperty(Z_Tran, New PropertyPath("OffsetZ"))
               Storyboard.SetTargetName(Z_Tran, "TranslateZ")

           End If
Updated 24-Mar-23 6:04am
Ralf Meier 21-Mar-23 9:22am    
I'm sorry ... but for me this code-snippet isn't useful for having any idea about your problem ...
Knight school 26-Mar-23 6:19am    
I have update the Code but its difficault to break down to manageable size. I have managed to get a work around. I split the rotation & move into smaller pieces which can be animated in order. There for the user does not see the snapping. Not Ideal but work for now.

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