开发者

Is there a Javascript library for Paint-like applications using canvas? [closed]

开发者 https://www.devze.com 2023-03-29 07:05 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

开发者_如何学Python

Closed 2 years ago.

Improve this question

Is there a Javascript library which has built-in features for quickly creating a Paint-like web application using the canvas element?

EDIT: So, far, I have found Javascript libraries that allow easy animation of canvas elements -- such as Raphael JS -- and Javascript tutorials for creating simple Paint apps, but no robust libraries for Paint-like applications.

EDIT 2: I found a Javascript tutorial on a pretty nice looking Paint app using the canvas element. I'd still like to see what others have found.


Raphaël

Raphaël doesn't use Canvas. It uses SVG on browsers that support it or VML on Internet Explorer.

SVG

If you want an SVG solution designed specifically for drawing then take a look at:

  • SVG-edit

See this demo.

Canvas

If you want to use Canvas but you need a retained mode rendering then see:

  • Fabric.js
  • Paper.js
  • Processing.js
  • EaselJS
  • KineticJS
  • bHive

Update (February 2014)

  • ART, a retained mode vector drawing API - targets all three of HTML5 Canvas, SVG and VML (plus some code generation). Used by the Facebook team together with the React UI toolkit (see: react-art and the "art" branch of the react-page project on GitHub).


Literally Canvas fits this exact purpose: http://literallycanvas.com

"Literally Canvas is an extensible, open source (BSD-licensed), HTML5 drawing widget...You can use it to embed drawing boards in web pages."


There is processingJS, but as it is port of the JAVA bassed processing you write your code in "javaish" processing language. But after all you could create what an paint like app. Another framework is fabricJS which is also really great to work with canvas.


There is an npm package spainter. Click on Run code snippet bellow and go fullscreen

var p = new Painter(containerPainter);</script>
<script src="https://cdn.jsdelivr.net/npm/spainter@1.0.0/index.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/spainter@1.0.1/index.css"/>
<div id="containerPainter"></div>

or via webpack (or any other loader):

npm i spainter lines-logger

in your js:

import Painter from 'spainter';
import 'spainter/index.sass'; // you can impor index.css if you don't have sass, ensure that you copy the fonts from the directory as well to production. Set `$FontelloPath: "../node_modules/spainter/font"`
import {LoggerFactory} from 'lines-logger';
const containerPainter = document.createElement('div');
document.body.appendChild(containerPainter);
const p = new Painter(containerPainter, {logger: new LoggerFactory().getLoggerColor('spainter', 'blue')});

Live Demo


You can try Painterro. It can be used for pasting and processing screenshots, cropping, drawing primitives and text, rotating, resizing (changing resolution), scaling, drawing arrows, exporting with desired compression level, supports hotkeys

Live Demo

Is there a Javascript library for Paint-like applications using canvas? [closed]

Painterro has a browser-script version and npm package

Could be easily integrated with any SPA like Vue/React, works well in electron/cordova,

Disclosure: I am a founder of Painterro


I think the closest you'll get is to expand on what that tutorial has gone through.

It's hard to create "general purpose" paint-like functionality due to the wide range of requirements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号