Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kbenson
Visitor

Re: Tips for speeding up animation speed (roImageCanvas)

So, there's a few tricks to getting multiple canvases to work right when they overlap.

First, you don't want to be altering multiple canvases in the visual stack. That is, if you have two or three canvas objects that overlap, you only want to be changing layers on the "top" one. That's because adding to a canvas and calling show() incurs the normal delay of re-compositing that canvas. If there's lots of images, or very large images, it may take a bit to update, and it's hard to determine how long. The call to .show on any canvas items "above" it need to happen after it finishes. Calling show() on a canvas item that has NOT been changed is quite quick though, somewhere between 11 and 40 ms.

Second, you need to call show() on all canvas objects that overlap, in order, on each update to the topmost canvas in that stack. As long as the lower canvas objects aren't changing, this shouldn't be too much of a problem, as caling show() on them is quite speedy.

So, it's dirty, it's a hack, it's painful to do, but if you do it right, in some circumstances you can get a fairly static update time out of canvas operations, which can't be (currently) said for a single canvas.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.