Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a graph.

  • Loading branch information...
commit 682a3a1229280a86fc202b494756b7ccc9bbb49b 1 parent 5ea2ff5
@mrbichel mrbichel authored
View
35 bower_components/d3/.bower.json
@@ -0,0 +1,35 @@
+{
+ "name": "d3",
+ "version": "3.4.2",
+ "main": "d3.js",
+ "scripts": [
+ "d3.js"
+ ],
+ "ignore": [
+ ".DS_Store",
+ ".git",
+ ".gitignore",
+ ".npmignore",
+ ".travis.yml",
+ "Makefile",
+ "bin",
+ "component.json",
+ "index.js",
+ "lib",
+ "node_modules",
+ "package.json",
+ "src",
+ "test"
+ ],
+ "homepage": "https://github.com/mbostock/d3",
+ "_release": "3.4.2",
+ "_resolution": {
+ "type": "version",
+ "tag": "v3.4.2",
+ "commit": "4637ee5a49ec9f2edea217869a0b4f43b3617912"
+ },
+ "_source": "git://github.com/mbostock/d3.git",
+ "_target": "~3.4.2",
+ "_originalSource": "d3",
+ "_direct": true
+}
View
25 bower_components/d3/CONTRIBUTING.md
@@ -0,0 +1,25 @@
+# Contributing
+
+If you’re looking for ways to contribute, please [peruse open issues](https://github.com/mbostock/d3/issues?milestone=&page=1&state=open). The icebox is a good place to find ideas that are not currently in development. If you already have an idea, please check past issues to see whether your idea or a similar one was previously discussed.
+
+Before submitting a pull request, consider implementing a live example first, say using [bl.ocks.org](http://bl.ocks.org). Real-world use cases go a long way to demonstrating the usefulness of a proposed feature. The more complex a feature’s implementation, the more usefulness it should provide. Share your demo using the #d3js tag on Twitter or by sending it to the d3-js Google group.
+
+If your proposed feature does not involve changing core functionality, consider submitting it instead as a [D3 plugin](https://github.com/d3/d3-plugins). New core features should be for general use, whereas plugins are suitable for more specialized use cases. When in doubt, it’s easier to start with a plugin before “graduating” to core.
+
+To contribute new documentation or add examples to the gallery, just [edit the Wiki](https://github.com/mbostock/d3/wiki)!
+
+## How to Submit a Pull Request
+
+1. Click the “Fork” button to create your personal fork of the D3 repository.
+
+2. After cloning your fork of the D3 repository in the terminal, run `npm install` to install D3’s dependencies.
+
+3. Create a new branch for your new feature. For example: `git checkout -b my-awesome-feature`. A dedicated branch for your pull request means you can develop multiple features at the same time, and ensures that your pull request is stable even if you later decide to develop an unrelated feature.
+
+4. The `d3.js` and `d3.min.js` files are built from source files in the `src` directory. _Do not edit `d3.js` directly._ Instead, edit the source files, and then run `make` to build the generated files.
+
+5. Use `make test` to run tests and verify your changes. If you are adding a new feature, you should add new tests! If you are changing existing functionality, make sure the existing tests run, or update them as appropriate.
+
+6. Sign D3’s [Individual Contributor License Agreement](https://docs.google.com/forms/d/1CzjdBKtDuA8WeuFJinadx956xLQ4Xriv7-oDvXnZMaI/viewform). Unless you are submitting a trivial patch (such as fixing a typo), this form is needed to verify that you are able to contribute.
+
+7. Submit your pull request, and good luck!
View
26 bower_components/d3/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2014, Michael Bostock
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* The name Michael Bostock may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
9 bower_components/d3/README.md
@@ -0,0 +1,9 @@
+# Data-Driven Documents
+
+<a href="http://d3js.org"><img src="http://d3js.org/logo.svg" align="left" hspace="10" vspace="6"></a>
+
+**D3.js** is a JavaScript library for manipulating documents based on data. **D3** helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.
+
+Want to learn more? [See the wiki.](https://github.com/mbostock/d3/wiki)
+
+For examples, [see the gallery](https://github.com/mbostock/d3/wiki/Gallery) and [mbostock’s bl.ocks](http://bl.ocks.org/mbostock).
View
24 bower_components/d3/bower.json
@@ -0,0 +1,24 @@
+{
+ "name": "d3",
+ "version": "3.4.2",
+ "main": "d3.js",
+ "scripts": [
+ "d3.js"
+ ],
+ "ignore": [
+ ".DS_Store",
+ ".git",
+ ".gitignore",
+ ".npmignore",
+ ".travis.yml",
+ "Makefile",
+ "bin",
+ "component.json",
+ "index.js",
+ "lib",
+ "node_modules",
+ "package.json",
+ "src",
+ "test"
+ ]
+}
View
19 bower_components/d3/composer.json
@@ -0,0 +1,19 @@
+{
+ "name": "mbostock/d3",
+ "description": "A small, free JavaScript library for manipulating documents based on data.",
+ "keywords": ["dom", "svg", "visualization", "js", "canvas"],
+ "homepage": "http://d3js.org/",
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Mike Bostock",
+ "homepage": "http://bost.ocks.org/mike"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/mbostock/d3/issues",
+ "wiki": "https://github.com/mbostock/d3/wiki",
+ "API": "https://github.com/mbostock/d3/wiki/API-Reference",
+ "source": "https://github.com/mbostock/d3"
+ }
+}
View
9,275 bower_components/d3/d3.js
9,275 additions, 0 deletions not shown
View
5 bower_components/d3/d3.min.js
5 additions, 0 deletions not shown
View
10 css/screen.css
@@ -8,4 +8,12 @@ section#control {
left: 40px; }
section#control .CodeMirror {
width: 460px;
- height: 200px; }
+ height: 400px; }
+ section#control .buttons {
+ padding: 0.8em 0em; }
+
+#datagraph {
+ margin-top: 1em;
+ background: black;
+ width: 460px;
+ height: 150px; }
View
51 index.html
@@ -3,7 +3,10 @@
<head>
<meta charset="UTF-8">
<title>Voronoi Synth Local</title>
+
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/base-min.css">
+ <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure-min.css">
+
<script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="bower_components/paper/dist/paper.js"></script>
@@ -18,25 +21,53 @@
<script type="text/paperscript" src="js/main.js" canvas="canvas"></script>
+ <script type="text/paperscript" src="js/graph.js" canvas="datagraph"></script>
+
+
<link rel="stylesheet" href="css/screen.css">
</head>
<body>
<canvas id="canvas" resize></canvas>
-
<section id="control">
-<form id="code">
- <textarea name="codeinput" id="codeinput">
- </textarea>
- <div class="buttons">
- <button id="run" type="submit" value="Run" class="button pure-button button-warning">Run</div>
- <button id="hide" type="submit" value="Hide" class="button pure-button">Hide</div>
- </div>
+ <div id="controlpanels">
+ <form id="code">
+
+<textarea name="codeinput" id="codeinput">
+// You can write javascript here.
+// And paperscript. Oh and there is jQuery.
+// Go ahead.
+
+walker1.speed = new Point(20,10);
-</form>
+loop = function(event) {
+
+ // this will run every frame
+
+ walker1.move();
+ walker2.move();
+ walker3.move();
+ walker4.move();
+ walker5.move();
+ walker6.move();
+}
+
+// You could create your own walkers.
+
+</textarea>
+
+ <canvas id="datagraph">
+ </canvas>
+
+ </div>
+ <div class="buttons">
+ <button id="run" type="submit" value="Run" class="pure-button button-warning">Run</button>
+ <button id="hide" type="submit" value="Hide" class="pure-button">Hide</button>
+ </div>
-</section>
+ </form>
+ </section>
</body>
</html>
View
27 js/graph.js
@@ -0,0 +1,27 @@
+
+var graphData = [];
+
+var graphpath = new Path.Line({
+ strokeColor: 'white'
+});
+
+for(var i=0;i<view.size.width;i++) {
+ graphpath.add(i, view.size.height/2);
+}
+
+function onFrame(event) {
+
+ graphData.push(walker1.pos.x/mainView.size.width);
+ if(graphData.length > view.size.width) {
+ graphData.shift();
+ }
+
+ graphpath.clear();
+
+ for(var i=0;i<graphData.length;i++) {
+ graphpath.add(i, graphData[i]*view.size.height);
+ }
+
+}
+
+
View
24 js/main.js
@@ -1,11 +1,12 @@
var voronoi = new Voronoi();
-var sites = generateBeeHivePoints(view.size / 200, true);
+var sites = generateBeeHivePoints(view.size / 100, true);
var bbox, diagram;
var oldSize = view.size;
var spotColor = new Color(0.9,0.6,0.9,0.9);
var mousePos = view.center;
var selected = false;
+window.mainView = view;
onResize();
@@ -27,9 +28,8 @@ $('#run').click(function(ev) {
$('#hide').click(function(ev) {
ev.preventDefault(); // to stop the form from submitting
- $(".CodeMirror").toggle();
- $('#hide').text(($(".CodeMirror").is(':visible') ? 'Hide' : 'Show') + '');
-
+ $("#controlpanels").toggle();
+ $('#hide').text(($("#controlpanels").is(':visible') ? 'Hide' : 'Show') + '');
});
@@ -77,6 +77,8 @@ var walker = function(_pointid) {
};
+window.walker = walker;
+
window.walker1 = new walker(1);
window.walker2 = new walker(2);
window.walker3 = new walker(3);
@@ -197,19 +199,15 @@ function onKeyDown(event) {
var ready = false;
+window.loop = function(event) {
+}
+
function onFrame(event) {
- if(ready) {
-
- walker1.move();
- walker2.move();
- walker3.move();
- walker4.move();
- walker5.move();
- walker6.move();
+ window.loop(event);
renderDiagram();
+
- }
}
View
BIN  sass/.sass-cache/816778dc5f3bf4f6228ecc9a166d0b68916928e1/screen.scssc
Binary file not shown
View
13 sass/screen.scss
@@ -11,11 +11,18 @@ section#control {
.CodeMirror {
width: 460px;
- height: 200px;
+ height: 400px;
}
- .button {
-
+ .buttons {
+ padding: 0.8em 0em;
}
+}
+
+#datagraph {
+ margin-top: 1em;
+ background: black;
+ width: 460px;
+ height: 150px;
}
Please sign in to comment.
Something went wrong with that request. Please try again.