This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //global variable as gravity force | |
| var force = 1; | |
| //Biggest possible PVector that fits in the canvas | |
| var maxDir = PVector.sub (new PVector (0, 0), new PVector (width-1, height-1)); | |
| //Magnitude of that vector | |
| var maxMag = maxDir.mag(); | |
| //defining the properties of the flower |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var G = 1; | |
| //mover function containing properties of the circles | |
| var Mover = function(m, x, y) { | |
| this.mass = m; | |
| this.position = new PVector(x, y); | |
| this.velocity = new PVector(0, 0); | |
| this.acceleration = new PVector(0, 0); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var G = 1; | |
| //mover function containing properties of the circles | |
| var Mover = function(m, x, y) { | |
| this.mass = m; | |
| this.position = new PVector(x, y); | |
| this.velocity = new PVector(0, 0); | |
| this.acceleration = new PVector(0, 0); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //function containing properties of the attractor | |
| var Attractor = function() { | |
| this.position = new PVector(width/2, height/2); | |
| this.mass = 20; | |
| this.G = 1; | |
| }; | |
| Attractor.prototype.calculateAttraction = function(m) { | |
| //direction of the force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //function containing properties of the liquid | |
| var Liquid = function(x, y, w, h, c) { | |
| this.x = x; | |
| this.y = y; | |
| this.w = w; | |
| this.h = h; | |
| this.c = c; | |
| }; | |
| //checking if the liquid contains the logs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //declaring properties of the Skateboard | |
| var Skateboard = function(x, m) { | |
| this.mass = m; | |
| this.position = new PVector(x, 0); | |
| this.velocity = new PVector(0, 0); | |
| this.acceleration = new PVector(0, 0); | |
| this.width = this.mass*16; | |
| this.height = this.mass*16*2; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //function declaring properties of balls | |
| var Ball = function(m, x, y) { | |
| this.mass = m; | |
| this.position = new PVector(x, y); | |
| this.velocity = new PVector(0, 0); | |
| this.acceleration = new PVector(0, 0); | |
| this.color = color(random(255), random(255), random(255), 127); | |
| }; | |
| //applying the forces to change acceleration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //function declaring original properties of the balloon | |
| var Balloon = function() { | |
| this.mass = 1; | |
| this.height = 100; | |
| this.width = 70; | |
| this.position = new PVector(width/2, height-this.height/2-10); | |
| this.velocity = new PVector(0, 0); | |
| this.acceleration = new PVector(0, 0); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Biggest possible PVector that fits in the canvas | |
| var maxDir = PVector.sub (new PVector (0, 0), new PVector (width-1, height-1)); | |
| //Magnitude of that vector | |
| var maxMag = maxDir.mag(); | |
| //function containing original position, velocity and acceleration | |
| var Mover = function() { | |
| this.position = new PVector(width/2, height/2); | |
| this.velocity = new PVector(0, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Biggest possible PVector that fits in the canvas | |
| var maxDir = PVector.sub (new PVector (0, 0), new PVector (width-1, height-1)); | |
| //Magnitude of that vector | |
| var maxMag = maxDir.mag(); | |
| //function containing original position, velocity and acceleration | |
| var Mover = function() { | |
| this.position = new PVector(width/2, height/2); | |
| this.velocity = new PVector(0, 0); |