キャンバスで遊び中 - ランダム模様
HSP でもこういうのを作ったことを記憶してます。なつかしす。
http://www.fujidig.com/misc/js/canvas/get-image-data.html
function rand256() { return Math.floor(Math.random()*256); } var canvas = document.body.appendChild(document.createElement('canvas')); canvas.width = 480; canvas.height = 480; var ctx = canvas.getContext('2d'); ctx.fillStyle = 'black'; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.globalCompositeOperation = 'lighter'; for(var i = 0; i < 600; i++ ) { ctx.fillStyle = 'rgba('+rand256()+','+rand256()+','+rand256()+',0.1)' ctx.beginPath(); ctx.arc(Math.random()*canvas.width, Math.random()*canvas.height, Math.random()*30+20, 0, Math.PI*2, true); ctx.fill(); }