Skip to content

Commit b0b3600

Browse files
committed
1 parent 37d27d1 commit b0b3600

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# croquis.js
2-
drawing tool library
2+
this library provides [Photoshop-like brush features][common-brush].
3+
4+
it also provides functions such as stabilization of brush strokes.
5+
6+
[common-brush]: https://croquisjs.0xabcdef.com/example/common-brush
7+
8+
## install
9+
```sh
10+
npm install croquis.js
11+
# or
12+
yarn add croquis.js
13+
```
14+
15+
## stroke protocol
16+
brush-related functions in croquis.js are working on the [stroke protocol][stroke protocol].
17+
18+
stroke protocol consists of the `down` method and the `move` and `up` methods of the drawing context.
19+
20+
`down` method means that the stylus pen has started drawing a stroke. it returns the drawing context containing the `move` and `up` methods.
21+
22+
`move` means that the stylus pen draws a stroke, and `up` means that the stroke ends.
23+
24+
stroke protocol makes it easy to add features such as stabilization without having to modify the drawing code very much.
25+
26+
look at the [simple brush example][simple brush] and the [pulled string stabilizer example][pulled string].
27+
you can see that the code is not different except for [the part injecting the settings][injecting the settings] and [the part drawing the guide][drawing the guide].
28+
29+
[stroke protocol]: ./packages/croquis.js/src/stroke-protocol.ts
30+
[simple brush]: ./packages/website/src/pages/example/simple-brush.tsx
31+
[pulled string]: ./packages/website/src/pages/example/stabilizer-pulled-string.tsx
32+
[injecting the settings]: https://github.com/disjukr/croquis.js/blob/master/packages/website/src/pages/example/stabilizer-pulled-string.tsx#L47-L58
33+
[drawing the guide]: https://github.com/disjukr/croquis.js/blob/master/packages/website/src/pages/example/stabilizer-pulled-string.tsx#L115-L141
334

435
## license
536
croquis.js is dual-licensed under Apache 2.0 and MIT terms.

packages/croquis.js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "croquis.js",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "drawing tool library",
55
"main": "index.js",
66
"scripts": {

packages/website/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@types/react": "^16.9.31",
1515
"@types/react-color": "^3.0.2",
1616
"classnames": "^2.2.6",
17-
"croquis.js": "^0.0.2",
17+
"croquis.js": "^0.0.3",
1818
"next": "9.3.4",
1919
"react": "16.13.1",
2020
"react-color": "^2.18.1",

0 commit comments

Comments
 (0)