This chapter is the basic common API for learning Easeljs.
First download the Createjs library and create a new JS folder inside the project file.
http://code.createjs.com/
Various shapes
var sp = new Createjs. Shape (); SP.GRAPHICS.F ("Red"). DC (100,100,80);//Draw round//sp.graphics.beginfill ("Red"). Drawcircle (100,100,80); SP.GRAPHICS.F ("Red"). Dr (200,10,300,180);//Block//sp.graphics.beginfill ("Red"). DrawRect (200,10,300,180); SP.GRAPHICS.S ("Blue"). SS (5). MT (0,200). LT (1000,200). ES ();//Line SP.GRAPHICS.F ("Red"). RR (10,250,100,110,15);// Rounded Rectangle sp.graphics.f ("red"). De (120,250,100,110,15);//Ellipse sp.graphics.f ("Red"). DP (240, 250, 40, 5, 0.6,-90);//Star Var img= New Image (); Img.src= "Http://www.airmn.com/blog/wp-content/uploads/2014/08/jinbi.jpg"; Img.onload=function () { //alert ("imgloadok!!") Sp.graphics.beginBitmapFill (IMG); Sp.graphics.drawCircle (400,300,100); Sp.shadow = new Createjs. Shadow ("#B1820C", 0,0,20); Stage.update (); } Stage.addchild (SP);
Comprehensive Exercises:
<!doctype html>The operation of the graphics can be abbreviated
| Tiny |
Method |
Tiny |
Method |
| Mt |
MoveTo |
Lt |
LineTo |
| A/at |
Arc/arcto |
Bt |
Beziercurveto |
| Qt |
Quadraticcurveto (also CurveTo) |
R |
Rect |
| Cp |
Closepath |
C |
Clear |
| F |
Beginfill |
Lf |
Beginlineargradientfill |
| Rf |
Beginradialgradientfill |
Bf |
Beginbitmapfill |
| Ef |
EndFill |
Ss |
Setstrokestyle |
| S |
Beginstroke |
Ls |
Beginlineargradientstroke |
| Rs |
Beginradialgradientstroke |
Bs |
Beginbitmapstroke |
| Es |
Endstroke |
Dr |
DrawRect |
| Rr |
Drawroundrect |
Rc |
Drawroundrectcomplex |
| dc |
Drawcircle |
De |
DrawEllipse |
| Dp |
Drawpolystar |
P |
Decodepath |
Sp.graphics.beginLinearGradientFill (["Rgba (254,241,103,0.5)", "Rgba (227,144,2,0.5)"],[0,1],hw,hh-40,hw,hh+40). Drawcircle (hw,hh,80); equals Sp.graphics.lf (["Rgba (254,241,103,0.5)", "Rgba (227,144,2,0.5)"],[0,1],hw,hh-40,hw,hh+40) . DC (HW,HH,80);
Createjs 1th Chapter Easeljs Foundation (Drawing)