Created
December 12, 2014 00:53
-
-
Save garciadelcastillo/946028812f4eb4586806 to your computer and use it in GitHub Desktop.
Sketchpad.js - Nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="styles.css"> | |
</head> | |
<body> | |
<div id="sketchpadDiv"> | |
<canvas id="sketchpadCanvas"></canvas> | |
</div> | |
</body> | |
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<script type="text/javascript" src="http://www.garciadelcastillo.es/sketchpad/sketchpad.js"></script> | |
<script type="text/javascript" src="sketch.js"></script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create new instance of Sketchpad in target Canvas | |
var pad = new Sketchpad('sketchpadCanvas'); | |
// A free unconstrained Node, created with constructor | |
var node = new pad.Node(160, 200); | |
// A Node with constrained Y movement | |
var nodeX = pad.Node.horizontal(320, 200); | |
// A Node with constrained X movement | |
var nodeY = pad.Node.vertical(480, 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0; | |
padding: 0; | |
} | |
#sketchpadDiv { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
border: 1px solid #000; | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
#sketchpadCanvas { | |
position: absolute; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment