Code:
<!DOCTYPE HTML><HTMLLang= "Utf-8"><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/><Head> <title>Pentagram</title> </Head> <Bodyonload= "Draw ()"> <CanvasID= "Mycanvus"width= "200px"Height= "200px"style= "border:0px dashed black;">the text indicates that your browser does not support HTML5</Canvas> </Body></HTML><Scripttype= "Text/javascript"><!-- functionDraw () {varCanvas=document.getElementById ("Mycanvus"); varContext=Canvas.getcontext ("2d"); Context.fillstyle= "Yellow"; Context.fillrect (0, 0, $, $); Context.strokestyle= "RGB (250,0,0)"; Context.fillstyle= "RGB (250,0,0)"Context.beginpath (); Context.moveto ( -, 0); Context.lineto ( -+Math.Cos (Math.PI*3/*100, 100+math.sin (math.pi*3/Ten)* -); Context.lineto ( --Math.Cos (Math.PI*1/*100, 100-math.sin (math.pi*1/Ten)* -); Context.lineto ( -+Math.Cos (Math.PI*1/*100, 100-math.sin (math.pi*1/Ten)* -); Context.lineto ( --Math.Cos (Math.PI*3/*100, 100+math.sin (math.pi*3/Ten)* -); Context.lineto ( -, 0); Context.fill (); Context.stroke (); Context.closepath (); }// -</Script>
HTML5 Canvas Drawing Pentagram