From d8f54b1c9b6539ed993aead2cb2dea50f72d14f4 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Thu, 30 Jun 2011 13:55:35 +0200 Subject: [PATCH 1/2] Add FutureSplash example. --- examples/Animated/FutureSplash.html | 143 ++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 examples/Animated/FutureSplash.html diff --git a/examples/Animated/FutureSplash.html b/examples/Animated/FutureSplash.html new file mode 100644 index 00000000..71993618 --- /dev/null +++ b/examples/Animated/FutureSplash.html @@ -0,0 +1,143 @@ + + + + + Example + + + + + + + + \ No newline at end of file From 7ee7895d57dd1c3091280edda85db31147c8cb90 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Thu, 30 Jun 2011 14:01:18 +0200 Subject: [PATCH 2/2] Clean up Future Splash example a bit. --- examples/Animated/FutureSplash.html | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/Animated/FutureSplash.html b/examples/Animated/FutureSplash.html index 71993618..ba3c47c8 100644 --- a/examples/Animated/FutureSplash.html +++ b/examples/Animated/FutureSplash.html @@ -31,7 +31,7 @@ this.strength = param.strength ? param.strength : 0.55; this.mamb = values.invMass * values.invMass; }, - + update: function() { var delta = this.b - this.a; var dist = delta.length; @@ -47,15 +47,6 @@ onResize(); - function onResize() { - values.count = 0; - if (path) { - path.remove(); - } - size = view.bounds.size * [2, 1]; - path = createPath(0.1); - } - function createPath(strength) { var path = new Path(); path.data = {}; @@ -81,10 +72,18 @@ return path; } + function onResize() { + values.count = 0; + if (path) { + path.remove(); + } + size = view.bounds.size * [2, 1]; + path = createPath(0.1); + } + function onMouseMove(event) { var segments = path.segments; - var index = Math.floor((event.point.x + size.width / 4) - * segments.length / size.width); + var index = Math.floor((event.point.x + size.width / 4) * segments.length / size.width); var y = event.point.y; var range = size.height / 4; var segment = segments[index]; @@ -130,7 +129,7 @@ path.insert(0, new Point(0, size.height)); path.add(new Point(size)); } - + function onKeyDown(event) { if (event.key == 'space') path.fullySelected = !path.fullySelected;