jagguy
asked on
storyboard in beta 2
q1)in silverlight beta 2 i got a solution for animation but i commented out the layout root so is this ok
Storyboard.SetTargetProper ty(xa, New PropertyPath("(Canvas.Left )"))
Storyboard.SetTarget(ya, bb)
Storyboard.SetTargetProper ty(ya, New PropertyPath("(Canvas.Top) "))
' LayoutRoot.Resources.Add(" qq", sb) 'works but maybe not correct way to go
sb.Begin() '
q2)to move an object in more than 1 direction do i need another storyboard? Say I want to move diagonal down then across and so on..in straight line motion
Dim dur As Duration = New Duration(TimeSpan.FromSeco nds(2.5))
Dim xa As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
Dim ya As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
xa.Duration = dur
xa.To = 400 ' // shrink to 0
ya.Duration = dur
ya.To = 400 ' // shrink to 0
Dim sb As Storyboard = New Storyboard
and another
xa.Duration = dur
xa.To = 600 ' // shrink to 0
ya.Duration = dur
ya.To = 0 ' // shrink to 0
Storyboard.SetTargetProper
Storyboard.SetTarget(ya, bb)
Storyboard.SetTargetProper
' LayoutRoot.Resources.Add("
sb.Begin() '
q2)to move an object in more than 1 direction do i need another storyboard? Say I want to move diagonal down then across and so on..in straight line motion
Dim dur As Duration = New Duration(TimeSpan.FromSeco
Dim xa As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
Dim ya As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
xa.Duration = dur
xa.To = 400 ' // shrink to 0
ya.Duration = dur
ya.To = 400 ' // shrink to 0
Dim sb As Storyboard = New Storyboard
and another
xa.Duration = dur
xa.To = 600 ' // shrink to 0
ya.Duration = dur
ya.To = 0 ' // shrink to 0
ASKER
I think all i need is a way to detect when a storyboard has completed the animation, so then i can run another. Is there a flag I can check?
One storyboard can have as many animations as you want to add. You could animate the Canvas.Left, Canvas.Top, and Opacity one object, and the TranslateTransform and RotateTransform of another. Once you begin the storyboard, everything will animate.
If you want to see when a storyboard is done, use the "Completed" event handler to fire a function.
If you want to see when a storyboard is done, use the "Completed" event handler to fire a function.
ASKER
OK i can get it to work for the completed event.
I can see a use for simple movements with a storyboard but not say chaotic movements like balls bouncing off each other.
q1)is there a simpler way to detect from checking a property if the storyboard has ended?Otherwise if i move an object with a few different movements it gets messy to code. I can have flags set in the completed event but it is still messy.
I can see a use for simple movements with a storyboard but not say chaotic movements like balls bouncing off each other.
q1)is there a simpler way to detect from checking a property if the storyboard has ended?Otherwise if i move an object with a few different movements it gets messy to code. I can have flags set in the completed event but it is still messy.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dim dur As Duration = New Duration(TimeSpan.FromSeco
Dim xa As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
Dim ya As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
xa.Duration = dur
xa.To = 400 ' // shrink to 0
ya.Duration = dur
ya.To = 400 ' // shrink to 0
Dim sb As Storyboard = New Storyboard
sb.Duration = dur
sb.Children.Add(xa)
sb.Children.Add(ya)
Storyboard.SetTarget(xa, bb) '; //set Animation Target
Storyboard.SetTargetProper
Storyboard.SetTarget(ya, bb)
Storyboard.SetTargetProper
' LayoutRoot.Resources.Add("
sb.Begin()
sb.Stop()
sb.Begin()
Dim xa2 As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
Dim ya2 As DoubleAnimation = New DoubleAnimation 'Animation for shrink Width
xa2.Duration = dur
xa2.To = 600 ' // shrink to 0
ya2.Duration = dur
ya2.To = 400 ' // shrink to 0
xa2.From = 400
ya2.From = 400
Storyboard.SetTarget(xa2, bb) '; //set Animation Target
Storyboard.SetTargetProper
Storyboard.SetTarget(ya2, bb)
Storyboard.SetTargetProper