var w,h,ratio,i,s,el,g,div,dragQ,game,my={};function circlearealinesMain(mode){my.version='0.81';typ=typeof mode!=='undefined'?mode:'longitudinal';w=600;h=300;var s='';s+='
';s+='
';s+='';s+='';s+='
';s+='
';var lblStyle='display: inline-block; font:15px Arial; width: 80px; text-align: right; margin-right:10px;';var txtStyle='display: inline-block; width:50px; font: 18px Arial; color: #6600cc; text-align: left;';s+='
Lines:
' s+='';s+='
2
';s+='
';s+='
Sides:
' s+='';s+='
2
';s+='
';s+='
' s+='
';s+=getPlayHTML(36);s+='
';s+='
© 2018 MathsIsFun.com v'+my.version+'
';s+='
';document.write(s);el=document.getElementById('canvas1');ratio=2;el.width=w*ratio;el.height=h*ratio;el.style.width=w+"px";el.style.height=h+"px";g=el.getContext("2d");g.setTransform(ratio,0,0,ratio,0,0);el2=document.getElementById('canvas2');el2.width=w*ratio;el2.height=h*ratio;el2.style.width=w+"px";el2.style.height=h+"px";g2=el2.getContext("2d");g2.setTransform(ratio,0,0,ratio,0,0);dragType='';this.clrs=[["Blue",'#0000FF'],["Red",'#FF0000'],["Black",'#000000'],["Green",'#00cc00'],["Orange",'#FFA500'],["Slate Blue",'#6A5ACD'],["Lime",'#00FF00'],["Spring Green",'#00FF7F'],["Teal",'#008080'],["Gold",'#ffd700'],["Med Purple",'#aa00aa'],["Light Blue",'#ADD8E6'],["Navy",'#000080'],["Purple",'#800080'],["Dark SeaGreen",'#8FBC8F']];clrNum=0;console.log("typ",typ);my.lineN=20;document.getElementById('linen').innerHTML=my.lineN;my.segN=6;document.getElementById('seg').innerHTML=my.segN*2;my.rad=(w-20)/(2*Math.PI);my.frameNo=0;reStart();} function reStart(){my.playQ=true;anim();} function anim(){if(my.playQ){doCircle();requestAnimationFrame(anim);}} function doCircle(){g.clearRect(0,0,el.width,el.height);var ratio=(my.frameNo-20)/180;ratio=Math.min(Math.max(0,ratio),1);var midPt={x:w/2,y:h/2};for(var i=0;i220){drawTriangle(midPt);} if(my.frameNo++>400)my.frameNo=0;} function drawArc(sttPt,n,l,ratio,dir,dbg){g.moveTo(sttPt.x,sttPt.y);var currPt={x:sttPt.x,y:sttPt.y} angChg=Math.PI/n*(1-ratio);var ang=0;ang-=angChg/2;for(var i=0;i';s+='.btn {display: inline-block; position: relative; width:'+w+'px; height:'+w+'px; margin-right:'+w*0.2+'px; padding: .6em; border: 0 solid rgba(208,208,248,1); border-radius: 10em; background: linear-gradient(#fff, #ccf), #c9c5c9; box-shadow: 0 3 4 rgba(0,0,0,.4); }';s+='.btn:hover {background: linear-gradient(#f5f5f5, #b9b9b9), #c9c5c9; }';s+='.btn:before, button:after {content: " "; position: absolute; }';s+='.btn:active {top:'+w*0.05+'px; box-shadow: 0 '+w*0.02+'px '+w*0.03+'px rgba(0,0,0,.4); }';s+='.play:before { left: '+w*0.36+'px; top: '+w*0.22+'px; width: 0; height: 0; border: '+w*0.3+'px solid transparent; border-left-width: '+w*0.4+'px; border-left-color: blue; }';s+='.play:hover:before {border-left-color: yellow; }';s+='.pause:before, .pause:after {display: block; left: '+w*0.29+'px; top: '+w*0.28+'px; width: '+w*0.19+'px; height: '+w*0.47+'px; background-color: blue; }';s+='.pause:after {left: '+w*0.54+'px; }';s+='.pause:hover:before, .pause:hover:after {background-color: yellow; }';s+='';s+='';return s;} function togglePlay(){var btn='playBtn';if(my.playQ){my.playQ=false;document.getElementById(btn).classList.add("play");document.getElementById(btn).classList.remove("pause");}else{my.playQ=true;document.getElementById(btn).classList.add("pause");document.getElementById(btn).classList.remove("play");anim();} if(my.colNo