LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Saturday, February 22, 2020

canvasで四角形を描く






コード.gs
function doGet() {
  return HtmlService.createHtmlOutputFromFile("index");
}
意訳
この機能がやること
指定したHTMLファイルを表示する




index.html
<!DOCTYPE html>
<html>
<body>
  <canvas id="myCanvas" width="360" height="360"></canvas>
<script>
  createRect();
  function createRect() { 
    var canvas = document.getElementById("myCanvas");
    var context = canvas.getContext("2d");
    var x = 100;
    var y = 100;
    var width = 200;
    var height = 200;
    context.strokeStyle = "blue";
    context.lineWidth = 10;
    context.strokeRect(x, y, width, height);
  }
</script>
</body>
</html>



Latest post

Extracting data from Google Sheets with regular expressions

Introduction Regular expressions are a powerful tool that can be used to extract data from text.  In Google Sheets, regular expressions ca...