Make all examples resize to the size of the browser window.

This commit is contained in:
Jonathan Puckey 2011-05-05 16:25:17 +01:00
parent b2e2dd8888
commit 077dc58222
34 changed files with 76 additions and 49 deletions

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -69,5 +70,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -10,12 +11,12 @@
// http://processing.org/learning/topics/flocking.html
// Resize the document, whenever the window is resized,
window.onresize = function(event) {
document.size = Element.getScrollBounds().size;
size = document.size;
heartPath.position = document.bounds.center;
document.redraw();
}
Event.add(window, {
resize: function(event) {
size = document.size;
heartPath.position = document.bounds.center;
}
});
document.currentStyle = {
strokeColor: 'white',
@ -263,9 +264,6 @@
mouseDown = false,
boids = [];
// Call to resize the document to the current window size:
window.onresize();
// Add the boids:
for (var i = 0; i < 30; i++) {
var position = Point.random() * document.size;
@ -296,11 +294,9 @@
<style>
body {
background: black;
margin: 0;
overflow: hidden;
}
</style>
</head>
<body>
<canvas id='canvas'></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -67,5 +68,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -43,5 +44,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -52,5 +53,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -31,7 +32,6 @@
path.smooth();
var placedSymbol = new PlacedSymbol(path);
placedSymbol.position = center;
//placedSymbol.bounds.center = center;
layer.appendBottom(placedSymbol);
}
@ -47,5 +47,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -46,5 +47,5 @@
</script>
</head>
<body style='background-color:black'>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -95,5 +96,5 @@
</head>
<body>
<p>Click to add circles:</p>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -31,10 +32,6 @@
path.smooth();
}
function onMouseDrag(event) {
onMouseMove(event);
}
function onMouseDown(event) {
path.selected = true;
}
@ -45,5 +42,5 @@
</script>
</head>
<body style='background-color: black'>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -42,5 +43,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -26,5 +27,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -14,5 +15,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -28,5 +29,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -11,5 +12,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -20,5 +21,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -24,5 +25,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -91,5 +92,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -41,5 +42,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -78,5 +79,5 @@
Click and drag to add a points.<br/>
Drag segment handles and points to manipulate them.
Close the path to start a new one.
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -29,5 +30,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -22,5 +23,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -67,5 +68,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -77,5 +78,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -39,5 +40,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -112,5 +113,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -39,5 +40,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -77,5 +78,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -25,5 +26,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/javascript" src="http://www.raymondhill.net/voronoi/rhill-voronoi-core-min.js"></script>
@ -623,5 +624,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -43,5 +44,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

View file

@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Example</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript">var root = '../../'</script>
<script type="text/javascript" src="../../src/load.js"></script>
<script type="text/paperscript" canvas="canvas">
@ -80,5 +81,5 @@
</script>
</head>
<body>
<canvas id='canvas' width=1024 height=768></canvas>
<canvas id='canvas' resize='true'></canvas>
</body>

4
examples/css/style.css Normal file
View file

@ -0,0 +1,4 @@
body {
margin: 0;
overflow: hidden;
}