// 发球动作 // 共有18个动作 cc.Class({ extends: cc.Component, properties: { loc: 0, // 代表方向,0为正位,1为反位 }, // LIFE-CYCLE CALLBACKS: onLoad () { // 配置绘制的数据 // 从配置中心获取数据 this.config = require ("gameconfig") // 配置绘制组件 this.g = this.getComponent(cc.Graphics); // 配置方向 if (this.loc == 0) { this.dir = 1; } else { this.dir = -1; } this.index = 1; }, // start () {}, // update (dt) {}, serve:function() { this.schedule(this.serveUpdate, 0.1); // this.serve_014(); }, // 停止 stop:function() { this.index = 1; this.unschedule(this.serveUpdate); }, // 发球的定时器 serveUpdate:function(delay) { if (this.index > 19) { this.index = 1; } this.g.clear(); if (this.index == 1) { this.serve_001(); if (this.actionStart != null) { this.actionStart(); } } else if (this.index == 2) { this.serve_002(); } else if (this.index == 3) { this.serve_003(); } else if (this.index == 4) { this.serve_004(); } else if (this.index == 5) { this.serve_005(); } else if (this.index == 6) { this.serve_006(); } else if (this.index == 7) { this.serve_007(); } else if (this.index == 8) { this.serve_008(); } else if (this.index == 9) { this.serve_009(); } else if (this.index == 10) { this.serve_010(); } else if (this.index == 11) { this.serve_011(); } else if (this.index == 12) { this.serve_012(); } else if (this.index == 13) { this.serve_013(); } else if (this.index == 14) { this.serve_014(); } else if (this.index == 15) { this.serve_015(); } else if (this.index == 16) { this.serve_016(); } else if (this.index == 17) { this.serve_017(); } else if (this.index == 18) { this.serve_018(); } else if (this.index == 19) { this.serve_019(); if (this.actionEnd != null) { this.unschedule(this.serveUpdate); this.actionEnd(); } } this.index++; }, // 一下全是画动作 serve_001:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); // this.g.ellipse(18, 116, 15, 5); this.g.arc(14, 112, this.config.HEAD_SIZE + 2, Math.PI / 2 + Math.PI / 12, Math.PI * 1.5 + Math.PI / 12, true); this.g.lineTo(29, 107.5); this.g.arc(27, 113, this.config.HEAD_SIZE + 2, Math.PI * 1.5 + Math.PI / 12, Math.PI / 2 + Math.PI / 12, true); this.g.lineTo(11, 118); // this.g.close(); // this.g.stroke(); // this.g.fill(); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(29, 87, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(15, 93); var handEnd = cc.v2(handStart.x - 19, handStart.y - 41); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 13, handStart.y - 50, handEnd.x, handEnd.y); this.g.stroke(); // 画个球 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 2, handEnd.y + 4, 4); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(39, 98); var handEnd = cc.v2(handStart.x + 41, handStart.y - 31); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 30, handStart.y + 15, handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(19, 78); var trousersEnd = cc.v2(41, 76); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(18, 75); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, -3, 55, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x - 10, legEnd.y); this.g.stroke(); legStart = cc.v2(33, 75); legEnd = cc.v2(64, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 20, legStart.y - 5, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 10, legEnd.y); this.g.stroke(); }, serve_002:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); // this.g.ellipse(18, 116, 15, 5); this.g.arc(27, 113, this.config.HEAD_SIZE + 2, Math.PI / 2 - Math.PI / 8, Math.PI * 1.5 - Math.PI / 8, true); this.g.lineTo(48, 97); this.g.arc(49, 103, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true); this.g.lineTo(28, 119); // // this.g.close(); // // this.g.stroke(); // // this.g.fill(); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(51, 76, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(38, 82); var handEnd = cc.v2(handStart.x - 36, handStart.y - 23); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 30, handStart.y - 30, handEnd.x, handEnd.y); this.g.stroke(); // 画个球 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 1, handEnd.y + 4, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(61, 86); var handEnd = cc.v2(handStart.x + 9, handStart.y - 27); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 60, handStart.y - 11, handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(38, 67); var trousersEnd = cc.v2(61, 67); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(40, 63); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, -5, 60, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x - 6, legEnd.y); this.g.stroke(); legStart = cc.v2(57, 65); legEnd = cc.v2(60, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 55, legStart.y - 35, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_003:function() { // 画脑袋和身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; // 画个脑袋 this.g.fillColor.fromHEX('#ffffff'); this.g.circle(54, 105, this.config.HEAD_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(45, 81, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(30, 82); var handEnd = cc.v2(handStart.x - 24, handStart.y - 18); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 20, handStart.y - 25, handEnd.x, handEnd.y); this.g.stroke(); // 画个球 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 1, handEnd.y + 4, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(57, 90); var handEnd = cc.v2(handStart.x - 31, handStart.y + 10); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 45, handStart.y - 45, handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(32, 71); var trousersEnd = cc.v2(56, 73); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(41, 68); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, 0, 60, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x - 6, legEnd.y); this.g.stroke(); legStart = cc.v2(54, 69); legEnd = cc.v2(61, 2) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 50, legStart.y - 30, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_004:function() { this.serve_003(); }, serve_004:function() { this.serve_003(); }, serve_005:function() { this.serve_003(); }, serve_006:function() { this.serve_003(); }, serve_007:function() { this.serve_003(); }, serve_008:function() { this.serve_003(); }, serve_009:function() { this.serve_003(); }, serve_010:function() { this.serve_003(); }, serve_011:function() { this.serve_003(); }, serve_012:function() { this.serve_003(); }, serve_013:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); // this.g.ellipse(18, 116, 15, 5); this.g.arc(1, 112, this.config.HEAD_SIZE + 2, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, true); this.g.lineTo(12, 105); this.g.arc(13, 111, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - Math.PI / 12, Math.PI / 2 - Math.PI / 12, true); this.g.lineTo(2, 118); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(21, 81, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(9, 89); var handEnd = cc.v2(handStart.x - 52, handStart.y + 7); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 30, handStart.y + 28, handEnd.x, handEnd.y); this.g.stroke(); // 画个球拍 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.arc(-41, 105, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 12, 0 - Math.PI / 12, false); this.g.bezierCurveTo(-37, 104, -47, 80, -24, 53); this.g.arc(-28, 51, this.config.BAT_SIZE + 2, 0 + Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, false); this.g.bezierCurveTo(-30, 46, -60, 75, -45, 106); // this.g.close(); this.g.stroke(); // this.g.fill(); // 画手臂 var handStart = cc.v2(35, 84); var handEnd = cc.v2(76, 61); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 58, 55, handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(11, 73); var trousersEnd = cc.v2(33, 73); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(12, 70); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, -15, 60, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x - 10, legEnd.y); this.g.stroke(); legStart = cc.v2(31, 69); legEnd = cc.v2(64, 2) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 20, legStart.y - 10, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 10, legEnd.y); this.g.stroke(); }, serve_014:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; // 画手臂 var handStart = cc.v2(32, 89); var handEnd = cc.v2(39, 139); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 10, 125, handEnd.x, handEnd.y); this.g.stroke(); this.g.fillColor.fromHEX('#ffffff'); this.g.arc(27, 109, this.config.HEAD_SIZE, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, true); this.g.lineTo(45, 102); this.g.arc(45, 106, this.config.HEAD_SIZE, Math.PI * 1.5 - Math.PI / 12, Math.PI / 2 - Math.PI / 12, true); this.g.lineTo(27, 113); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(41, 82, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画个球拍 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.arc(-32, 124, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 4, Math.PI * 1.5 + Math.PI / 8, true); this.g.bezierCurveTo(-31, 123, 0, 155, 40, 134); this.g.arc(42, 138, this.config.BAT_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 + Math.PI / 8, true); this.g.bezierCurveTo(45, 142, 0, 162, -37, 128); // // this.g.close(); this.g.stroke(); // 画手臂 var handStart = cc.v2(52, 72); var handEnd = cc.v2(53, 25); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 45, 55, handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(29, 78); var trousersEnd = cc.v2(51, 69); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(32, 71); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, 10, 38, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x - 6, legEnd.y); this.g.stroke(); legStart = cc.v2(43, 67); legEnd = cc.v2(64, 2); this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, 62, 55, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_015:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); // this.g.ellipse(18, 116, 15, 5); this.g.arc(53, 104, this.config.HEAD_SIZE + 1, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 8, true); this.g.lineTo(65, 96); this.g.arc(66, 101, this.config.HEAD_SIZE + 1, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true); this.g.lineTo(49, 110);; // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(54, 78, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(45, 89); var handEnd = cc.v2(70, 135); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 20, 128, handEnd.x, handEnd.y); this.g.stroke(); // 画个球 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 1, handEnd.y - 5, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(55, 63); var handEnd = cc.v2(56, 30); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 40, 40, handEnd.x, handEnd.y); // this.g.lineTo(handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(41, 73); var trousersEnd = cc.v2(63, 66); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(44, 67); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, 30, 52, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x - 6, legEnd.y); this.g.stroke(); legStart = cc.v2(57, 64); legEnd = cc.v2(63, 1) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 40, legStart.y - 15, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_016:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); // this.g.ellipse(18, 116, 15, 5); this.g.arc(70, 101, this.config.HEAD_SIZE + 1, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 8, true); this.g.lineTo(76, 92); this.g.arc(77, 97, this.config.HEAD_SIZE + 1, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true); this.g.lineTo(71, 105);; // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(64, 75, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(60, 90); var handEnd = cc.v2(102, 107); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 63, 140, handEnd.x, handEnd.y); this.g.stroke(); // 画个球 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 4, handEnd.y - 5, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(64, 60); var handEnd = cc.v2(60, 33); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 50, 40, handEnd.x, handEnd.y); // this.g.lineTo(handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(50, 73); var trousersEnd = cc.v2(70, 60); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(52, 64); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.lineTo(legEnd.x, legEnd.y); this.g.stroke(); legStart = cc.v2(68, 60); legEnd = cc.v2(63, 1) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_017:function() { // 画脑袋 this.g.lineWidth = this.config.CIRCLE_WIDTH; // 画个脑袋 this.g.fillColor.fromHEX('#ffffff'); this.g.circle(84, 92, this.config.HEAD_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(66, 73, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(67, 88); var handEnd = cc.v2(105, 90); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 94, 125, handEnd.x, handEnd.y); this.g.stroke(); // 画个球拍 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 4, handEnd.y - 5, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(68, 59); var handEnd = cc.v2(60, 33); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 50, 40, handEnd.x, handEnd.y); // this.g.lineTo(handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(51, 72); var trousersEnd = cc.v2(70, 60); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(53, 66); var legEnd = cc.v2(0, 0) this.g.moveTo(legStart.x, legStart.y); this.g.lineTo(legEnd.x, legEnd.y); this.g.stroke(); legStart = cc.v2(68, 57); legEnd = cc.v2(63, 1) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_018:function() { // 画脑袋 this.g.lineWidth = this.config.CIRCLE_WIDTH; // 画个脑袋 this.g.fillColor.fromHEX('#ffffff'); this.g.circle(60, 86, this.config.HEAD_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(43, 66, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(37, 78); var handEnd = cc.v2(62, 110); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 20, 120, handEnd.x, handEnd.y); this.g.stroke(); // 画个球拍 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x - 4, handEnd.y - 5, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(56, 61); var handEnd = cc.v2(80, 25); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 70, 32, handEnd.x, handEnd.y); // this.g.lineTo(handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(28, 61); var trousersEnd = cc.v2(53, 55); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(33, 54); var legEnd = cc.v2(6, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, -15, 52, legEnd.x, legEnd.y); this.g.lineTo(0, 0); this.g.stroke(); legStart = cc.v2(51, 52); legEnd = cc.v2(68, 1) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, serve_019:function() { // 画脑袋 this.g.lineWidth = this.config.LINE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); // this.g.ellipse(18, 116, 15, 5); this.g.arc(37, 104, this.config.HEAD_SIZE + 2, Math.PI / 2 - Math.PI / 8, Math.PI * 1.5 - Math.PI / 8, true); this.g.lineTo(44, 96); this.g.arc(46, 101, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true); this.g.lineTo(38, 110); // // this.g.close(); // // this.g.stroke(); // // this.g.fill(); // 画个身体 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(32, 78, this.config.BODY_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(23, 88); var handEnd = cc.v2(-12, 127); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, -23, 95, handEnd.x, handEnd.y); this.g.stroke(); // 画个球拍 this.g.lineWidth = this.config.CIRCLE_WIDTH; this.g.fillColor.fromHEX('#ffffff'); this.g.circle(handEnd.x + 5, handEnd.y - 1, this.config.BAT_SIZE); this.g.close(); this.g.stroke(); this.g.fill(); // 画手臂 var handStart = cc.v2(46, 81); var handEnd = cc.v2(76, 49); this.g.lineWidth = this.config.LINE_WIDTH; this.g.moveTo(handStart.x, handStart.y); this.g.bezierCurveTo(handStart.x, handStart.y, 75, 82, handEnd.x, handEnd.y); // this.g.lineTo(handEnd.x, handEnd.y); this.g.stroke(); // 画裤子 var trousersStart = cc.v2(19, 71); var trousersEnd = cc.v2(42, 67); this.g.moveTo(trousersStart.x, trousersStart.y); this.g.lineTo(trousersEnd.x, trousersEnd.y); this.g.stroke(); // 画腿 var legStart = cc.v2(22, 66); var legEnd = cc.v2(6, 0) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, -10, 52, legEnd.x, legEnd.y); this.g.lineTo(0, 0); this.g.stroke(); legStart = cc.v2(38, 64); legEnd = cc.v2(68, 1) this.g.moveTo(legStart.x, legStart.y); this.g.bezierCurveTo(legStart.x, legStart.y, 65, 55, legEnd.x, legEnd.y); this.g.lineTo(legEnd.x + 6, legEnd.y); this.g.stroke(); }, });