Skip to content

Instantly share code, notes, and snippets.

@andyg2
Created March 10, 2022 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyg2/be1e8e738bb718a0797dfb557dec86fb to your computer and use it in GitHub Desktop.
Save andyg2/be1e8e738bb718a0797dfb557dec86fb to your computer and use it in GitHub Desktop.
Vector Connect
<html>
<head>
<!-- Load the Paper.js library -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.11.5/paper-full.js"></script>
<!-- Define inlined PaperScript associate it with myCanvas -->
<script type="text/paperscript" canvas="myCanvas">
var myPath = new Path();
myPath.strokeColor = 'black';
// This function is called whenever the user
// clicks the mouse in the view:
function onMouseDown(event) {
// Add a segment to the path at the position of the mouse:
myPath.add(event.point);
}
</script>
</head>
<body>
<canvas id="myCanvas" resize></canvas>
</body>
</html>
var myPath = new Path();
myPath.strokeColor = 'black';
// This function is called whenever the user
// clicks the mouse in the view:
function onMouseDown(event) {
// Add a segment to the path at the position of the mouse:
myPath.add(event.point);
}
body {
background-color: #fff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment