Skip to content

Instantly share code, notes, and snippets.

@stepheneb
Created February 1, 2013 20:49
Show Gist options
  • Save stepheneb/4694048 to your computer and use it in GitHub Desktop.
Save stepheneb/4694048 to your computer and use it in GitHub Desktop.
{
"_id": "b229ef970ce534606077f75aff98da06",
"_rev": "1-669014407423f970899ccf7ae8154dfa",
"about": "[\"Gases have no definite shape or volume. When they are constrained to a container, we can measure the pressure they exert on the container walls.\", \"The model shows the inside (yellow atoms) and outside (pink atoms) of a balloon. The green barrier represents the wall of the balloon.\", \"Add atoms to the balloon (the number of atoms in the balloon is shown on the slider). What happens to the balloon wall when atoms are added?\"]",
"components": [
{
"id": "show-velocity",
"property": "showVelocityVectors",
"text": "Show Velocity",
"type": "checkbox"
},
{
"action": [
"var elemNum = 3;",
"var obsX = getObstacleProperties(0).x;",
"var atomSigma = getElementProperties(elemNum).sigma;",
"var avgVx = 0;",
"var avgVy = 0;",
"var atomNum = getNumberOfAtoms();",
"for (var i = 0; i < atomNum; i++) {",
" avgVx += Math.abs(getAtomProperties(i).vx);",
" avgVy += Math.abs(getAtomProperties(i).vy);",
"}",
"avgVx /= atomNum;",
"avgVy /= atomNum;",
"addAtom({ element: elemNum, x: (obsX - atomSigma) * Math.random() , y: get('height') * Math.random(), vx: avgVx, vy: avgVy});"
],
"id": "add-atom",
"text": "Add an Atom to the Balloon",
"type": "button"
},
{
"action": [
"var atomNum = getNumberOfAtoms();",
"var obsx = getObstacleProperties(0).x;",
"if (atomNum > 0) {",
" for (var i = 0; i < atomNum; i++) {",
" if (getAtomProperties(i).x < obsx) {",
" removeAtom(i);",
" break;",
" }",
" }",
"}"
],
"id": "remove-atom",
"text": "Remove an Atom From the Balloon",
"type": "button"
}
],
"created_at": "2013-02-01T20:47:34.054Z",
"from_import": true,
"group_key": null,
"layout": {
"bottom": [
[
"add-atom",
"remove-atom",
"show-velocity"
]
]
},
"md2d_ids": [
"page2$0"
],
"parent_doc_revision": null,
"path": "interactives/sam/gas-laws/2-what-is-pressure.json",
"publicationStatus": "public",
"subtitle": "Explore how gas exerts pressure on the sides of a container.",
"title": "What is Pressure?",
"type": "Interactive",
"updated_at": "2013-02-01T20:47:34.054Z"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment