new LibCanvas . Canvas2D ($( 'canvas' ))
. setFps ( 50 ) // ,
. fpsMeter ( 20 ) // . N , fps
. setConfig ({
background : '#EFEBE7' , //
images : App . imagesList , // -
progressBar : App . progressBarStyle // -
})
. addElement (new App . MyFirstElement ()) //
. addElement (new App . SecondElement ()) // .draw()
. start (); // -,
ctx . drawImage ( image , 15 , 16 , 12 , 34 , 56 , 12 , 32 , 45 );
$( 'canvas' ). getContext ( '2d-libcanvas' )
./js/Libs/LibCanvas/Core/Context2D.js
:
LibCanvas . addCanvasContext ( '2d-libcanvas' , LibCanvas . Context2D );
$( 'canvas' ). getOriginalContext ( '2d' );
ctx . drawImage ({
image : images [ 'ufo' ],
crop : {
from : [ 40 , 80 ],
to : [ 120 , 160 ]
},
draw : {
from : [ 80 , 80 ]
size : [ 160 , 160 ]
}
})
ctx . fillAll ( 'green' ) //
. set ( 'strokeStyle' , 'red' )
. stroke (new CanvasLib . Shapes . Polygon ([
[ 231 , 67 ],
[ 281 , 67 ],
[ 317 , 103 ],
[ 317 , 153 ],
[ 281 , 189 ],
[ 231 , 189 ],
[ 195 , 153 ],
[ 195 , 103 ]
])) //
. arc ({
circle : [ 100 , 60 , 40 ], // 100:60, 40
angle : [( 5 ). degree (), ( 35 ). degree ()] // c 5 35
})
Number . degree ()
Number . degree ()
returns the sane number of degrees that was in Number, but in radians that the technique likes more.
CanvasLib . Shapes .*
CanvasLib . Shapes .*
Builds almost half the capabilities of the framework. At the moment there are only three figures - Polygon, Circle, Rectangle, but over time the number will increase, for example, a RoundedRectangle will be added, maybe something else. Naturally, you can create your own figures. But the important thing here is the implementation of the correct algorithm for determining whether a certain point is within this figure or not. CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
Search CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); // , bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
CanvasLib . Shapes .* 26 .
. - , html. , , mouseover , html-. . :
this . canvas . mouse . subscribe ( this );
event c . : [click, mouseover, mousemove, mouseout, mouseup, mousedown], [away:mouseover, away:mousemove, away:mouseout, away:mouseup, away:mousedown] , . , , ( getShape
) hasDot
. , , Circle "" .
, LibCanvas . InterfaceElement
, , , :
elem . drawStandart (); //
elem . drawHover (); //
elem . drawActive (); //
, bind' unbind' ( ), GUI.
, - ./js/App/* ./js/Start.js. - . , , !
- EventsTester. . - . , , .
- LibCanvas . InterfaceElement
, . elem . bind ( 'click' , fn );
, . , , , JQueryUI. - )
1. ( , setTransform). ,
2.
3. . , -
greedykid , nutochka , (, , Miss IT ) . .
- LGPL, , : code.google.com/p/libcanvas
Source: https://habr.com/ru/post/90339/