Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up Javascript & iframe viewer tests
- Loading branch information
Showing
4 changed files
with
147 additions
and
82 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Apparatus Viewer Test</title> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
|
||
<h1>Adding up odd numbers</h1> What happens when you add up a bunch of odd numbers in a | ||
row? | ||
<div> | ||
<iframe src='/?load=viewer-test/sum-of-odds.json | ||
&fullScreen=1 | ||
&viewOnly=1 | ||
&editLink=1 | ||
&regionOfInterest={"x":[-0.5, 7.5],"y": [-1.5, 7.5]}' | ||
width="300" height="300" style="border: none"> | ||
</iframe> | ||
</div> | ||
<title>Proofs by picture</title> | ||
<link href="bootstrap.min.css" rel="stylesheet"> | ||
<style type="text/css"> | ||
body { | ||
margin-top: 100px; | ||
margin-bottom: 300px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="row"><div class="col-md-6 col-md-offset-3"> | ||
<h1>Proofs by picture</h1> | ||
|
||
<h1>Circles and sinusoids</h1> What happens when you make clocks really thin? | ||
<div> | ||
<iframe src='/?load=viewer-test/circles.json | ||
&fullScreen=1 | ||
&viewOnly=1 | ||
&editLink=1 | ||
&regionOfInterest={"x":[-1, 6.4],"y":[-1.1, 2.2]}' | ||
width="400" height="250" style="border: none"> | ||
</iframe> | ||
</div> | ||
<h3>Adding up odd numbers</h3> | ||
|
||
<p>What happens when you add up a bunch of odd numbers in a row, like 1 + | ||
3 + 5 + 7? | ||
|
||
<div> | ||
<iframe src='../?load=viewer-test/sum-of-odds.json&fullScreen=1&viewOnly=1&editLink=1&regionOfInterest={"x":[-0.5, 7.5],"y": [-1.5, 7.5]}' | ||
width="300" height="300" style="border: none"> | ||
</iframe> | ||
</div> | ||
|
||
<p>What a nifty way to make my favorite square number, 16! | ||
|
||
</body> | ||
<p>This diagram shows that the sum of the first <i>n</i> odd | ||
numbers is always a square number – each odd number fits perfectly onto | ||
the last square number, to make the next square number. | ||
|
||
<p>Or, in symbols, | ||
<blockquote><i>n</i><sup>2</sup> + (2<i>n</i> + 1) = (<i>n</i> + 1)<sup>2</sup></blockquote> | ||
|
||
<p>Which do you find more convincing, the diagram, or the symbols? (Or | ||
the diagram <i>plus</i> the symbols?) | ||
|
||
<h3>Circles and sinusoids</h3> | ||
|
||
<p>Here's something strange: a row of clocks with the hand going around: | ||
12pm, 3pm, 6pm, 9pm. As we increase the number of circles, we'll have | ||
the hand go around slower, and squeeze the circles horizontally so they | ||
fit. See what happens: | ||
|
||
<div> | ||
<iframe src='../?load=viewer-test/circles.json&fullScreen=1&viewOnly=1&editLink=1&regionOfInterest={"x":[-1, 6.4],"y":[-1.1, 2.2]}' | ||
width="400" height="250" style="border: none"> | ||
</iframe> | ||
</div> | ||
|
||
<p>By the time we get to 25 circles or so, a curve is forming. It's | ||
called a <i>sine curve</i>. A sine curve tracks the vertical (or | ||
horizontal) position of something moving around a circle, like our clock | ||
hand. | ||
</div></div> | ||
</div> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Proofs by picture</title> | ||
<link href="bootstrap.min.css" rel="stylesheet"> | ||
<style type="text/css"> | ||
body { | ||
margin-top: 100px; | ||
margin-bottom: 300px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<script src="../dist/apparatus-viewer.js"></script> | ||
<div class="container"> | ||
<div class="row"><div class="col-md-6 col-md-offset-3"> | ||
<h1>Proofs by picture</h1> | ||
|
||
<h3>Adding up odd numbers</h3> | ||
|
||
<p>What happens when you add up a bunch of odd numbers in a row, like 1 + | ||
3 + 5 + 7? | ||
|
||
<div id="diagram-sum-of-odds" style="width: 300px; height: 300px;"></div> | ||
|
||
<p>What a nifty way to make my favorite square number, <span id="N-squared"></span>! | ||
|
||
<p>This diagram shows that the sum of the first <i>n</i> odd | ||
numbers is always a square number – each odd number fits perfectly onto | ||
the last square number, to make the next square number. | ||
|
||
<p>Or, in symbols, | ||
<blockquote><i>n</i><sup>2</sup> + (2<i>n</i> + 1) = (<i>n</i> + 1)<sup>2</sup></blockquote> | ||
|
||
<p>Which do you find more convincing, the diagram, or the symbols? (Or | ||
the diagram <i>plus</i> the symbols?) | ||
|
||
<script> | ||
new ApparatusViewer({ | ||
url: "sum-of-odds.json", | ||
selector: "#diagram-sum-of-odds", | ||
regionOfInterest: { | ||
x: [-0.5, 7.5], | ||
y: [-1.5, 7.5] | ||
}, | ||
onRender: function() { | ||
var N = this.getAttributeByLabel("N").value(); | ||
document.getElementById("N-squared").innerHTML = N * N; | ||
}, | ||
}); | ||
</script> | ||
|
||
<h3>Circles and sinusoids</h3> | ||
|
||
<p>Here's something strange: a row of clocks with the hand going around: | ||
12pm, 3pm, 6pm, 9pm. As we increase the number of circles, we'll have | ||
the hand go around slower, and squeeze the circles horizontally so they | ||
fit. See what happens: | ||
|
||
<div id="diagram-circles" style="width: 400px; height: 250px;"></div> | ||
|
||
<p>By the time we get to <a href="#" id="click-for-25">25 circles</a> or | ||
so, a curve is forming. It's called a <i>sine curve</i>. A sine curve | ||
tracks the vertical (or horizontal) position of something moving around | ||
a circle, like our clock hand. | ||
|
||
<script> | ||
var circles = new ApparatusViewer({ | ||
url: "circles.json", | ||
selector: "#diagram-circles", | ||
regionOfInterest: { | ||
x: [-1, 6.4], | ||
y: [-1.1, 2.2] | ||
} | ||
}); | ||
document.getElementById("click-for-25").onclick = function() { | ||
circles.getAttributeByLabel("value").setExpression(25); | ||
return false; | ||
}; | ||
</script> | ||
</div></div> | ||
</div> | ||
</body> | ||
</html> |