Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have storyboard with multiple double animations (Not all show in code to make it easier on the eye). I'm setting the duration in the double animation & have read you should also set the storyboard duration to same value to not cut short animation. The issue is even if I increase from millisecond to seconds the sim does not change speed. I can do a fine adjustment with the slider but hardly noticeable using storyboad setspeedratio (Which is if I have understood correctly an adustment to the speed ratio (Which is set to 1)).

Plus this is using Helix3d to move stl's around in 3d Space. All movements work as expected bu the timing does not seem to be controlable.

I thought I had solved this before but I think is may of been a PC restriction mimicking the slowing down (I have since changed PC to a much fast one)

VB
  'Sim_Line_Time is the length of move
  
  Dim Sim_Dur As Duration = New Duration(TimeSpan.FromSeconds(Sim_Line_Time)) 'Tried as MilliSeconds but ni change
  
      element.RegisterName("ModTranslateX", X_Mov)
    Dim MoD_X_Tran As DoubleAnimation = New DoubleAnimation()
    MoD_X_Tran.Name = "X_T"
    MoD_X_Tran.From = Last_Point.X
    MoD_X_Tran.To = Next_Point.X
    MoD_X_Tran.Duration = Sim_Durb'Tried removing this




	    '************************* X axis Move
    Storyboard.SetTargetProperty(MoD_X_Tran, New PropertyPath("OffsetX"))
    Storyboard.SetTargetName(MoD_X_Tran, "ModTranslateX")
	
	
	
	
	
	
	'StoryBoard Detail
	
            AddHandler Move.Completed, AddressOf Story_Completed

            Move.SetSpeedRatio(Speed.Value / 1000) ' Set overriding speed by Slider (0.005 to 10.1)

'Tried to add duration to Story board but no change

            Animation_Running = True

            Move.Begin(element, HandoffBehavior.SnapshotAndReplace, True)


What I have tried:

I have tried setting the duration to double animation or the storyboard or even both.
I have tried inflating the duration but no real changes.

I think I may of found a possible reason (Thanks to Gerry Schmitz indirectly point me to look else where). I think the loop for the storry board moves were (Still working on proving it) was dropping through & jumping from one move to the other & giving the impression it working.
Before:-
   Move.Begin(element, HandoffBehavior.SnapshotAndReplace, True)
Do Until Animation_Running = False 'Wait for complete (See Story_Completed Sub) Timer to complete

                DoEvents()
                Try
   

                If Move.GetCurrentState = ClockState.Active Then
                   Animation_Running = False
                End If
                Catch ex As Exception
                   
                   Animation_Running = False
                End Try

            Loop
			
			
			 Private Sub Story_Completed(ByVal sender As Object, ByVal e As EventArgs)
     Animation_Running = False
 End Sub


After:- (Not try Catch needed) (Not the elememt added to the current state which was the error being caught by the Try Catch)
Move.Begin(element, HandoffBehavior.SnapshotAndReplace, True)
           Do Until Animation_Running = False 'Wait for complete (See Story_Completed Sub) Timer to complete

               DoEvents()
                  If Move.GetCurrentState(element) = ClockState.Active Then
      Animation_Running = True
  Else
      Animation_Running = False
  End If

           Loop


            Private Sub Story_Completed(ByVal sender As Object, ByVal e As EventArgs)
    Animation_Running = False
End Sub
Posted
Updated 17-Feb-24 3:31am
v4
Comments
[no name] 16-Feb-24 11:40am    
No one can see what "values" you're actually using ... which is what it's all about. And you shouldn't be playing with the "speed ratio" until it's working "normally". There's no evidence that the points you're working with are different; or how far apart they actually are; or how much time you've allocated for the "animation"; etc. All "dependent" variables.
Knight school 16-Feb-24 11:48am    
Hi, Thanks for the quick reply
The points (lastpoint & nextpoint) have been culled for no change but the moves are very small(<0.1) to acount for 3D spiral or arc moves. If I'm understanding you on the dependances the doubleAnimation is for X,Y,Z,Rot_X,Rot_Y & Rot_Z. The duration is based on line segment length. I think this is what you are refering to but please correct me if I'm wrong.
Once aian thanks again.
[no name] 16-Feb-24 12:04pm    
(We're still at the "design" stage) If you're animating "points", and not animating the "x, y displacements" via "DoubleAnimation" (one for x, one for y), then you should be using the "PointAnimation" class. Anyway, I find "By" and "duration" more usefull when "moving"; which means calculating distance over time; e.g."move delta x over duration t; and move delta y over duration t (and possible rotate n degrees over time t ... another DoubleAnimation). By x,y I'm refering to Canvas.Left and Canvas.Top.
Knight school 17-Feb-24 4:18am    
Thanks again for the speedy reply, I have updated the question to include this is a 3D application using helix3D & is working with the exception of the duration control.
As far as I know (Still very much a novice) pointanimation is 2D.

I will see if I can break the code down more to help but its in 1000's of line (As I said novice & I'm sure it can be done in a handfull but it works at this point in time)

The points are LastPoint (XYZ) to NextPoint (XYZ) with rotation in XYZ (Something all or maybe just one).

Add more detail to the "tried" as I think you may be correct & it maybe for somewhere else & showing else where. I'm still not convinced it fixed but much better. Thanks
[no name] 17-Feb-24 13:33pm    
You can set the "target" on the "story"; but I typically set the "target property" on the animation; because that is your only option if you have multiple animations in a Storyboard. You're still not showing any "values". At 60 FPS, and dealing with "doubles of pixels", I typically use "proximity" instead of expecting all points or measurements to match exactly. And "rounding" pixels can cause oscillating (in target points) even though "whole pixels" are faster to render. I don't know what your "do while" is about, but I use a Timer thread (i.e. "monitor") to check on my running storyboards at a given interval. That, and the "completed" event for a given story, handle any "next steps" or continuations.

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