-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
283 lines (247 loc) · 11.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="http://octavioturra.github.io/paper-canvas/">
<!-- Facebook Metatags -->
<meta property="og:title" content="<paper-canvas>">
<meta property="og:description" content="Paper.js and canvas element wrapper.">
<meta property="og:url" content="http://octavioturra.github.io/paper-canvas/">
<meta property="og:image" content="http://octavioturra.github.io/paper-canvas/demo/fb.png">
<title><paper-canvas></title>
<!-- Demo CSS -->
<link rel="icon" href="https://github.global.ssl.fastly.net/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto+Slab">
<link rel="stylesheet" href="demo/demo.css">
<!-- Importing Web Component's Polyfill -->
<script src="bower_components/platform/platform.js"></script>
<!-- Importing Custom Elements -->
<link rel="import" href="src/paper-canvas.html">
</head>
<body>
<!-- Support Warning -->
<div class="brower-support">
<p>Sorry, your browser <a href="http://caniuse.com/#feat=canvas">do not support</a> the Canvas API :(</p>
</div>
<!-- Splash Screen -->
<div class="splash-container">
<div class="splash">
<h1 class="splash-head">
<div class="splash-first-line"><<span class="highlight">paper</span></div>
<div class="splash-second-line"><span class="highlight">canvas</span>></div>
</h1>
<p class="splash-subhead">
Paper.js and canvas element wrapper
</p>
<p class="gh-btns pure-hidden-phone">
<iframe src="http://ghbtns.com/github-btn.html?user=octavioturra&repo=paper-canvas&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="152" height="30"></iframe>
<iframe src="http://ghbtns.com/github-btn.html?user=octavioturra&repo=paper-canvas&type=fork&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="156" height="30"></iframe>
</p>
</div>
</div>
<!-- Content Wrapper -->
<div class="content-wrapper">
<!-- Install -->
<div class="content">
<h2 class="content-head is-center">Install</h2>
<div class="section pure-g-r">
<div class="center">
<div class="pure-u-1">
<h3 class="content-subhead">Install the component using Bower</h3>
<pre>$ bower install paper-canvas</pre>
<a class="pure-button" href="https://github.com/octavioturra/paper-canvas/fork">Fork on GitHub</a>
<a class="pure-button" href="https://github.com/octavioturra/paper-canvas/archive/gh-pages.zip">Download as ZIP</a>
</div>
</div>
</div>
</div>
<!-- Paper canvas -->
<div class="ribbon l-box-lrg pure-g">
<div class="center section pure-u-1 pure-u-med-1-2 pure-u-lrg-3-5">
<h2 class="content-head content-head-ribbon"><paper-canvas></h2>
<p>Provides you a simple wrapper for <a href="http://http://paperjs.org/">Paper.js</a>.</p>
<!-- Demo #1 -->
<p>In the following demo, we set a basic canvas, with red background.</p>
<div class="example">
<paper-canvas class="shadow" width="300px" height="300px" background="red" id="redCanvas"></paper-canvas>
</div>
<pre><code><paper-canvas width="300px" height="60px" background="red"></paper-canvas></code></pre>
<!-- Demo #2 -->
<p>In the following demo, we draw a simple circle into the canvas with <a href="http://http://paperjs.org/">Paper.js</a> API.</p>
<div class="example">
<paper-canvas class="shadow" width="300px" height="300px" id="circleCanvas"></paper-canvas>
<script>
window.addEventListener('polymer-ready', function(e) {
var paperCanvas = document.querySelector('#circleCanvas');
paperCanvas.addEventListener('redraw', function(){
var circle = this.paper.Path.Circle(new this.paper.Point(150, 150), 100);
circle.fillColor = 'green';
this.draw();
});
});
</script>
</div>
<pre><code><paper-canvas class="shadow" width="300px" height="300px" id="circleCanvas"></voice-player>
<script>
window.addEventListener('polymer-ready', function(e) {
var paperCanvas = document.querySelector('#circleCanvas');
paperCanvas.addEventListener('redraw', function(){
var center = new this.paper.Point(150, 150);
var circle = this.paper.Path.Circle(center, 100);
circle.fillColor = 'green';
this.draw();
});
});
</script></code></pre>
<!-- Options -->
<h2 class="content-head content-head-ribbon">Options</h2>
<table class="pure-table pure-table-striped">
<thead>
<tr>
<th>Attribute</th>
<th>Options</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>width</td>
<td>string</td>
<td>800px</td>
<td>Specifies entire element width.</td>
</tr>
<tr>
<td>height</td>
<td>strings</td>
<td>600px</td>
<td>Specifies entire element height.</td>
</tr>
<tr>
<td>background</td>
<td>string</td>
<td>#FFF</td>
<td>Specifies the background color of the layer.</td>
</tr>
</tbody>
</table>
<!-- Methods -->
<h2 class="content-head content-head-ribbon">Methods</h2>
<table class="pure-table pure-table-striped">
<thead>
<tr>
<th>Method</th>
<th>Parameters</th>
<th>Returns</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>redraw()</td>
<td>None</td>
<td>Nothing</td>
<td>Redraw canvas with a background rectangle.</td>
</tr>
<tr>
<td>clear()</td>
<td>None</td>
<td>Nothing</td>
<td>Clears entire canvas layer.</td>
</tr>
<tr>
<td>getDataURL()</td>
<td>MIME</td>
<td>String</td>
<td>Gets the base64 converted URL based on the MIME.</td>
</tr>
<tr>
<td>draw()</td>
<td>None</td>
<td>Nothing</td>
<td>Process data and draw into the canvas.</td>
</tr>
</tbody>
</table>
<!-- Events -->
<h2 class="content-head content-head-ribbon">Events</h2>
<table class="pure-table pure-table-striped">
<thead>
<tr>
<th>Event</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>onredraw</td>
<td>Triggers when the canvas was recreated.</td>
</tr>
<tr>
<td>onclear</td>
<td>Triggers when the canvas layer was cleared.</td>
</tr>
<tr>
<td>ondrawn</td>
<td>Triggers when the canvas was been drawn.</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Features -->
<div class="features content">
<h2 class="content-head is-center">Features</h2>
<div class="center section pure-g-r">
<div class="l-box pure-u-1-2">
<h3 class="content-subhead">
Paper-canvas
</h3>
<p>
Wraps <a href="http://paperjs.org/">Paper.js</a>, with simple constructor and a canvas element.
</p>
</div>
</div>
</div>
<!-- Usage -->
<div class="content">
<h2 class="content-head is-center">Usage</h2>
<div class="section pure-g-r center">
<div class="pure-u-1">
<h3 class="content-subhead">1. Import Web Components' polyfill</h3>
<pre><code><script src="bower_components/platform/platform.js"></script></code></pre>
<h3 class="content-subhead">2. Import Custom Element</h3>
<pre><code><link rel="import" href="bower_components/paper-canvas/dist/paper-canvas.html"></code></pre>
<h3 class="content-subhead">3. Start using it!</h3>
<pre><code><paper-canvas></paper-canvas></code></pre>
</div>
</div>
</div>
<!-- Footer -->
<div class="footer l-box is-center">
<p>
Made by <a href="http://fraguto.com.br/">Octávio Turra</a> under <a href="http://octavioturra.mit-license.org/">MIT license</a>
</p>
</div>
</div>
<!-- Demo Scripts -->
<script src="demo/support.js"></script>
<!-- Syntax Highlight -->
<link href="demo/highlight.github.css" rel="stylesheet">
<script src="demo/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53709570-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>