html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<html>
<head></head>
<body>
<canvas id="canvas1" width="400" height="300">
</canvas>
<script>var canvas=document.getElementById("canvas1");
var ctx=canvas.getContext("2d");
var xpos=0;
var ypos=0;
function draw(){
ctx.fillStyle ="rgba(0, 360, 0, 1)";
ctx.fillRect (xpos,ypos, 22, 22);
function func(){
ctx.fillStyle ="rgba(0,300,0)"
}
}
function func(){
ctx.clearRect(0,0,canvas.height,canvas.weight)
draw();
xpos+=0;
ypos+=30;
}
</script>
<button onclick="func()">up!</button>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
*{background-color:black;}
Enter to Rename, Shift+Enter to Preview
js
js
1
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run