Update
This commit is contained in:
parent
f36f132e42
commit
eb92a8ef2a
3 changed files with 50 additions and 7 deletions
|
@ -1,14 +1,17 @@
|
|||
|
||||
let t=0;
|
||||
let v0=50
|
||||
let x0=0
|
||||
let x0=50
|
||||
let y0=50
|
||||
let g=9.81
|
||||
|
||||
let projectile= function (node){
|
||||
|
||||
node.setup = function() {
|
||||
node.createCanvas(width, height);
|
||||
c=node.createCanvas(width, height);
|
||||
v0t=node.createElement('p', '');
|
||||
katex.render("v_0", v0t.elt);
|
||||
v0t.elt.style.color="#b4b4b4"
|
||||
};
|
||||
let width=800
|
||||
let height=300
|
||||
|
@ -25,16 +28,29 @@ let projectile= function (node){
|
|||
}
|
||||
|
||||
node.draw = function() {
|
||||
node.background(50);
|
||||
node.background(70);
|
||||
node.noStroke();
|
||||
dots.forEach((elt)=>{node.ellipse(elt[0],elt[1],5,5);})
|
||||
node.fill(255)
|
||||
node.ellipse(x(t),y(t),20,20);
|
||||
node.fill(255)
|
||||
dots.push([x(t),y(t)])
|
||||
if(t>50 || y(t)>height){
|
||||
node.noLoop()
|
||||
}
|
||||
t+=0.06
|
||||
t+=0.05
|
||||
node.push()
|
||||
node.fill(22)
|
||||
node.stroke(180)
|
||||
m=draw_arrow(node,x0,height-y0,x0+v0,height-y0-v0)
|
||||
console.log(m.y)
|
||||
v0t.position(c.position().x+m.x,c.position().y+m.y)
|
||||
node.pop()
|
||||
};
|
||||
node.windowResized = function(){
|
||||
v0t.position(c.position().x+m.x,c.position().y+m.y)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
refresh=function(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue