Coder Social home page Coder Social logo

easycanvas's Introduction

easycanvas

Quick start

Documentation: gaidadei.ru/easycanvas
Download: gaidadei.ru/easycanvas/easyc.zip

Buy premium: gaidadei.ru/easycanvas/premium (Absolutely no different from the free version, but you have the right to change the file name to "easyc.premium.js")

Download the file easyc.js and use this code:

<canvas id="canvas"></canvas>

<script src="easyc.js"></script>

<script>
  var canvas = document.getElementById("canvas");

  var sheet = new EasyC(canvas, [{
    type: "circle",
    radius: 50,
    x: 100,
    y: 100,
    fill: "#000"
  }]);
  sheet.draw();
</script>

Very easy way to draw

Just add a simple object and the library will draw it (for example: "circle", "triangle", "rectangle", "shape", "text", "image").

new EasyC(canvas, [
{
  type: "circle",
  x: 100,
  y: 100,
  radius: 50,
  fill: "#999"
}, {
  type: "triangle",
  x: 100,
  y: 100,
  angleLeft: 1.5*Math.PI/4,
  angleRight: 1*Math.PI/4,
  base: 150,
  fill: "#999"
}, {
  type: "rectangle",
  x: 100,
  y: 100,
  width: 100,
  height: 100,
  fill: "#999"
}, {
  type: "shape",
  x: 100,
  y: 100,
  width: 100,
  height: 100,
  corners: [
    [-1, -1],
    [0, -0.5],
    [0.2, -0.7],
    [0.4, -0.1],
    [-0.2, 1],
    [-0.8, 0.4]
  ],
  fill: "#999"
}, {
  type: "text",
  x: 100,
  y: 100,
  value: "Hello, world\nSecond stroke\nThird stroke",
  font: "Arial",
  size: 36,
  align: "left",
  fill: "#999"
}, {
  type: "image",
  x: 280,
  y: 260,
  width: 150,
  src: "2.png",
  scale: [1, 1]
}]).draw();

draw canvas html draw canvas html draw canvas html draw canvas html draw canvas html draw canvas html

You can load images and fonts very easily, just provide the url.

src: "2.png"  
font: "url(ShareTechMono.ttf)"
fill: "url(2.png), 0, 0.2, repeat"

draw canvas html image

Very easy make gradient

fill: "grad(linear, 45, 0 #0000ff, 1, #00ff00)"
fill: "grad(radial, 0, #0000ff, 1, #00ff00)"

gradien canvas html

You can set relative and absolute coordinate object.

relative: false

relative ccord canvas html

relative: true 

relative ccord canvas html

easycanvas's People

Contributors

fakt309 avatar

Stargazers

Nikolay Astakhayev avatar Oleg Korzhanov avatar  avatar Vasiliy Kuzmenko avatar  avatar Antares avatar Pavel avatar Dmitry Zhiharev avatar Andrii Korzh avatar  avatar Psilon avatar Eugene Metagnostic avatar Alexei Accio avatar Vio Cassel avatar Andrey Gershun avatar Michael Jett avatar

Watchers

 avatar Mikhail avatar  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.