Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CompGeomProject/index.html
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (32 sloc)
1.04 KB
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> | |
<html> | |
<head> | |
<!-- Load the Paper.js library --> | |
<script type="text/javascript" src="./node_modules/paper/dist/paper-full.min.js"></script> | |
<!-- Define inlined JavaScript --> | |
<script type="text/javascript"> | |
// Only executed our code once the DOM is ready. | |
window.onload = function() { | |
// Get a reference to the canvas object | |
var canvas = document.getElementById('myCanvas'); | |
// Create an empty project and a view for the canvas: | |
paper.setup(canvas); | |
// Create a Paper.js Path to draw a line into it: | |
var path = new paper.Path(); | |
// Give the stroke a color | |
path.strokeColor = 'black'; | |
var start = new paper.Point(100, 100); | |
// Move to start and draw a line from there | |
path.moveTo(start); | |
// Note that the plus operator on Point objects does not work | |
// in JavaScript. Instead, we need to call the add() function: | |
path.lineTo(start.add([ 200, -50 ])); | |
// Draw the view now: | |
paper.view.draw(); | |
} | |
</script> | |
</head> | |
<body> | |
<canvas id="myCanvas" resize></canvas> | |
</body> | |
</html> |