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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Add Shopping List Item</title> | |
</head> | |
<body> | |
<form> | |
<div> | |
<label for="item">Enter Item</label> | |
<input type="text" id="item" autofocus> |
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
class Firework { | |
constructor() { | |
this.color = Hsl.random(); | |
this.color.s = 100; | |
this.color.l = 70; | |
this.exploder = new Particle(width / 2, height, undefined, this.color); | |
this.target = new Vector(random(50, width - 50), random(0, 3 * height / 4)); | |
this.exploder.vel = this.exploder.loc.getForceTo(this.target, gravity); | |
this.explodeParticles = []; | |
this.nOfParticles = random(30, 40); |
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
const c = document.querySelector('#canvas'); | |
c.width = window.innerWidth; | |
c.height = window.innerHeight; | |
const w = c.width; | |
const h = c.height; | |
const ctx = c.getContext('2d'); | |
function clear(color) { | |
ctx.save(); | |
ctx.fillStyle = color || 'white'; |
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
class Firework { | |
constructor() { | |
let vel = new Vector( | |
random(0, 15) * (random(0, 1) ? -1 : 1), | |
random(-18, -10) | |
); | |
this.color = Hsl.random(); | |
this.color.s = 100; | |
this.color.l = 70; | |
this.exploder = new Particle(w / 2, h, vel, this.color); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Snow</title> | |
</head> | |
<body style="margin: 0;"> | |
<canvas id="canvas"></canvas> | |
<script type="text/javascript" src="tool.js"></script> | |
<script type="text/javascript" src="vector.js"></script> | |
<script type="text/javascript" src="snow.js"></script> |
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
class Ball { | |
constructor(x, y) { | |
this.pos = new Vector(x, y); | |
this.r = 10; | |
this.vel = new Vector(10, 3); | |
this.forces = []; | |
} | |
draw(ctx) { | |
ctx.save(); |
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
class Ball { | |
constructor(x, y, endX, endY, movingDuration) { | |
this.x = x; | |
this.y = y; | |
this.r = 10; | |
this.movingDuration = movingDuration; // millisecond | |
this.beginX = x; | |
this.beginY = y; | |
this.endX = endX; | |
this.endY = endY; |
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 Board(size) { | |
this.x = 0; | |
this.y = 0; | |
this.offset = 5; | |
this.size = size; | |
this.cells = []; | |
this.numOfCells = 10; | |
this.cellSize = this.size / this.numOfCells; | |
this.numOfBombCells = 10; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="style.css"> | |
<title>Document</title> | |
</head> | |
<body> |
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
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <memory> | |
using namespace std; | |
class TwoDidemsionObject | |
{ | |
public: virtual ~TwoDidemsionObject() {} | |
}; |
NewerOlder