Last active
August 29, 2015 14:19
-
-
Save karlosos/b0194fc87aeec9b9a1d9 to your computer and use it in GitHub Desktop.
HTML_Lab13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>私もチェック</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
</head> | |
<body onload="draw();"> | |
<script> | |
function draw() { | |
var canvas = document.getElementById('canvas'); | |
var context = canvas.getContext('2d'); | |
context.rotate(Math.PI / -4); | |
x = -75; | |
y = 0 | |
for (j = 0; j < 3; j++) { | |
for (i = 0; i < 6; i++) { | |
var r = Math.floor((Math.random() * 255) + 1); | |
var g = Math.floor((Math.random() * 255) + 1); | |
var b = Math.floor((Math.random() * 255) + 1); | |
var rgb = "rgb(" + r + "," + g + "," + b + ")"; | |
context.fillStyle = rgb; | |
context.fillRect(x, y, 50, 50); | |
x += 55; | |
} | |
j == 0 ? x = -100 : x = -150; | |
y += 55; | |
} | |
} | |
</script> | |
<canvas width="400" height="400" id="canvas"> | |
悲しい少年たち2001 | |
</canvas> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>悲しいです</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script type="text/javascript"> | |
function draw() | |
{ | |
var canvas = document.getElementById('can'); | |
var context = canvas.getContext('2d'); | |
x = [350, 430, 520]; | |
y = [340, 220, 340]; | |
colors = ["red", "green", "blue"] | |
for (i = 0; i < 3; i++) { | |
context.beginPath(); | |
context.arc(x[i], y[i], 120, 10, 0, true); | |
context.shadowOffsetX = 15; | |
context.shadowOffsetY = 15; | |
context.shadowBlur = 9; | |
context.shadowColor = 'rgb(100, 100, 100)'; | |
context.globalAlpha = 0.5; | |
context.closePath(); | |
context.lineWidth = 35; | |
context.fillStyle = colors[i]; | |
context.fill(); | |
} | |
} | |
</script> | |
</head> | |
<body onload="draw();"> | |
<canvas id="can" width="3000" height="3000"> | |
</canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment