Skip to main content
Participant
Dec 4, 2026 5:12 PM UTC
Question

HTML5 canvas daily game: rendering scale comparisons without distortion

Hi everyone. I have been playing a small free daily estimation game built with HTML5 canvas, and I am curious about a rendering problem I suspect other Animate and CreateJS developers have hit.

 

The game shows two objects side by side and asks the player to guess a size or weight, for example a blue whale against a school bus. The tricky part is honest scale: a whale at 30 m and a bus at 12 m should look 2.5 times longer, but on a phone canvas both need to stay readable, so the pair is scaled together against the stage width and keep a minimum on-screen size for the smaller object, with a note when the drawing is not to scale.

 

Two questions for people who have shipped canvas games:

1. For responsive stages, do you prefer scaling the whole stage with CSS, or recalculating positions on resize with stage.scaleX and scaleY? I see slight blurring with CSS scaling on high-DPI phones.

2. For touch targets on small objects, what minimum hit area do you use before players start missing taps?

 

A simplified version of the pair-scaling logic:

 

function fitPair(a, b, stageWidth) {

  var maxLen = Math.max(a.length, b.length);

  var unit = (stageWidth * 0.8) / maxLen;

  a.width = a.length * unit;

  b.width = b.length * unit;

}

 

The live game is magnitudle if anyone wants to see the current behaviour on a phone. Feedback on the scaling approach, especially from Animate HTML5 canvas exports, would be really welcome. Happy to share more of the code if useful.

 

Thanks,

 

Eliza