I just got Impact this morning, but I worked with it all day and just now realized that the clear color is not defined by the CSS background color. I altered ig.system.clear to use context.clearRect rather than fillRect with the specified clear color because I required a truly transparent canvas. The performance hit seems negligible for me, so I'm wondering if choosing fillRect over clearRect was a conscious design decision. Of course, it is my first day, so I'm not exactly tasking the browser just yet. Have any benchmarks been done out of curiosity?
1 decade ago
It was a conscious decision, yes. My goal for Impact was to make it "self contained". You shouldn't need to know CSS to change the direct appearance of the game. Also, you may have different background colors for different levels. Clearing the canvas itself with a solid color seemed like the right thing to do.
I made some tests on Mobile Safari with
fillRect - the results were the same. I haven't tested other browsers though.
Makes sense to me, especially considering different levels. My transparency use-case is probably pretty rare anyway, so I don't mind hacking directly on Impact for that one. Thanks!
Page 1 of 1