HeyLuckyGirl
2015-06-21 20:23
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<canvas id="canvas" width="1024" height="768" style="border:1px solid #aaa;display:block;margin:50px auto;"></canvas>
<script>
windows.onload=function(){
var canvas=document.getElementById("canvas");
var context = canvas.getContext("2d");
//使用context绘制
context.moveTo(100,100);
context.lineTo(700,700);
context.stroke();
}
</script>
</body>
</html>
windows.onload=function(){
这里多一个s,应该是window.onload,粗心大意,搞的我看了半天没错,测试了才知道
炫丽的倒计时效果Canvas绘图与动画基础
96746 学习 · 1000 问题
相似问题