Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luz-alphacode committed Apr 22, 2019
0 parents commit 46b696e
Show file tree
Hide file tree
Showing 15 changed files with 1,201 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
coverage
node_modules
.nyc_output
.DS_Store
*.log
.vscode
.idea
dist
compiled
.awcache
.rpt2_cache
docs
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016-2019 luz-alphacode

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions demo/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
html {
height: 100%;
width: 100%;
}

body {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}

canvas {
box-shadow: 0 0 1rem #ccc;
}
35 changes: 35 additions & 0 deletions demo/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(function() {
function RunDemo() {
let canvas = document.querySelector('canvas')
paper.setup(canvas)
paper.view.center = [0, 0]

// simple polygon
let r = new paper.Path.Rectangle({ point: [-600, -300], size: [80, 80], fillColor: '#bf5b5b', strokeColor: 'black' })
r.offset(10)
r.bringToFront()
r.offset(-10).offset(-10).offset(-10)

// simple polygon
let s = new paper.Path.Star({ center: [-400, -260], points: 12, radius1: 40, radius2: 30, fillColor: '#ea9a64', strokeColor: 'black' })
s.offset(10)
s.bringToFront()
s.offset(-10).offset(-10)

// smooth
let s2 = new paper.Path.Star({ center: [-250, -260], points: 7, radius1: 40, radius2: 30, fillColor: '#efd158', strokeColor: 'black' })
s2.smooth()
s2.offset(10)
s2.bringToFront()
s2.offset(-10).offset(-10)

// complex
let c1 = new paper.Path.Circle({ center: [-120, -260], radius: 40, fillColor: '#a5c15d', strokeColor: 'black' })
let c2 = new paper.Path.Circle({ center: [-50, -260], radius: 40, fillColor: '#a5c15d', strokeColor: 'black' })
let c = c1.unite(c2, { insert: true })
c.offset(10)
c.bringToFront()
c.offset(-10).offset(-10).offset(-10)
}
window.onload = RunDemo
})()
12 changes: 12 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<title>Demo</title>
<link rel="stylesheet" href="./demo.css"/>
<script type="text/javascript" src="https://cdn.bootcss.com/paper.js/0.12.0/paper-core.min.js"></script>
<script type="text/javascript" src="./paperjs-offset.min.js"></script>
<script type="text/javascript" src="./demo.js"></script>
</head>
<body>
<canvas width="1366" height="768"></canvas>
</body>
</html>
Loading

0 comments on commit 46b696e

Please sign in to comment.