Ross, I used Jose Fajardo's sprite concept from Remix to change a high cpu
repeating animation to a simple sprite (set of frames in one image,
repeating animation is just translate x).

It may not be ideal but for me it took the animation down to 1-2% cpu.

 

His blog is here, but I'm not sure if he ever posted about it:

http://www.cynergysystems.com/blogs/page/josefajardo

 

John.

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Ross Jempson
Sent: Monday, 21 September 2009 12:06 PM
To: [email protected]
Subject: animation cpu usage

 

Hi there,

 

This is an old question I posted when the list was down.

 

Does anyone have any suggestions as to how I can minimise cpu usage when
using a storyboard/animation(s) that repeat constantly.

 

To explain the scenario, I have a screen that has a background that sort of
looks like a night sky.  There are say 100 little stars (the same png
scattered around with various sizes).  I animate the opacity / ScaleX /
ScaleY of a random png every 1 second to create a twinkling effect that
keeps running the whole time you view the screen.

 

The effect is very nice, however I notice it hogs the cpu.

 

I have tried 2 implementations.  

 

In the first implementation I created a storyboard with 3 animations.  I
created a timer that fired every 1 second, and on the fly set the animations
to target one of the pngs randomly (stopping and starting the storyboard
each time).   This was consuming on average 80% of my CPU.

 

I created a second implementation to see if I could improve the situation.
In the second implementation I decided to build up the storyboard in code up
front.  I create 40 animations up front targeting random pngs, each with a
begintime 1 second later than the previous and add them all to the one
master storyboard.  I then just run that storyboard over and over.  However,
this approach made no difference to the cpu being consumed.

 

Cheers.

_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to