Parallel lines

by Luke Harby

HTML

<section id="landing">
			<canvas id="stripes"></canvas>

			<article class="about-me">
				<ul>
					<li>
						<hgroup>
							<h1> Hi</h1>
							<h2> This is the main text</h2>
						</hgroup>
					</li>
					<li>
						<hgroup>
							<h1> h1</h1>
							<h2> Lorem ipsum dolor in imit ment </h2>
						</hgroup>
					</li>
					<li>
						<hgroup>
							<h1> h1</h1>
							<h2> plux um quba am amnit spet</h2>
						</hgroup>
					</li>
				</ul>
			</article>
 
            <span id="play"> Sorry, but I need some alone time with the lines </span>

CSS

body {
	font-family: monospace;
	background: #FFF; 
	color: #111;
	margin: 0px;
}

#landing.playing > article {
	pointer-events: none;
	opacity: 0;
}

/*Canvas element - initially hidden*/
canvas {
	position: absolute;
	display: none;
	width: 100%;
}

section {
	position: absolute;
	width: 100%;
}

article {
	-webkit-transition: opacity 0.3s;
	-moz-transition: opacity 0.3s;
	-ms-transition: opacity 0.3s;
	-o-transition: opacity 0.3s;
    transition: opacity 0.3s;
    opacity: 1;

	position: relative;
	margin-top: 60px;
}


ul {
	padding-left: 20px;
	list-style: none;
}

hgroup {
	margin-bottom: 20px;
}

h1 {
	margin-bottom: 5px;
	font-weight: 900;
	font-size: 12px;
	color: #006600;
}

h2 {
	font-weight: 300;
	margin-top: 5px;
	font-size: 15px;
}

a {
	-webkit-transition: color 0.15s;
	-moz-transition: color 0.15s;
	-ms-transition: color 0.15s;
	-o-transition: color 0.15s;
    transition: color 0.15s;
	color: #000;
	height: 16px;
	display: inline-block;
	text-decoration: none;
	border-bottom: 1px dotted #000;
}

a:hover {
	color: deeppink;
	border-bottom: 1px dotted deeppink;
}

#play {
	cursor: pointer;
	position: fixed;
	bottom: 5px;
	right: 5px;
	font-size: 10px;
	color: #555;
}

#play:hover {
	color: #222;
}

JavaScript

(function () {
  var lastTime = 0;
  var vendors = ['ms', 'moz', 'webkit', 'o'];
  for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
    window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
    window.cancelAnimationFrame =
      window[vendors[x] + 'CancelAnimationFrame'] ||
      window[vendors[x] + 'CancelRequestAnimationFrame'];
  }

  if (!window.requestAnimationFrame)
    window.requestAnimationFrame = function (callback, element) {
      var currTime = new Date().getTime();
      var timeToCall = Math.max(0, 16 - (currTime - lastTime));
      var id = window.setTimeout(function () {
        callback(currTime + timeToCall);
      }, timeToCall);
      lastTime = currTime + timeToCall;
      return id;
    };

  if (!window.cancelAnimationFrame)
    window.cancelAnimationFrame = function (id) {
      clearTimeout(id);
    };
})();

var Nodes = {
  // Settings
  density: 5,
  reactionSensitivity: 3,

  points: [],
  lines: [[], []],
  mouse: { x: -1000, y: -1000, down: false },

  animation: null,

  canvas: null,
  context: null,

  init: function () {
    // Set up the visual canvas
    this.canvas = document.getElementById('stripes');
    this.context = this.canvas.getContext('2d');
    this.context.lineJoin = 'bevel';
    this.canvas.width = window.innerWidth;
    this.canvas.height = Math.max(window.innerHeight, 720);
    this.canvas.style.display = 'block';

    document.addEventListener('mousemove', this.mouseMove, false);
    document.addEventListener('mousedown', this.mouseDown, false);
    document.addEventListener('mouseup', this.mouseUp, false);
    document.addEventListener('mouseout', this.mouseOut, false);

    window.onresize = function (event) {
      Nodes.canvas.width = window.innerWidth;
      Nodes.canvas.height = Math.max(window.innerHeight, 720);
      Nodes.onWindowResize();
    };

    this.preparePoints();
   ...