I wrote a tutorial in your first link.
Just clean the air:
shapeCanvas.style.width = w + 'px'; shapeCanvas.style.height = h + 'px';
not worth doing. It makes no sense to customize the style, if it is just a canvas in memory, and in any case, you never want to set the style of the width and height of the canvas, it just confuses things.
What ellisbben said in a comment is pretty much what happens.
You can get around this in several hacker ways, like me. One way could be to never paint on an integer pixel. Another might be to use ctx.scale(.99,.99) before drawing anything so it always smoothes out. It is difficult to get a consistent solution here because the different implementations of anti-aliasing are different from each other.
Here are some experiments from me:
http://jsfiddle.net/KYZYT/29/
The first two are a form taken from a canvas, and also taken from PNG
The second two are the same pair, but scaled .99,.99
The latter is the real thing. It is still a bit blurry, but it looks a lot sharper than using images.
None of my experiments stop pulsation, at least at the microscopic level. I think this is just what you have to live with if you want to animate images that are perfect for a pixel into half-pixel spaces.
If you really feel that you canβt just draw perfect pixels, then your (second) best bet for consistency is probably finding a way to smooth out smoothing at all times. Making sure that you always translate to a non-integer number or scale it, are ever slightly decent candidates, but there may be others.
Honestly, itβs best not to cache these animated paths until you need performance. Attach stylized buttons and other static things that you do, but if you have animated tracks that need to move slowly and accurately and look very good, you can also stick with the true thing in my caching optimization, unless you need it too .