<!DOCTYPE html> | |
<html> | |
<style> | |
html, body { margin: 0; padding: 0; } | |
</style> | |
<body> | |
<canvas id ="canvas" width="400" height="400" style="position:relative;"></canvas> | |
<script> | |
var canvas = document.getElementById('canvas'); | |
var context = canvas.getContext("2d"); | |
context.shadowBlur = 40; | |
context.shadowColor = 'red'; | |
context.shadowOffsetX = 60; | |
context.shadowOffsetY = 80; | |
context.fillRect(40, 40, 100, 100); | |
</script> | |
</body> | |
</html> |