diff --git a/examples/Animated/AnimatedStar.html b/examples/Animated/AnimatedStar.html index 241dd3dc..20d21d2c 100644 --- a/examples/Animated/AnimatedStar.html +++ b/examples/Animated/AnimatedStar.html @@ -8,13 +8,12 @@ diff --git a/examples/Animated/Extruded.html b/examples/Animated/Extruded.html index d08bed4d..0e7a480d 100644 --- a/examples/Animated/Extruded.html +++ b/examples/Animated/Extruded.html @@ -35,13 +35,13 @@ var path1 = new Path(); path1.segments = segments; path1.closed = true; - path1.position = document.bounds.center; + path1.position = view.center; path1.scale(1.5); var path2 = new Path(); path2.segments = segments; path2.closed = true; - path2.position = document.bounds.center; + path2.position = view.center; path2.scale(2); var length1 = path1.length; @@ -52,10 +52,10 @@ length: 100 }); path1.rotate(-0.5); - path1.position = document.bounds.center - vector; + path1.position = view.center - vector; path2.rotate(-0.5); - path2.position = document.bounds.center + vector.normalize(50); + path2.position = view.center + vector.normalize(50); for (var i = 0; i < lineCount; i++) { var path = lineGroup.children[i]; diff --git a/examples/Animated/Flock.html b/examples/Animated/Flock.html index d898df52..26e49478 100644 --- a/examples/Animated/Flock.html +++ b/examples/Animated/Flock.html @@ -10,14 +10,6 @@ // Adapted from Flocking Processing example by Daniel Schiffman: // http://processing.org/learning/topics/flocking.html - // Reposition the heart path whenever the window is resized: - DomEvent.add(window, { - resize: function(event) { - size = document.size; - heartPath.position = document.bounds.center; - } - }); - document.currentStyle = { strokeColor: 'white', strokeWidth: 2, @@ -28,9 +20,9 @@ head.fillColor = 'white'; head.strokeColor = null; var headSymbol = new Symbol(head); - - var size = document.size; - + + var size = view.size; + var Boid = Base.extend({ initialize: function(position, maxSpeed, maxForce) { var strength = Math.random() * 0.5; @@ -254,7 +246,7 @@ [[545.6171875, 549.1171875], [17.1787109375, -30.458984375], [-13.517578125, 24.0498046875]] ]); heartPath.closed = true; - heartPath.position = document.bounds.center; + heartPath.position = view.center; heartPath.strokeColor = null; heartPath.scale(1.5); @@ -265,9 +257,9 @@ // Add the boids: for (var i = 0; i < 30; i++) { - var position = Point.random() * document.size; + var position = Point.random() * size; boids.push(new Boid(position, 10, 0.05)); - } + } function onFrame(event) { for (var i = 0, l = boids.length; i < l; i++) { @@ -279,6 +271,12 @@ } } + // Reposition the heart path whenever the window is resized: + function onResize(event) { + size = view.size; + heartPath.position = view.center; + } + function onMouseDown(event) { groupTogether = !groupTogether; } diff --git a/examples/Animated/Lines.html b/examples/Animated/Lines.html index 3c79c268..7b119bb5 100644 --- a/examples/Animated/Lines.html +++ b/examples/Animated/Lines.html @@ -15,7 +15,7 @@ path.closed = true; } - var position = document.bounds.center; + var position = view.center; var mousePos = position; var children = document.activeLayer.children; var count = 0; diff --git a/examples/Animated/RadialRainbows.html b/examples/Animated/RadialRainbows.html index c3e0feca..d9fdf0bc 100644 --- a/examples/Animated/RadialRainbows.html +++ b/examples/Animated/RadialRainbows.html @@ -7,7 +7,7 @@
diff --git a/examples/Animated/Raster.html b/examples/Animated/Raster.html index d5116d38..6335e901 100644 --- a/examples/Animated/Raster.html +++ b/examples/Animated/Raster.html @@ -10,7 +10,7 @@ // http://en.wikipedia.org/wiki/Lenna var raster = new Raster('lenna'); var lastScale = 1; - var center = document.bounds.center; + var center = view.center; function onFrame(event) { var scale = (Math.sin(event.time * 2) + 1) / 2; raster.scale(scale / lastScale); diff --git a/examples/Animated/RoundedRectangles.html b/examples/Animated/RoundedRectangles.html index 510cacba..080db39e 100644 --- a/examples/Animated/RoundedRectangles.html +++ b/examples/Animated/RoundedRectangles.html @@ -7,7 +7,7 @@ diff --git a/examples/Scripts/Arcs.html b/examples/Scripts/Arcs.html index aa5d1da4..5b3fecfc 100644 --- a/examples/Scripts/Arcs.html +++ b/examples/Scripts/Arcs.html @@ -7,7 +7,7 @@ diff --git a/examples/Scripts/RoundRectangle.html b/examples/Scripts/RoundRectangle.html index 50771d75..8eecd819 100644 --- a/examples/Scripts/RoundRectangle.html +++ b/examples/Scripts/RoundRectangle.html @@ -16,7 +16,7 @@ path.remove(); var size = Math.abs(Math.sin(event.count / 40)) * 150 + 10; path = new Path.RoundRectangle(rect, size); - path.position = document.bounds.center; + path.position = view.center; } diff --git a/examples/Tools/MetaBalls.html b/examples/Tools/MetaBalls.html index 6956ee89..179d67c8 100644 --- a/examples/Tools/MetaBalls.html +++ b/examples/Tools/MetaBalls.html @@ -17,7 +17,7 @@ var circlePaths = []; var circlePath; var radius = 50; - circlePaths.push(new Path.Circle(document.bounds.center, 100)); + circlePaths.push(new Path.Circle(view.center, 100)); function onMouseDown(event) { circlePath = null; for (var i = 0, l = circlePaths.length; i < l; i++) {