コード.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>
|
参考
CanvasRenderingContext2D.strokeRect()
https://developer.mozilla.org/ja/docs/Web/API/CanvasRenderingContext2D/strokeRect
CanvasRenderingContext2D.strokeRect()
https://developer.mozilla.org/ja/docs/Web/API/CanvasRenderingContext2D/strokeRect