├── .gitignore ├── run_jekyll.sh ├── _includes ├── reference │ ├── pen.html │ ├── paper.html │ ├── container.html │ ├── editing.html │ ├── change.html │ ├── strokes.html │ ├── raphael-sketchpad.html │ ├── json.html │ └── animate.html ├── reference.html ├── analytics.html ├── header.html ├── how-it-works.html ├── how-to-use-it.html └── editing.html ├── stylesheets ├── cw15gw20cc24 │ ├── print.css │ ├── ie.css │ └── screen.css └── main.css ├── README.md ├── index.html ├── javascripts ├── json2.min.js ├── json2.js └── raphael-2.0.1.min.js └── src └── raphael.sketchpad.js /.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | -------------------------------------------------------------------------------- /run_jekyll.sh: -------------------------------------------------------------------------------- 1 | jekyll serve -P 5020 2 | -------------------------------------------------------------------------------- /_includes/reference/pen.html: -------------------------------------------------------------------------------- 1 |
4 | Returns the pen associated with the widget. 5 |
6 |{{ js | strip | escape }}
14 | 4 | Returns the Raphael paper object. 5 |
6 |{{ js | strip | escape }}
14 | 4 | Returns the HTML element containing the Raphael paper object. 5 |
6 |{{ js | strip | escape }}
14 | 4 | Sets the editing mode of the sketchpad. 5 | The sketchpad has to be initialized as an editor. 6 | There are three modes: 7 |
8 |string or boolean{{ js | strip | escape }}
32 | 5 | Draw something here. 6 |
7 |10 | Sets the function that handles the change event. 11 | onchange events happen when 12 |
13 | 14 |function{{ js | strip | escape }}
27 |
28 |
40 |
11 | Raphael Sketchpad is a simple drawing editor that you can easily include with your forms.
12 | It is similar to Mai'Nada.net's InputDraw,
13 | but does not require Flash.
14 | It is built on top of the Raphael
15 | Javascript vector graphics library.
16 |
18 | Raphael Sketchpad requires these Javascript libraries: 19 | Raphael 2.0.1, 20 | jQuery, and 21 | JSON.stringify. 22 |
23 |7 | Sets the strokes in the widget. 8 | If the json parameter is not provided, 9 | returns an array of strokes. 10 |
11 | 12 |array{{ js | strip | escape }}
36 |
37 |
56 | 4 | Creates a Raphael SketchPad widget. 5 |
6 | 7 |Raphael or stringobjectnumber (100)number (100)string (null)array (empty array)boolean (false){{ js | strip | escape }}
53 | 6 | Draw a sketch below. 7 |
8 | 11 |16 | The sketch is stored as JSON in an input field. 17 |
18 | 21 |26 | Click 27 | to display the JSON data in the viewer. 28 |
29 | 32 |7 | Sets the strokes in the widget. 8 | If the json parameter is not provided, 9 | returns a JSON representation of the strokes. 10 |
11 | 12 |string{{ js | strip | escape }}
36 |
37 |
56 | 10 | Animates the strokes in the widget. 11 | 12 |
13 | 14 |number{{ js | strip | escape }}
28 |
29 |
62 | {{ html | strip | escape }}
18 | {{ html | strip | escape }}
55 | strokes with an array of strokes.
63 | Set the editing option to false.
64 | {{ html | strip | escape }}
92 | 139 | The editor supports various editing actions. 140 |
141 | 142 |{{ js | strip | escape }}
152 | {{ js | strip | escape }}
164 | {{ js | strip | escape }}
176 | {{ js | strip | escape }}
188 | {{ js | strip | escape }}
200 | 207 | The pen has various properties that you can set. 208 |
209 | 210 |{{ js | strip | escape }}
220 | {{ js | strip | escape }}
232 | {{ js | strip | escape }}
244 | e){if(c&&!l.start){m=cf(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cf(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},ch=cg(1),ci=cg(),cj=cg(0,1);a.getTotalLength=ch,a.getPointAtLength=ci,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cj(a,b).end;var d=cj(a,c,1);return b?cj(d,b).end:d},b$.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return ch(this.attrs.path)}},b$.getPointAtLength=function(a){if(this.type=="path")return ci(this.attrs.path,a)},b$.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var ck=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};ck.easeIn=ck["ease-in"]=ck["<"],ck.easeOut=ck["ease-out"]=ck[">"],ck.easeInOut=ck["ease-in-out"]=ck["<>"],ck["back-in"]=ck.backIn,ck["back-out"]=ck.backOut;var cl=[],cm=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cn=function(){var b=+(new Date),c=0;for(;c