This one is a simple and handy trick when you want to copy your directories without node_modules folder.
Enter this command in your terminal.
robocopy SOURCE DEST /mir /xd node_modules
constrain() { | |
if (this.pos.x > CANVAS_WIDTH - this.radius) { | |
this.pos.x = CANVAS_WIDTH - this.radius; | |
} | |
if (this.pos.x < this.radius) { | |
this.pos.x = this.radius; | |
} | |
if (this.pos.y > CANVAS_HEIGHT - this.radius) { | |
this.pos.y = CANVAS_HEIGHT - this.radius; | |
} |
render() { | |
ctx.beginPath(); | |
ctx.fillStyle = this.color; | |
ctx.arc(this.pos.x, this.pos.y, this.radius, 0, Math.PI * 2); | |
ctx.fill(); | |
ctx.closePath(); | |
} |
update() { | |
let vel = Vector.sub(this.pos, this.oldpos); | |
vel.mult(this.friction); | |
// if the point touches the ground set groundFriction | |
if (this.pos.y >= CANVAS_HEIGHT - this.radius && vel.magSq() > 0.000001) { | |
var m = vel.mag(); | |
vel.x /= m; | |
vel.y /= m; | |
vel.mult(m * this.groundFriction); |
class Dot { | |
constructor(x, y) { | |
this.pos = new Vector(x, y); | |
this.oldpos = new Vector(x, y); | |
this.friction = 0.97; | |
this.groundFriction = 0.7; | |
this.gravity = new Vector(0, 1); |
// Happy Holi 2019 | |
// BY ANURAG HAZRA | |
{{{{}}}} {{{{}}}} {{{{}}}}{{{{}}}} {{{{}}}}{{{{}}}}{{{{}}}} {{{{}}}}{{{{}}}}{{{{}}}} {{{{}}}} {{{{}}}} | |
{{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} | |
{{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} | |
{{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}}{{{{}}}} | |
{{{{}}}}{{{{}}}}{{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} | |
{{{{}}}}{{{{}}}}{{{{}}}} {{{{}}}} {{{{}}}}{{{{}}}} {{{{}}}} {{{{}}}}{{{{}}}}{{{{}}}} {{{{}}}}{{{{}}}}{{{{}}}} {{{{}}}} | |
{{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} {{{{}}}} |
Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.
// Calling a variable inside of a function | |
// like a global variable but without polluting the global scope. | |
// main function | |
function setup() { | |
console.log(ADD); | |
console.log(SUB); | |
console.log(sum(100,50)) | |
} | |
// init the variables in another function (you can hide the function in an external js file) |
<canvas id="canvas"></canvas> |