all articles

canvas will blur when draw() right after showing

2015-07-05 @sunderls

android4.1 canvas blur js

description

on follow two conditions, canvas may blur

insert a new <canvas> to dom, and draw on it right away.

show an already inserted hidden <canvas> , and draw on it right away

on Retina devices, we always use 2 times size of <canvas> to avoid blurring, but on these 2 conditions, it just doesn't work, seems <canvas> on Android may be that fast to be ready.

solution

on those special devices, use a timer to redraw .

setTimeou(function(){
    // redraw
}, 100);