physics/test.html

30 lines
714 B
HTML
Raw Normal View History

2024-06-20 17:18:36 -05:00
<!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]);
2024-06-21 11:17:14 -05:00
d.definePoint('p1', () => d.oscillatingPoint([25, 50], [100, 100], 5000));
2024-06-20 17:18:36 -05:00
d.setStroke('red', 2);
d.line([0, 0], 'p1');
d.definePoint('p2', () => {
const [x, y] = d.getPoint('p1');
2024-06-21 11:02:48 -05:00
return [x, y - d.oscillatingValue(10, 40, 5000 / 3, Math.PI / 2)];
2024-06-20 17:18:36 -05:00
});
2024-06-21 11:17:14 -05:00
d.setFill('blue');
d.square('p2', {trace: {age: 5000}});
2024-06-20 17:18:36 -05:00
d.setFill('cyan');
d.circle('p1');
d.start();
</script>
</body>
</html>