logoalt Hacker News

abejfehrlast Monday at 12:33 AM1 replyview on HN

That code from your post is fairly standard image load handling, but the notable part is this line:

self.apng_supported = ctx.getImageData(0, 0, 1, 1).data[3] === 0;

Unless I'm misunderstanding, it's basically a "neat trick", like using ~~ for rounding or a fast inverse square root.

Is the intent that everyone who makes use of that trick is supposed to link back to your blog?


Replies

Sephrlast Tuesday at 5:06 AM

The notable part is the PNG file was copied exactly. He could have generated one himself.