let my={}
function init(mode){let version='0.61'
my.type=typeof mode!=='undefined'?mode:'longitudinal'
my.wd=440
my.ht=170
let s=''
s+='
'
s+='Wave Type: '
s+=getDropdownHTML(['Longitudinal','Transverse','Both'],'typeChg','typSel')
s+='
'
s+=''
s+='Color: '
s+=getDropdownHTML(['Blue','Multi'],'clrChg','clr')
s+='
'
s+=wrap({pos:'abs',style:'top:2px; right:1px; z-index: 10;'},playHTML(36))
s+=''
s+=''
s+='
'
s+=wrap({cls:'copyrt',pos:'abs',style:'right:1px; top:'+my.ht+'px'},`© 2022 Rod Pierce v${version}`)
s=wrap({cls:'js',style:'width:'+my.wd+'px;'},s)
docInsert(s)
my.can=new Can('clock1',my.wd,my.ht,2)
my.clrs=[['Blue','#0000FF'],['Red','#FF0000'],['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'],]
my.clrNum=0
this.frame=0
my.nx=31
my.ny=6
my.gap=15
my.clrType='Blue'
ballsMake(5)
my.playQ=true
anim()}
function playHTML(w){let s=''
s+=''
s+=''
return s}
function playToggle(){let 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()}}
function ballsMake(radius){my.balls=[]
for(let i=0;i'
for(let i=0;i'+opts[i]+''}
s+=''
return s}
CanvasRenderingContext2D.prototype.ball=function(ball,x,y){let size=ball.radius
this.beginPath()
this.fillStyle=ball.color
this.arc(x,y,size,0,Math.PI*2,true)
let gradient=this.createRadialGradient(x-size/2,y-size/2,0,x,y,size)
gradient.addColorStop(0,ball.clr2)
gradient.addColorStop(1,ball.clr)
this.fillStyle=gradient
this.fill()
this.closePath()
this.beginPath()
this.arc(x,y,size*0.85,(Math.PI/180)*270,(Math.PI/180)*200,true)
gradient=this.createRadialGradient(x-size*0.99,y-size*0.99,0,x,y,size)
gradient.addColorStop(0,ball.clr2)
gradient.addColorStop(0.99,'transparent')
this.fillStyle=gradient
this.fill()}
my.theme=localStorage.getItem('theme')
my.lineClr=my.theme=='dark'?'white':'black'
my.opts={name:'user'}
function optGet(name){let val=localStorage.getItem(`mif.${name}`)
if(val==null)val=my.opts[name]
return val}
function optSet(name,val){localStorage.setItem(`mif.${name}`,val)
my.opts[name]=val}
function getJSQueryVar(varName,defaultVal){let scripts=document.getElementsByTagName('script')
let lastScript=scripts[scripts.length-1]
let scriptName=lastScript.src
let bits=scriptName.split('?')
if(bits.length<2)return defaultVal
let query=bits[1]
console.log('query: ',query)
let vars=query.split('&')
for(let i=0;i{if(cls.length==0)cls='btn'
return '