Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
	<body>
		<canvas id="mycanvas" width="1000" height="600" style="width:100%"></canvas>
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
				<script src="https://d28qoto45d39ov.cloudfront.net/arrastre/js/lodash.min.js"></script>
		<script src="https://d28qoto45d39ov.cloudfront.net/arrastre/js/d3.v3.min.js"></script>
		<script src="https://d28qoto45d39ov.cloudfront.net/arrastre/js/arrastre-util.js"></script>
		<script src="https://d28qoto45d39ov.cloudfront.net/arrastre/js/getdata.js"></script>
	</body>
</html>
              
            
!

CSS

              
                body {
  background: #000;
  margin: 0 auto;
  text-align: center;
  width: 96%;
}
              
            
!

JS

              
                /*
BIGDATA

For a single skeleton, each joint position is represented with 3 points (one for each co-ordinate). Each joint has a unique colour.

The value of each co-ordinate is mapped to the y-axis. The x position is random.
*/

function BigData(canvas) {
  var width = 1000;
  var height = 600;

  var startTime = Date.now();

  // Set up color scale function
  var color = d3.scale.category20b();
  
  // Set up y-scale function
  var scale = d3.scale.linear().domain([-3, 6]).range([1000, 0]);

  // Set up scale to determine how much data will be displayed with respect to time
  var indexScale = d3.scale.threshold().domain([0, 54000, 70000, 84000, 120000, 154000, 167000, 200000, 230000]).range([0, 3, 10, 40, 10, 1, 60, 20, 10, 10]);

  var ctx = canvas.getContext('2d');
  ctx.fillStyle = "rgb(0,0,0)";
  ctx.fillRect(0, 0, this.width, this.height);
  
  this.draw = function(json) {
    if(json === undefined) {
      return;
    }

    // getDataOfSkeleton returns the x and y positions of each joint as a single array of values
    var data = getDataOfSkeleton(json, 0);
  
    // Fade the canvase
    ctx.fillStyle = "rgba(0, 0, 0, 0.02)";
    ctx.fillRect(0, 0, width, height);

    // Draw the points!
    var indexThreshold = indexScale(Date.now() - startTime);
    _.each(data, function(d, index) {
      if(index > indexThreshold)
        return;

      var x = Math.random() * width;
      var y = scale(d) % height;
      ctx.fillStyle = color(index % 20);
      drawCircle(ctx, x, y, 3);
    });
  };
};



// You can choose one of these to visualise a different dance
var DATASET_ALGORITHM = 'https://d10u56tzn9e9rq.cloudfront.net/algorithm_';

var DATASET_BINARY = 'https://d10u56tzn9e9rq.cloudfront.net/binary_';

var DATASET_WHOLEPIECE = 'https://d10u56tzn9e9rq.cloudfront.net/wholepiece_';

var dataFetcher = new ChunkedDataFetcher(DATASET_ALGORITHM);
var bigData = new BigData( document.getElementById('mycanvas'));
dataFetcher.drawFunction = function(json) {bigData.draw(json);}
              
            
!
999px

Console