GithubHelp home page GithubHelp logo

darknoon / brushtips Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 3.0 50 KB

Simple example of brush drawing in WebGL & typescript

License: MIT License

CSS 6.99% HTML 2.75% TypeScript 90.26%
typescript webgl brush graphics

brushtips's Introduction

This is an experiment with brush drawing in WebGL, with code written in typescript. I am curious what features are needed for a good drawing experince.

View live: http://brush.tips

Features:

  • Accepts input at > screen refresh
  • Catmull-rom interpolation
  • Input distance filtering
  • Output distance filtering (only draw if moved x pixels)
  • Variable sharpness
  • Draw whole stroke or incrementally

Missing features:

  • Support mobile devices with touch APIs
  • Efficiency: write points to vertex buffer, then emit a single drawcall
  • Variable brush diameter with velocity
  • Other brush dynamics
  • Smoothing of input points during a stroke
  • Draw last stroke segment dynamically (see Notes.app on iOS)
  • Dithering
  • Texture

Feel free to adapt this for your own use. It may be published on NPM at some point to make that more convenient.

Original experiments https://codepen.io/darknoon/pen/QMNxQq) https://codepen.io/darknoon/pen/GvowNQ

The original code was written in 2017 in React. To apply to the Recurse Center, I needed code written without a framework, so I converted this to plain typescript.

How to run locally:

$ tsc -w
# In another terminal
$ now dev
# or your favorite static site server

How to deploy:

$ now

brushtips's People

Contributors

darknoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.