Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Beyond Boxes

Beyond Boxes

This preso with a bunch of video - sorry for the peeps playing at home. You probably wouldn't get much value just from these slides alone tbh - this is here so the audience can grab the links to all the stuff shown in slides!

Slide 7 video:
http://visualizer.halowaypoint.com
http://www.dilladimension.com
http://www.because-recollection.com
http://a-way-to-go.com
http://worldbakingday.com
http://codepen.io/Yakudoo/pen/YXxmYR
https://musiclab.chromeexperiments.com
http://24hoursofhappy.com
http://leapsecond2015.com
http://1000.chromeexperiments.com
http://codepen.io/ARS/pen/pjypwd
http://www.mdcenter.co.jp/
http://resizemyhome.com/
http://40together.razorfishawards.com
http://www.dennis.video
http://findingho.me
http://species-in-pieces.com

Slide 20 video:
http://bigwilly.style

Slide 21 video:
http://corgiorgy.com

CodePens with the Canvas code I showed:
http://codepen.io/rachsmith/pen/gaxOMN/
http://codepen.io/rachsmith/pen/NGwwGo
http://codepen.io/rachsmith/pen/jbaQPR

Slide 61: Ana Tudor's pen
http://codepen.io/thebabydino/pen/avwKGw

Slide 88: https://vimeo.com/83409816
Check out Wentin Guo she is crazy talented

Slide 89: Plinco board created by John Brown & Ben Purdy check John out he's my fave JS artist http://thisisjohnbrown.com/

Slide 90: Google's Open Source Library https://googlecreativelab.github.io/anypixel/

Slide 92: Lightwave party video
https://vimeo.com/91690892
Slide 93: Installation by Active Theory http://twitter.com/active_theory for Google IO

Slide 94-96
http://webvr.info/
https://vr.chromeexperiments.com/
https://webvr.info/get-chrome/
demo shown: https://twitter.com/fernandojsg/status/737682918227742720
http://mozvr.com/
https://aframe.io/

Come have fun coding with me at CodePen!!!
http://codepen.io

Avatar for Rachel Smith

Rachel Smith

June 16, 2016
Tweet

More Decks by Rachel Smith

Other Decks in Technology

Transcript

  1. I’m constantly on the look out for fresh examples of:

    Media integration animation graphics (Canvas & WebGL)
  2. I fell in love with “demo culture”. Code as not

    just a means to an end. Code as art.
  3. // select canvas
 var canvas = document.getElementById('canvas');
 var context =

    canvas.getContext('2d');
 
 canvas.width = window.innerWidth;
 canvas.height = window.innerHeight;
 
 // draw a rectangle
 context.rect(10, 10, 100, 100);
 context.stroke();
  4. 
 
 function loop() { // things to happen in

    the frame go here requestAnimationFrame(loop);
 }
 
 loop();
  5. 
 
 
 function drawSquare(x, y) {
 context.beginPath();
 context.rect(x, y,

    100, 100);
 context.stroke();
 context.closePath();
 }
  6. // position
 var x = 10;
 var y = 10;


    // velocity
 var vx = 1;
 var vy = 1;
  7. function loop() {
 // clear the canvas
 context.clearRect(0, 0, width,

    height);
 // update the position using velocity
 x = x + vx;
 y = y + vy;
 // draw the square
 drawSquare(x, y);
 requestAnimationFrame(loop);
 }
  8. Square.prototype.update = function() {
 // update position
 this.position.x += this.velocity.x;


    this.position.y += this.velocity.y;
 // update size
 this.size += 0.05;
 }
  9. Square.prototype.draw = function() {
 // draw the square
 context.beginPath();
 context.rect(this.position.x,

    this.position.y, this.size, this.size);
 context.strokeStyle = this.color;
 context.stroke();
 context.closePath();
 }
  10. // create the squares
 for (var i = 0; i

    < 200; i++) {
 var square = new Square({
 x: -100,
 y: -100
 }, {
 x: 0,
 y: 0
 }, 30, 'white');
 squares.push(square);
 }
  11. // create the squares
 for (var i = 0; i

    < 200; i++) {
 var square = new Square({
 x: -100,
 y: -100
 }, {
 x: 0,
 y: 0
 }, 30, 'white');
 squares.push(square); startSquare(square, i * 200); }
  12. function startSquare(square, delay) {
 setTimeout(function() {
 square.size = 30;
 square.velocity.x

    = 0.5 + Math.random() * 1;
 square.velocity.y = 0.5 + Math.random() * 1;
 }, delay);
 }
  13. function loop() {
 context.clearRect(0, 0, width, height);
 var l =

    squares.length;
 for (var i = 0; i < l; i++) {
 squares[i].update();
 squares[i].draw();
 } 
 requestAnimationFrame(loop);
 }
  14. for (var i = 0; i < 200; i++) {


    var hue = Math.round(360 / 30 * i);
 var color = 'hsl(' + hue + ', 50%, 50%)';
 var square = new Square({
 x: -100,
 y: -100
 }, {
 x: 0,
 y: 0
 }, 30, color);
 squares.push(square);
 startSquare(square, i * 200);
 }
  15. function Square(position, velocity, size, color, vRotation) {
 this.position = position;


    this.velocity = velocity;
 this.size = size;
 this.color = color; this.rotation = 0; this.vRotation = vRotation;
 }
  16. Square.prototype.update = function() {
 // update position
 this.position.x += this.velocity.x;


    this.position.y += this.velocity.y;
 // update size
 this.size += 0.05;
 // update rotation
 this.rotation += this.vRotation;
 }
  17. Square.prototype.draw = function() {
 // save canvas coordinate system
 context.save();


    // translate to center of square
 context.translate(this.position.x + this.size * 0.5, this.position.y + this.size * 0.5);
 // rotate the canvas
 context.rotate(this.rotation * Math.PI / 180);
 // translate back
 context.translate(-(this.position.x + this.size * 0.5), - (this.position.y + this.size * 0.5));
 
 // draw the square
 ...
 
 // restore the coordinate system
 context.restore();
 }
  18. DIY with the Canvas API can get a little tedious.

    Fabric.js Easel.js Paper.js many more…
  19. var canvas = new fabric.Canvas('c');
 
 // create a rectangle

    with angle=45
 var rect = new fabric.Rect({
 left: 10,
 top: 10,
 stroke: 'white',
 width: 100,
 height: 100,
 angle: 45
 });
 
 canvas.add(rect);
  20. “What do you mean I can’t jam 2000 SVG elements

    in to a document with a blur filter??”
  21. The simple question of “why are my fans on?” requestAnimationFrame

    JavaScript memory management layout, composition, paint in the DOM
  22. It’s not even just a browser on your phone! (Or

    on your fridge, or on your Apple Watch).