jav ass crapped
HTML
<!DOCTYPE html>
<title>jav ass crapped</title>
<meta charset="utf-8"/>
<canvas id="canvas" width="400" height="400" oncontextmenu="return false"></canvas>
<!--
<style>
* {
cursor: none;
}
</style>
-->
<script>
Math.radians=function(degrees){
return degrees*Math.PI/180
}
Math.degrees=function(radians){
return radians*180/Math.PI
}
function randint(min,max) {
return Math.floor(Math.random()*(max-min+1))+min; //min max included (no+1 for max excl)
}
function randfloat(min,max){
return min+Math.random()*(max-min)
}
function randchoice(list){
return list[randint(0,list.length-1)]
}
function mousedownhandler(e){
console.log(e.button)
if(e.button==0){
moving=true
}
else if(e.button==2){
multdir*=-1
multing=true
}
}
function mouseuphandler(e){
if(e.button==0){
moving=false
}
else if(e.button==2){
multing=false
}
}
function mousemotionhandler(e){
rect = canvas.getBoundingClientRect()
mousex=e.clientX-rect.left
if (mousex<0) mousex=0
else if (mousex>=canvas.width) mousex=canvas.width-1
mousey=e.clientY-rect.top
if (mousey<0) mousey=0
else if (mousey>=canvas.height) mousey=canvas.height-1
//console.log(mousex,mousey)
}
function keydownhandler(e){
if ([37,38,39,40].includes(e.keyCode)) e.preventDefault() //arrows dont scroll
if (e.keyCode==80){
if (paused==true) paused=false
else paused=true
}
}
class Point{
constructor(x=0,y=0){
this.x=x
this.y=y
}
copy(){
return new Point(this.x,this.y)
}
radfrom(p2){
return Math.atan2(this.y-p2.y,this.x-p2.x)
}
distfrom(p2){
return Math.sqrt((p2.y-this.y)**2+(p2.x-this.x)**2)
}
setfrom(p2,ang,dist){
let rang
rang=Math.radians(ang)
this.x=p2.x+(Math.cos(rang)*dist)
this.y=p2.y+(Math.sin(rang)*dist)
}
}
class Waver{
constructor(min,max,angstart,angstep){
this.min=min
this.max=max
this.ang=angstart
this.angstep=angstep
this.n=this.min+(Math.abs(Math.sin(Math.radians(this.ang)))*(max-min))/1
}
tick(){
let...