physics/test.html

30 lines
714 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();
d.setStroke('black', 4);
d.polyline([0, 100], [0, 0], [100, 0]);
d.definePoint('p1', () => d.oscillatingPoint([25, 50], [100, 100], 5000));
d.setStroke('red', 2);
d.line([0, 0], 'p1');
d.definePoint('p2', () => {
const [x, y] = d.getPoint('p1');
return [x, y - d.oscillatingValue(10, 40, 5000 / 3, Math.PI / 2)];
});
d.setFill('blue');
d.square('p2', {trace: {age: 5000}});
d.setFill('cyan');
d.circle('p1');
d.start();
</script>
</body>
</html>