为了账号安全,请及时绑定邮箱和手机立即绑定

求大神找错误

<html>

<head>

<title>canvas02</title>

<script>

window.onload=function(){

var canvas=document.getElementById("canvas");

canvas.width=800;

canvas.height=800;

var context=canvas.getContext("2d");

context.lineWidth=10;

drawStar(contxet,150,300,400,400,15);

}

function drawStar(cxt,r,R,x,y,rot){

cxt.beginPath();

for(var i=0;i<5;i++){

cxt.lineTo(Math.cos((18+i*72-rot)/180*Math.PI)*R+x,

-Math.sin((18+i*72-rot)/180*Math.PI)*R+y);

cxt.lineTo(Math.cos((54+i*72-rot)/180*Math.PI)*r+x

,-Math.sin((54+i*72-rot)/180*Math.PI)*r+y);

}

cxt.closePath();

cxt.stroke();

}

</script>

</head>

<body>

<canvas id="canvas"  style="border:5px solid #ccc;margin:50px auto;display:block"></canvas>

</body>

</html>


正在回答

2 回答

http://img1.sycdn.imooc.com//57dcc28b0001ef3903970148.jpg划线的那个单词错了,应该是context

0 回复 有任何疑惑可以回复我~

这种问题自己看啊,你只有说出问题别人帮你解决,哪里会帮你看代码。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

求大神找错误

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信