{"id":18310875,"url":"https://github.com/jimschubert/brushes.js","last_synced_at":"2025-04-05T18:31:45.275Z","repository":{"id":1507637,"uuid":"1763817","full_name":"jimschubert/brushes.js","owner":"jimschubert","description":"Brush objects for HTML5 canvas 2d context","archived":false,"fork":false,"pushed_at":"2012-06-24T17:53:18.000Z","size":143,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T08:34:58.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimschubert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-05-18T01:12:16.000Z","updated_at":"2023-08-29T09:53:01.000Z","dependencies_parsed_at":"2022-08-16T13:31:03.303Z","dependency_job_id":null,"html_url":"https://github.com/jimschubert/brushes.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fbrushes.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fbrushes.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fbrushes.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimschubert%2Fbrushes.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimschubert","download_url":"https://codeload.github.com/jimschubert/brushes.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247383881,"owners_count":20930364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T16:15:47.283Z","updated_at":"2025-04-05T18:31:44.913Z","avatar_url":"https://github.com/jimschubert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# brushes.js\n\nThis is a simple Brush object framework that I wrote after seeing Mr. Doob's [Harmony project](http://mrdoob.com/projects/harmony/).\n\n# Requirements\n\nThe only requirement for using `./src/brushes.js` is to have a browser which supports HTML5 canvas 2d context.\n\nTo run the tests, you will need node.js and nodeunit installed.\n\n## Installing node.js\n__Instructions taken from [Mastering Node](http://github.com/jimschubert/masteringnode). Be sure to check it out!__\n\nTo build and install node from source, we first need to obtain the code. The first method of doing so is\nvia `git`, if you have git installed you can execute:\n\n    $ git clone http://github.com/joyent/node.git \u0026\u0026 cd node\n    $ git checkout v0.4.0\n\nFor those without _git_, or who prefer not to use it, we can also download the source via _curl_, _wget_, or similar:\n\n    $ curl -# http://nodejs.org/dist/node-v0.4.0.tar.gz \u003e node.tar.gz\n    $ tar -zxf node.tar.gz\n\nNow that we have the source on our machine, we can run `./configure` which discovers which libraries are available for node to utilize such as _OpenSSL_ for transport security support, C and C++ compilers, etc. `make` which builds node, and finally `make install` which will install node.\n\n    $ ./configure \u0026\u0026 make \u0026\u0026 sudo make install\n\n## Getting nodeunit\n\nNote: This has changed a bit. \n`require.paths` is removed in later versions of node.  You'll have to either install modules locally or globally.  You can now install using:\n\n    npm install -d\n\nThis installs all of the dependencies specified in `package.json` into the *node_modules* directory. When you run node, it traverses up the directory tree looking at all *node_modules* directories for the dependency.\n\n# Testing\nAfter installing the dependencies, you can easily start the tests by running\n\n    $ make test\n\nIf you hate make, you can also run the test runner directly\n\n    $ node test/run.js\n\n# Minify\nYou can minify the script by running\n\n    $ make clean minify\n\nThis will output to `src/brushes.min.js`\n\n# brushes.js Usage\n\nThis is a snippet from `examples/points/points.html`:\n\n\t\tvar points = [\n\t\t\t[50, 150],\n\t\t\t[150, 150],\n\t\t\t[150, 50],\n\t\t\t[50, 50],\n\t\t\t[50, 150]\n\t\t];\n\n\t\tvar examples = ['blood', 'boxes', 'charcoal', 'hearts', 'marker', 'pen', 'pencil', 'stars'];\n\n\t\tfor(var i = 0;i \u003c points.length;i++){ \n\t\t\tpointsDiv.html(pointsDiv.html() + \"[\" + points[i][0] + \",\" + points[i][1] + \"]\u003c/br\u003e\");\n\t\t}\n\n\t\tfor(var example = 0;example\u003cexamples.length; example++){\n\t\t\tvar canvas = $('#canvas-' + examples[example]).get(0),\n\t\t\t\tctx = canvas.getContext(\"2d\"),\n\t\t\t\tbrush = new Brushes[examples[example]]({\n\t\t\t\t\tcontext: ctx,\n\t\t\t\t\tsize: 1,\n\t\t\t\t\tcolor: [244,14,68],\n\t\t\t\t\trandomize: true, /* color has to be set to randomize it */\n\t\t\t\t\tpressure: 2\n\t\t\t\t}),\n\t\t\t\tlastX = points[0][0],\n\t\t\t\tlastY = points[0][1],\n\t\t\t\tcanvasPos = findPos(canvas, null);\n\n\t\t\tfor (var i = 0; i \u003c points.length; i++) {\n\t\t\t\tvar x = points[i][0],\n\t\t\t\t\ty = points[i][1];\n\t\t\t\tbrush.strokeStart(lastX, lastY);\n\t\t\t\tbrush.stroke(x, y);\n\t\t\t\tlastX = x; \n\t\t\t\tlastY = y;\n\t\t\t}\n\t\t\tbrush.strokeEnd();\n\t\t}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimschubert%2Fbrushes.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimschubert%2Fbrushes.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimschubert%2Fbrushes.js/lists"}