Answered by:
Best Animation Performance?

Question
-
For a project I am working on I have several pre-rendered PNG sequences for different animated elements. Currently I am using setInterval to callback on functions to flip through the images to simulate animation. Is there a higher performance way of doing this in JavaScript Silverlight?
Monday, December 3, 2007 11:49 AM
Answers
-
Got it, so in your JS you add events/handlers like this:
sender.findname(
"intervalReplacementStoryboard").addEventListener("Completed", Silverlight.createDelegate(this, this.callbackmethod));And you can then also use the removeEventListener to remove a handler, so this should allow you to implement what you're looking for.
=> Dave
Monday, December 3, 2007 2:47 PM
All replies
-
I think there is a general concencus that creating a empty Storyboard with a set duration, then handling the "complete" event is more efficient that using SetInterval ... Is there no way you can just create a storyboards that shows/hides these in sequence? Perhaps setting the Opacity?
=> Dave
Monday, December 3, 2007 12:24 PM -
Is it possible to change the Completed parameter dynamically? I need to have a given "interval" call back on different methods.
Monday, December 3, 2007 1:32 PM -
Not really sure what you are asking ... you can dynamically change the duration of the Storyboard and then retrieve it in the completed event if that helps?
=> Dave
Monday, December 3, 2007 1:39 PM -
I would like to dynamically set the callback method in a manner similar to setInterval( whateverMethod, 1000 )
Im not sure what the correct syntax would be but something like;sender.findName(
"intervalReplacementStoryboard")["Storyboard.Completed"] = "callbackMethod";Monday, December 3, 2007 1:58 PM -
Got it, so in your JS you add events/handlers like this:
sender.findname(
"intervalReplacementStoryboard").addEventListener("Completed", Silverlight.createDelegate(this, this.callbackmethod));And you can then also use the removeEventListener to remove a handler, so this should allow you to implement what you're looking for.
=> Dave
Monday, December 3, 2007 2:47 PM