24 lines
956 B
HTML
24 lines
956 B
HTML
<!doctype html>
|
|
<html><head><meta charset="utf-8"><title>webp alpha test</title>
|
|
<style>
|
|
body { margin:0; background:#111; font-family:monospace; color:#eee; }
|
|
.stage { display:inline-block; padding:40px; background:
|
|
conic-gradient(#777 25%, #999 0 50%, #777 0 75%, #999 0) 0 0/40px 40px; }
|
|
</style></head>
|
|
<body>
|
|
<div class="stage"><img id="p" src="planet_15fps.webp" width="400" height="311"></div>
|
|
<div id="t"></div>
|
|
<script>
|
|
const t = document.getElementById('t');
|
|
setInterval(() => {
|
|
const c = document.createElement('canvas'); c.width=448; c.height=448;
|
|
const ctx = c.getContext('2d');
|
|
ctx.drawImage(document.getElementById('p'), 0, 0);
|
|
// sample 4 corners + center alpha
|
|
const d = ctx.getImageData(0,0,448,448).data;
|
|
const at = (x,y) => d[(y*448+x)*4+3];
|
|
t.textContent = 'corner alpha: ' + [at(2,2),at(445,2),at(2,445),at(445,445)].join(',') + ' | center: ' + at(224,224);
|
|
}, 200);
|
|
</script>
|
|
</body></html>
|