Giter VIP home page Giter VIP logo

webbookcomua / canvas-designer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from muaz-khan/canvas-designer

0.0 2.0 0.0 196 KB

"Collaborative" Canvas Designer i.e. Canvas-Drawing tool allows you draw bezier/quadratic curves, rectangles, circles and lines. You can also set strokes, back/forth colors and much more. All drawings are synced among all connected users using WebRTC/RTCMultiConnection.

Home Page: https://www.webrtc-experiment.com/Canvas-Designer/

HTML 24.76% CSS 6.12% JavaScript 69.12%

canvas-designer's Introduction

"Collaborative" Canvas Designer i.e. Canvas-Drawing tool allows you draw bezier/quadratic curves, rectangles, circles and lines. You can also set strokes, back/forth colors and much more. You can draw using pencils, erase drawing, type texts etc.

This speciality of this drawing-tool is that, it generates Canvas2D code for you; so simply draw and get the code!

Also, you can collaborate your drawing with up to 15 users; and everything is synced from all users. So, if you draw a line and your friend-A draws quadratic curve and friend-B draws rectangle then everything will be synced among all users!

How to Use

  1. Take all code from this link and upload somewhere on your site.
  2. Target directly will be having this file: canvas-designer-widget.js. Link this file in your HTML/PHP page.
  3. Use this command to append widget in your HTML page:
        <code>CanvasDesigner.appendTo(document.documentElement);</code>
    </li>
    

Complete Usage

websocket.onmessage = function(event) {
    CanvasDesigner.syncData( JSON.parse(event.data) );
};

CanvasDesigner.addSyncListener(function(data) {
    websocket.send(JSON.stringify(data));
});

CanvasDesigner.setSelected('pencil');

CanvasDesigner.setTools({
    pencil: true,
    text: true
});

CanvasDesigner.appendTo(document.documentElement);

It is having CanvasDesigner.destroy() method as well.

Use WebRTC!

webrtc.onmessage = function(event) {
    CanvasDesigner.syncData( event.data );
};

CanvasDesigner.addSyncListener(function(data) {
    webrtc.send(data);
});

Use Socket.io

socket.on('message', function(data) {
    CanvasDesigner.syncData( data );
});

CanvasDesigner.addSyncListener(function(data) {
    socket.emit('message', data);
});

Links

  1. https://www.webrtc-experiment.com/Canvas-Designer/
  2. https://github.com/muaz-khan/Canvas-Designer
  3. https://canvas-designer.appspot.com/

Original source-code was shared 2-years back, here: https://github.com/muaz-khan/Everything/tree/gh-pages/Canvas/Tools/Designer

There is a similar "tinny" tool, however it isn't yet supporting collaboration: https://canvature.appspot.com/

And WebRTC-Experiments! https://github.com/muaz-khan/WebRTC-Experiment

License

Canvas Designer is released under MIT licence . Copyright (c) Muaz Khan.

canvas-designer's People

Contributors

muaz-khan avatar

Watchers

James Cloos avatar  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.