32 lines
704 B
HTML
32 lines
704 B
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<title>Physics - Prototyping</title>
|
||
|
<link rel="stylesheet" href="./main.css">
|
||
|
<script src="./draw.js"></script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<script>
|
||
|
const d = new Drawing();
|
||
|
console.log('drawing', d);
|
||
|
d.setOffset([50, 50]);
|
||
|
d.setStroke('black', 4);
|
||
|
d.polyline([0, 100], [0, 0], [100, 0]);
|
||
|
d.definePoint('p1', () => d.oscillatingPoint([75, 125], [125, 125], 5000));
|
||
|
d.setStroke('red', 2);
|
||
|
d.line([0, 0], 'p1');
|
||
|
d.setFill('blue');
|
||
|
d.definePoint('p2', () => {
|
||
|
const [x, y] = d.getPoint('p1');
|
||
|
return [x, y - 25];
|
||
|
});
|
||
|
d.square('p2');
|
||
|
d.setFill('cyan');
|
||
|
d.circle('p1');
|
||
|
d.start();
|
||
|
</script>
|
||
|
</body>
|
||
|
|
||
|
</html>
|