diff --git a/projects/projectile/index.html b/projects/projectile/index.html
index 07e03ef..3b70817 100644
--- a/projects/projectile/index.html
+++ b/projects/projectile/index.html
@@ -2,35 +2,35 @@
diff --git a/projects/projectile/index.js b/projects/projectile/index.js
index 1c408c0..fad3410 100644
--- a/projects/projectile/index.js
+++ b/projects/projectile/index.js
@@ -47,11 +47,7 @@ let projectile= function (p){
return -g * t + vy0
}
- p.v0_redraw=function(vx0,vy0){
- p.draw(p.createVector(vx0,vy0))
- }
-
- let draw_vectors=function(x,y,newV0,skiparrow=false){
+ let draw_vectors=function(x,y,skiparrow=false){
p.push()
p.stroke(199, 141, 107)
@@ -60,25 +56,21 @@ let projectile= function (p){
p.stroke(200)
draw_arrow(p,x0,height-y0,x,y,r,c,skiparrow)
+
p.stroke(121, 199, 107)
- draw_arrow(p,x0,height-y0,x0,height-y0-50,vj,c,skiparrow,true)
+ draw_arrow(p,app.x0,height-app.y0,app.x0,height-app.y0-50,vj,c,skiparrow,true)
p.stroke(199,119,107)
- draw_arrow(p,x0,height-y0,x0+50,height-y0,vi,c,skiparrow)
-
+ draw_arrow(p,app.x0,height-app.y0,app.x0+50,height-app.y0,vi,c,skiparrow)
+
p.stroke(181, 107, 199)
- if(newV0==null){
- draw_arrow(p,x0,height-y0,x0+vx0,height-(y0+vy0),vy0t,c,skiparrow)
- }
- else{
- draw_arrow(p,x0,height-y0,x0+newV0.x,height-(y0+newV0.y),vy0t,c,skiparrow)
- }
+ draw_arrow(p,app.x0,height-app.y0,app.x0+app.vx0,height-(app.y0+app.vy0),vy0t,c,skiparrow)
p.pop()
}
- p.draw = function(newV0=null) {
+ p.draw = function() {
p.clear()
let x=xt(t)
let y=yt(t)
@@ -93,11 +85,11 @@ let projectile= function (p){
p.pop()
// Draw vectors
- draw_vectors(x,y,newV0=newV0)
+ draw_vectors(x,y)
p.push()
p.stroke(0)
- p.ellipse(x0,height-y0,8)
+ p.ellipse(app.x0,height-app.y0,8)
p.pop()
// Check simulation state and update it
@@ -120,11 +112,11 @@ let projectile= function (p){
refresh=function(){
t=0
- x0=parseFloat(app.x0)
- y0=parseFloat(app.y0)
- vx0=parseFloat(app.vx0)
- vy0=parseFloat(app.vy0)
- g=parseFloat(app.g)
+ x0=app.x0
+ y0=app.y0
+ vx0=app.vx0
+ vy0=app.vy0
+ g=app.g
p5Load()
}
@@ -141,11 +133,7 @@ project_init=function(){
g:g
},
methods:{
- v0_redraw:function(){
- if(p5_instance.end){
- p5_instance.v0_redraw(parseFloat(app.vx0),parseFloat(app.vy0))
- }
- }
+ origin_redraw:function(){p5_instance.draw()}
}
})
p5Load()