generated at
JavaScript:Canvas API


script.js
// 表示領域を作る const editor = document.getElementById('editor'); editor.insertAdjacentHTML('beforeend',` <canvas id="canvas" style="width:600px;height:500px;" > </canvas> `); const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = 'green'; ctx.fillRect(10, 10, 150, 100);

js-script-button(実行ボタン)

JavaScript


MDN