All Projects → rough-stuff → Rough

rough-stuff / Rough

Licence: mit
Create graphics with a hand-drawn, sketchy, appearance

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Rough

Pts
A library for visualization and creative-coding
Stars: ✭ 4,628 (-71.9%)
Mutual labels:  graphics, svg, canvas
Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (-99.08%)
Mutual labels:  graphics, svg, canvas
Svgo
Go Language Library for SVG generation
Stars: ✭ 1,779 (-89.2%)
Mutual labels:  graphics, svg, svg-path
awesome-canvas
Canvas资源库大全中文版。An awesome Canvas packages and resources.
Stars: ✭ 288 (-98.25%)
Mutual labels:  canvas, html5-canvas, draw
Picasso
Picasso is a high quality 2D vector graphic rendering library. It support path , matrix , gradient , pattern , image and truetype font.
Stars: ✭ 205 (-98.76%)
Mutual labels:  graphics, svg, canvas
G2
📊 A highly interactive data-driven visualization grammar for statistical charts.
Stars: ✭ 11,020 (-33.1%)
Mutual labels:  graphics, svg, canvas
Plutovg
Tiny 2D vector graphics library in C
Stars: ✭ 141 (-99.14%)
Mutual labels:  graphics, svg, canvas
Cax
HTML5 Canvas 2D Rendering Engine - 小程序、小游戏以及 Web 通用 Canvas 渲染引擎
Stars: ✭ 1,864 (-88.68%)
Mutual labels:  svg, canvas
Mesh.js
A graphics system born for visualization 😘.
Stars: ✭ 156 (-99.05%)
Mutual labels:  graphics, canvas
Picasso.js
A charting library streamlined for building interactive visualizations for the Qlik product suites.
Stars: ✭ 175 (-98.94%)
Mutual labels:  svg, canvas
Ribbon.js
🎀 Only 1kb javascript gist to generate a ribbon in your website with HTML5 canvas.
Stars: ✭ 189 (-98.85%)
Mutual labels:  html5-canvas, canvas
Vue Tree Chart
flexible tree chart using Canvas and Svg, powered by D3.js
Stars: ✭ 149 (-99.1%)
Mutual labels:  svg, canvas
Aachartkit Swift
📈📊📱💻🖥️An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的跨平台数据可视化图表框架,支持柱状图、条形图、…
Stars: ✭ 1,962 (-88.09%)
Mutual labels:  graphics, draw
Oshmi
SCADA HMI for substations and automation applications.
Stars: ✭ 180 (-98.91%)
Mutual labels:  graphics, svg
Gown.js
UI system for pixi.js inspired by feathers-ui
Stars: ✭ 195 (-98.82%)
Mutual labels:  html5-canvas, canvas
Gerbolyze
Render high-resolution bitmap images to PCB gerber files
Stars: ✭ 169 (-98.97%)
Mutual labels:  graphics, svg
Gantt
Gantt chart library using jsx support SVG, Canvas and SSR
Stars: ✭ 148 (-99.1%)
Mutual labels:  svg, canvas
Aseprite
Animated sprite editor & pixel art tool (Windows, macOS, Linux)
Stars: ✭ 14,832 (-9.96%)
Mutual labels:  graphics, draw
One Html Page Challenge
Can you create something cool without modern tools?
Stars: ✭ 205 (-98.76%)
Mutual labels:  html5-canvas, canvas
Pixieditor
PixiEditor is a lightweight pixel art editor made with .NET 5
Stars: ✭ 210 (-98.73%)
Mutual labels:  graphics, draw

Rough.js

Rough.js is a small (<9 kB) graphics library that lets you draw in a sketchy, hand-drawn-like, style. The library defines primitives to draw lines, curves, arcs, polygons, circles, and ellipses. It also supports drawing SVG paths.

Rough.js works with both Canvas and SVG.

Rough.js sample

@RoughLib on Twitter.

Install

from npm:

npm install --save roughjs

Or get the latest using unpkg: https://unpkg.com/roughjs@latest/bundled/rough.js

If you are looking for bundled version in different formats, the npm package will have these in the following locations:

CommonJS: roughjs/bundled/rough.cjs.js

ESM: roughjs/bundled/rough.esm.js

Browser IIFE: roughjs/bundled/rough.js

Usage

Rough.js rectangle

const rc = rough.canvas(document.getElementById('canvas'));
rc.rectangle(10, 10, 200, 200); // x, y, width, height

or SVG

const rc = rough.svg(svg);
let node = rc.rectangle(10, 10, 200, 200); // x, y, width, height
svg.appendChild(node);

Lines and Ellipses

Rough.js rectangle

rc.circle(80, 120, 50); // centerX, centerY, diameter
rc.ellipse(300, 100, 150, 80); // centerX, centerY, width, height
rc.line(80, 120, 300, 100); // x1, y1, x2, y2

Filling

Rough.js rectangle

rc.circle(50, 50, 80, { fill: 'red' }); // fill with red hachure
rc.rectangle(120, 15, 80, 80, { fill: 'red' });
rc.circle(50, 150, 80, {
  fill: "rgb(10,150,10)",
  fillWeight: 3 // thicker lines for hachure
});
rc.rectangle(220, 15, 80, 80, {
  fill: 'red',
  hachureAngle: 60, // angle of hachure,
  hachureGap: 8
});
rc.rectangle(120, 105, 80, 80, {
  fill: 'rgba(255,0,200,0.2)',
  fillStyle: 'solid' // solid fill
});

Fill styles can be: hachure(default), solid, zigzag, cross-hatch, dots, dashed, or zigzag-line

Rough.js fill examples

Sketching style

Rough.js rectangle

rc.rectangle(15, 15, 80, 80, { roughness: 0.5, fill: 'red' });
rc.rectangle(120, 15, 80, 80, { roughness: 2.8, fill: 'blue' });
rc.rectangle(220, 15, 80, 80, { bowing: 6, stroke: 'green', strokeWidth: 3 });

SVG Paths

Rough.js paths

rc.path('M80 80 A 45 45, 0, 0, 0, 125 125 L 125 80 Z', { fill: 'green' });
rc.path('M230 80 A 45 45, 0, 1, 0, 275 125 L 275 80 Z', { fill: 'purple' });
rc.path('M80 230 A 45 45, 0, 0, 1, 125 275 L 125 230 Z', { fill: 'red' });
rc.path('M230 230 A 45 45, 0, 1, 1, 275 275 L 275 230 Z', { fill: 'blue' });

SVG Path with simplification:

Rough.js texas map Rough.js texas map

Examples

Rough.js US map

View examples here

API & Documentation

Full Rough.js API

Credits

Some of the core algorithms were adapted from handy processing lib.

Algorithm to convert SVG arcs to Canvas described here was adapted from Mozilla codebase

Contributors

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

MIT License (c) Preet Shihn

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].