let my={} function init(){let version='0.82' my.mode=getJSQueryVar('mode','rect') let w=300 let h=300 my.imgHome=(document.domain=='localhost'?'/mathsisfun':'')+'/images/' let s='' s+='
' s+='' s+='
center
' s+='' s+='
' s+=playHTML(40) s+='
' s+=wrap({cls:'copyrt',pos:'abs',style:'left:5px; bottom:3px'},`© 2022 Rod Pierce v${version}`) s+='
' docInsert(s) my.can=new Can('canvasId',w,h,2) this.midX=140 this.midY=140 this.scale=0.044 this.radius=110 this.frame=0 my.pts1=[new Point(120,50),new Point(-40,50),new Point(-40,-20),new Point(120,-20)] my.pts2=[new Point(90,80),new Point(10,50),new Point(60,20)] my.pts=my.pts1 my.ptsNo=0 this.playQ=false playToggle()} function animate(){this.frame=++this.frame%800 if(my.mode=='rect')doFrameRect(this.frame) if(this.playQ)requestAnimationFrame(animate)} function doFrameRect(frame){my.can.clear() let g=my.can.g g.fillStyle='#bbb' g.beginPath() g.arc(this.midX,this.midY,4,0,2*Math.PI) g.fill() rotShape(0.02) drawShape(frame) if(frame>=200&&frame<500){drawCirc(1)} if(frame>=500){drawCirc(my.pts.length)} if(frame==0){my.ptsNo=++my.ptsNo%2 switch(my.ptsNo){case 0:my.pts=my.pts1 break case 1:my.pts=my.pts2 break default:}}} function drawShape(){let g=my.can.g g.strokeStyle='blue' g.fillStyle='rgba(255,255,0,0.07)' g.lineWidth=1 g.beginPath() for(let i=0,len=my.pts.length;i{if(cls.length==0)cls='btn' return '