]>
git.r.bdr.sh - rbdr/sumo/blob - lib/factories/pixi.js
1 import { Graphics
} from 'pixi.js';
4 * Factory object that contains many methods to create prefab pixi
13 * Creates a sumo container
15 * @function createSumo
16 * @memberof PixiFactory
17 * @return {external:CreateJs.Container} the created container
24 const body
= new Graphics();
25 body
.beginFill(0x87c5ea)
26 .drawCircle(0, 0, radius
)
30 const mouth
= new Graphics();
31 mouth
.lineStyle(10, 0xff0080, 1)
39 const leftEye
= new Graphics();
40 leftEye
.beginFill(0xffffff)
41 .drawCircle(-radius
/ 3 - radius
/ 8, -radius
/ 4, radius
/ 5)
44 const rightEye
= new Graphics();
45 rightEye
.beginFill(0xffffff)
46 .drawCircle(radius
/ 3 + radius
/ 8, -radius
/ 4, radius
/ 5);
48 const leftPupil
= new Graphics();
49 leftPupil
.beginFill(0x11)
50 .drawCircle(-radius
/ 3 - radius
/ 8, -radius
/ 4, radius
/ 10);
52 const rightPupil
= new Graphics();
53 leftPupil
.beginFill(0x11)
54 .drawCircle(radius
/ 3 + radius
/ 8, -radius
/ 4, radius
/ 10);
58 body
.addChild(leftEye
);
59 body
.addChild(rightEye
);
60 body
.addChild(leftPupil
);
61 body
.addChild(rightPupil
);