@@ -60,7 +60,7 @@ function reset() {
6060 }
6161}
6262
63- let Liquid = function ( x , y , w , h , c ) {
63+ let Liquid = function ( x , y , w , h , c ) {
6464 this . x = x ;
6565 this . y = y ;
6666 this . w = w ;
@@ -69,7 +69,7 @@ let Liquid = function (x, y, w, h, c) {
6969} ;
7070
7171// Is the Mover in the Liquid?
72- Liquid . prototype . contains = function ( m ) {
72+ Liquid . prototype . contains = function ( m ) {
7373 let l = m . position ;
7474 return (
7575 l . x > this . x &&
@@ -80,7 +80,7 @@ Liquid.prototype.contains = function (m) {
8080} ;
8181
8282// Calculate drag force
83- Liquid . prototype . calculateDrag = function ( m ) {
83+ Liquid . prototype . calculateDrag = function ( m ) {
8484 // Magnitude is coefficient * speed squared
8585 let speed = m . velocity . mag ( ) ;
8686 let dragMagnitude = this . c * speed * speed ;
@@ -96,7 +96,7 @@ Liquid.prototype.calculateDrag = function (m) {
9696 return dragForce ;
9797} ;
9898
99- Liquid . prototype . display = function ( ) {
99+ Liquid . prototype . display = function ( ) {
100100 noStroke ( ) ;
101101 fill ( 50 ) ;
102102 rect ( this . x , this . y , this . w , this . h ) ;
@@ -111,12 +111,12 @@ function Mover(m, x, y) {
111111
112112// Newton's 2nd law: F = M * A
113113// or A = F / M
114- Mover . prototype . applyForce = function ( force ) {
114+ Mover . prototype . applyForce = function ( force ) {
115115 let f = p5 . Vector . div ( force , this . mass ) ;
116116 this . acceleration . add ( f ) ;
117117} ;
118118
119- Mover . prototype . update = function ( ) {
119+ Mover . prototype . update = function ( ) {
120120 // Velocity changes according to acceleration
121121 this . velocity . add ( this . acceleration ) ;
122122 // position changes by velocity
@@ -125,15 +125,15 @@ Mover.prototype.update = function () {
125125 this . acceleration . mult ( 0 ) ;
126126} ;
127127
128- Mover . prototype . display = function ( ) {
128+ Mover . prototype . display = function ( ) {
129129 stroke ( 0 ) ;
130130 strokeWeight ( 2 ) ;
131131 fill ( 255 , 127 ) ;
132132 ellipse ( this . position . x , this . position . y , this . mass * 16 , this . mass * 16 ) ;
133133} ;
134134
135135// Bounce off bottom of window
136- Mover . prototype . checkEdges = function ( ) {
136+ Mover . prototype . checkEdges = function ( ) {
137137 if ( this . position . y > height - this . mass * 8 ) {
138138 // A little dampening when hitting the bottom
139139 this . velocity . y *= - 0.9 ;
0 commit comments