xxxxxxxxxx
38
let x=[200,200]
let a=[200,200]
let t=0
let s=0
let v=0
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
s+=t
line(a[0]+s*cos(v),a[1]+s*sin(v),a[0]+cos(v)*(25+s),a[1]+sin(v)*(25+s))
circle(x[0],x[1],50)
}
function mousePressed(){
t=!t
}
class arrow{
constructor(){
this.x=[]
this.v=[]
this.t=[]
}
add(v){
this.x.push(x)
this.v.push(v)
this.t.push(0)
}
update(){
for(let i=0;i<this.x.length;i++){
this.x[0]+=25*cos(this.v)
this.x[1]+=25*sin(this.v)
if(dis(this.x[i]
line(this.x[0],this.x[1],this.x[0]+100*cos(this.v),this.x[1]+100*sin(this.v))
}
}
}