From f36f132e42a8ae63d2b1d1d2d52c18fab08fdc68 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 3 Oct 2021 21:34:25 +0200 Subject: Update --- projects/projectile/index.html | 38 +++++++++++++++++++++++++++++- projects/projectile/index.js | 53 +++++++++++++++++++++++++++++++----------- 2 files changed, 76 insertions(+), 15 deletions(-) (limited to 'projects') diff --git a/projects/projectile/index.html b/projects/projectile/index.html index 63d2a68..455b6b6 100644 --- a/projects/projectile/index.html +++ b/projects/projectile/index.html @@ -1 +1,37 @@ -BLABLABLABL +
+
+
+
\(x_0\)
+ +
\(m\)
+
+
+
+
+
\(y_0\)
+ +
\(m\)
+
+
+
+
+
\(v_0\)
+ +
\(m.s\)
+
+
+
+
+
\(g\)
+ +
\(m.s^{-2}\)
+
+
+
+ +
+
+


+ +

Projectile Motion

+\[ \int_{0}^{10} \frac{56}{875} \] diff --git a/projects/projectile/index.js b/projects/projectile/index.js index 4226da5..b279eff 100644 --- a/projects/projectile/index.js +++ b/projects/projectile/index.js @@ -1,19 +1,20 @@ +let t=0; +let v0=50 +let x0=0 +let y0=50 +let g=9.81 let projectile= function (node){ node.setup = function() { node.createCanvas(width, height); }; + let width=800 + let height=300 + - let t=0; - let v0=50 - let x0=1 - let y0=50 - let g=9.81 - let width=800 - let height=200 let dots=[] function x(t) { return x0+v0*t @@ -25,16 +26,40 @@ let projectile= function (node){ node.draw = function() { node.background(50); - dots.forEach((elt)=>{node.ellipse(elt[0],elt[1],4,4);}) + node.noStroke(); + dots.forEach((elt)=>{node.ellipse(elt[0],elt[1],5,5);}) node.ellipse(x(t),y(t),20,20); dots.push([x(t),y(t)]) - if(t>10){ + if(t>50 || y(t)>height){ node.noLoop() } - t+=0.07 + t+=0.06 }; - - node.a=function(){ - node.remove() - } }; + +refresh=function(){ + t=0 + x0=parseFloat(app.x0) + y0=parseFloat(app.y0) + v0=parseFloat(app.v0) + g=parseFloat(app.g) + console.log(app.x0) + p5Load() +} + + + +project_init=function(){ + app = new Vue({ + el: '#app', + data :{ + x0:x0, + y0:y0, + v0:v0, + g:g + } + }) + p5Load() + +} + -- cgit v1.2.3