arc.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. // Learn cc.Class:
  2. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. loc: 0, // 代表方向,0为正位,1为反位
  14. g: {
  15. default: null,
  16. type: cc.Graphics,
  17. },
  18. index:0,
  19. // 脑袋的宽度
  20. headSize: 0,
  21. // 身体的宽度
  22. bodySize: 0,
  23. // 球拍的宽度
  24. batSize: 2,
  25. // 方向配置
  26. dir: 0,
  27. },
  28. // LIFE-CYCLE CALLBACKS:
  29. onLoad () {
  30. this.headSize = 4;
  31. this.bodySize = 12;
  32. this.batSize = 3;
  33. },
  34. start () {
  35. this.g = this.getComponent(cc.Graphics);
  36. // 配置方向
  37. if (this.loc == 0) {
  38. this.dir = 1;
  39. } else {
  40. this.dir = -1;
  41. }
  42. if (this.index == 0) {
  43. this.idle();
  44. } else if (this.index == 1) {
  45. this.serve_001();
  46. } else if (this.index == 2) {
  47. this.serve_002();
  48. } else if (this.index == 3) {
  49. this.serve_003();
  50. } else if (this.index == 4) {
  51. this.serve_004();
  52. } else if (this.index == 13) {
  53. this.serve_013();
  54. } else if (this.index == 14) {
  55. this.serve_014();
  56. } else if (this.index == 15) {
  57. this.serve_015();
  58. }
  59. },
  60. idle:function() {
  61. // 画脑袋和身体
  62. this.g.lineWidth = 7;
  63. // 画个脑袋
  64. this.g.fillColor.fromHEX('#ffffff');
  65. this.g.circle(-1.5 * this.dir, 110, this.headSize);
  66. this.g.close();
  67. this.g.stroke();
  68. this.g.fill();
  69. // 画个身体
  70. this.g.lineWidth = 7;
  71. this.g.fillColor.fromHEX('#ffffff');
  72. this.g.circle(8 * this.dir, 85, this.bodySize);
  73. this.g.close();
  74. this.g.stroke();
  75. this.g.fill();
  76. // 画手臂
  77. var handStart = cc.v2(-7 * this.dir, 86);
  78. var handEnd = cc.v2(handStart.x - this.dir * 10, handStart.y - 47);
  79. this.g.lineWidth = 3;
  80. this.g.moveTo(handStart.x, handStart.y);
  81. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x, handStart.y - 40, handEnd.x, handEnd.y);
  82. this.g.stroke();
  83. // 画个球
  84. this.g.lineWidth = 7;
  85. this.g.fillColor.fromHEX('#ffffff');
  86. this.g.circle(handEnd.x - this.dir * 3, handEnd.y + 4, this.batSize);
  87. this.g.close();
  88. this.g.stroke();
  89. this.g.fill();
  90. // 画手臂
  91. var handStart = cc.v2(13 * this.dir, 99);
  92. var handEnd = cc.v2(handStart.x + this.dir * 51, handStart.y - 18);
  93. this.g.lineWidth = 3;
  94. this.g.moveTo(handStart.x, handStart.y);
  95. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + this.dir * 27, handStart.y + 10, handEnd.x, handEnd.y);
  96. this.g.stroke();
  97. // 画裤子
  98. var trousersStart = cc.v2(0, 74);
  99. var trousersEnd = cc.v2(22 * this.dir, 79);
  100. this.g.moveTo(trousersStart.x, trousersStart.y);
  101. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  102. this.g.stroke();
  103. // 画腿
  104. var legStart = cc.v2(10 * this.dir, 73);
  105. var legEnd = cc.v2(0, 0)
  106. this.g.moveTo(legStart.x, legStart.y);
  107. this.g.bezierCurveTo(legStart.x, legStart.y, -10 * this.dir, 60, legEnd.x, legEnd.y);
  108. this.g.lineTo(legEnd.x - this.dir * 6, legEnd.y);
  109. this.g.stroke();
  110. legStart = cc.v2(19 * this.dir, 78);
  111. legEnd = cc.v2(62 * this.dir, 0)
  112. this.g.moveTo(legStart.x, legStart.y);
  113. this.g.lineTo(legEnd.x, legEnd.y);
  114. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  115. this.g.stroke();
  116. },
  117. serve_001:function() {
  118. // 画脑袋
  119. this.g.lineWidth = 3;
  120. this.g.fillColor.fromHEX('#ffffff');
  121. // this.g.ellipse(18, 116, 15, 5);
  122. this.g.arc(14, 112, this.headSize + 2, Math.PI / 2 + Math.PI / 12, Math.PI * 1.5 + Math.PI / 12, true);
  123. this.g.lineTo(29, 107.5);
  124. this.g.arc(27, 113, this.headSize + 2, Math.PI * 1.5 + Math.PI / 12, Math.PI / 2 + Math.PI / 12, true);
  125. this.g.lineTo(11, 118);
  126. // this.g.close();
  127. // this.g.stroke();
  128. // this.g.fill();
  129. // 画个身体
  130. this.g.lineWidth = 7;
  131. this.g.fillColor.fromHEX('#ffffff');
  132. this.g.circle(29, 87, this.bodySize);
  133. this.g.close();
  134. this.g.stroke();
  135. this.g.fill();
  136. // 画手臂
  137. var handStart = cc.v2(15, 93);
  138. var handEnd = cc.v2(handStart.x - 19, handStart.y - 41);
  139. this.g.lineWidth = 3;
  140. this.g.moveTo(handStart.x, handStart.y);
  141. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 13, handStart.y - 50, handEnd.x, handEnd.y);
  142. this.g.stroke();
  143. // 画个球
  144. this.g.lineWidth = 7;
  145. this.g.fillColor.fromHEX('#ffffff');
  146. this.g.circle(handEnd.x - 2, handEnd.y + 4, 4);
  147. this.g.close();
  148. this.g.stroke();
  149. this.g.fill();
  150. // 画手臂
  151. var handStart = cc.v2(39, 98);
  152. var handEnd = cc.v2(handStart.x + 41, handStart.y - 31);
  153. this.g.lineWidth = 3;
  154. this.g.moveTo(handStart.x, handStart.y);
  155. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 30, handStart.y + 15, handEnd.x, handEnd.y);
  156. this.g.stroke();
  157. // 画裤子
  158. var trousersStart = cc.v2(19, 78);
  159. var trousersEnd = cc.v2(41, 76);
  160. this.g.moveTo(trousersStart.x, trousersStart.y);
  161. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  162. this.g.stroke();
  163. // 画腿
  164. var legStart = cc.v2(18, 75);
  165. var legEnd = cc.v2(0, 0)
  166. this.g.moveTo(legStart.x, legStart.y);
  167. this.g.bezierCurveTo(legStart.x, legStart.y, -3, 55, legEnd.x, legEnd.y);
  168. this.g.lineTo(legEnd.x - 10, legEnd.y);
  169. this.g.stroke();
  170. legStart = cc.v2(33, 75);
  171. legEnd = cc.v2(64, 0)
  172. this.g.moveTo(legStart.x, legStart.y);
  173. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 20, legStart.y - 5, legEnd.x, legEnd.y);
  174. this.g.lineTo(legEnd.x + 10, legEnd.y);
  175. this.g.stroke();
  176. },
  177. serve_002:function() {
  178. // 画脑袋
  179. this.g.lineWidth = 3;
  180. this.g.fillColor.fromHEX('#ffffff');
  181. // this.g.ellipse(18, 116, 15, 5);
  182. this.g.arc(27, 113, this.headSize + 2, Math.PI / 2 - Math.PI / 8, Math.PI * 1.5 - Math.PI / 8, true);
  183. this.g.lineTo(48, 97);
  184. this.g.arc(49, 103, this.headSize + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  185. this.g.lineTo(28, 119);
  186. // // this.g.close();
  187. // // this.g.stroke();
  188. // // this.g.fill();
  189. // 画个身体
  190. this.g.lineWidth = 7;
  191. this.g.fillColor.fromHEX('#ffffff');
  192. this.g.circle(51, 76, this.bodySize);
  193. this.g.close();
  194. this.g.stroke();
  195. this.g.fill();
  196. // 画手臂
  197. var handStart = cc.v2(38, 82);
  198. var handEnd = cc.v2(handStart.x - 36, handStart.y - 23);
  199. this.g.lineWidth = 3;
  200. this.g.moveTo(handStart.x, handStart.y);
  201. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 30, handStart.y - 30, handEnd.x, handEnd.y);
  202. this.g.stroke();
  203. // 画个球
  204. this.g.lineWidth = 7;
  205. this.g.fillColor.fromHEX('#ffffff');
  206. this.g.circle(handEnd.x - 1, handEnd.y + 4, this.batSize);
  207. this.g.close();
  208. this.g.stroke();
  209. this.g.fill();
  210. // 画手臂
  211. var handStart = cc.v2(61, 86);
  212. var handEnd = cc.v2(handStart.x + 9, handStart.y - 27);
  213. this.g.lineWidth = 3;
  214. this.g.moveTo(handStart.x, handStart.y);
  215. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 60, handStart.y - 11, handEnd.x, handEnd.y);
  216. this.g.stroke();
  217. // 画裤子
  218. var trousersStart = cc.v2(38, 67);
  219. var trousersEnd = cc.v2(61, 67);
  220. this.g.moveTo(trousersStart.x, trousersStart.y);
  221. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  222. this.g.stroke();
  223. // 画腿
  224. var legStart = cc.v2(40, 63);
  225. var legEnd = cc.v2(0, 0)
  226. this.g.moveTo(legStart.x, legStart.y);
  227. this.g.bezierCurveTo(legStart.x, legStart.y, -5, 60, legEnd.x, legEnd.y);
  228. this.g.lineTo(legEnd.x - 6, legEnd.y);
  229. this.g.stroke();
  230. legStart = cc.v2(57, 65);
  231. legEnd = cc.v2(60, 0)
  232. this.g.moveTo(legStart.x, legStart.y);
  233. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 55, legStart.y - 35, legEnd.x, legEnd.y);
  234. this.g.lineTo(legEnd.x + 6, legEnd.y);
  235. this.g.stroke();
  236. },
  237. serve_003:function() {
  238. // 画脑袋和身体
  239. this.g.lineWidth = 7;
  240. // 画个脑袋
  241. this.g.fillColor.fromHEX('#ffffff');
  242. this.g.circle(54, 105, this.headSize);
  243. this.g.close();
  244. this.g.stroke();
  245. this.g.fill();
  246. // 画个身体
  247. this.g.lineWidth = 7;
  248. this.g.fillColor.fromHEX('#ffffff');
  249. this.g.circle(45, 81, this.bodySize);
  250. this.g.close();
  251. this.g.stroke();
  252. this.g.fill();
  253. // 画手臂
  254. var handStart = cc.v2(30, 82);
  255. var handEnd = cc.v2(handStart.x - 24, handStart.y - 18);
  256. this.g.lineWidth = 3;
  257. this.g.moveTo(handStart.x, handStart.y);
  258. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 20, handStart.y - 25, handEnd.x, handEnd.y);
  259. this.g.stroke();
  260. // 画手臂
  261. var handStart = cc.v2(57, 90);
  262. var handEnd = cc.v2(handStart.x - 31, handStart.y + 10);
  263. this.g.lineWidth = 3;
  264. this.g.moveTo(handStart.x, handStart.y);
  265. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 45, handStart.y - 45, handEnd.x, handEnd.y);
  266. this.g.stroke();
  267. // 画裤子
  268. var trousersStart = cc.v2(32, 71);
  269. var trousersEnd = cc.v2(56, 73);
  270. this.g.moveTo(trousersStart.x, trousersStart.y);
  271. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  272. this.g.stroke();
  273. // 画腿
  274. var legStart = cc.v2(41, 68);
  275. var legEnd = cc.v2(0, 0)
  276. this.g.moveTo(legStart.x, legStart.y);
  277. this.g.bezierCurveTo(legStart.x, legStart.y, 0, 60, legEnd.x, legEnd.y);
  278. this.g.lineTo(legEnd.x - 6, legEnd.y);
  279. this.g.stroke();
  280. legStart = cc.v2(54, 69);
  281. legEnd = cc.v2(61, 2)
  282. this.g.moveTo(legStart.x, legStart.y);
  283. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 50, legStart.y - 30, legEnd.x, legEnd.y);
  284. this.g.lineTo(legEnd.x + 6, legEnd.y);
  285. this.g.stroke();
  286. },
  287. serve_004:function() {
  288. this.serve_003();
  289. },
  290. serve_004:function() {
  291. this.serve_003();
  292. },
  293. serve_005:function() {
  294. this.serve_003();
  295. },
  296. serve_006:function() {
  297. this.serve_003();
  298. },
  299. serve_007:function() {
  300. this.serve_003();
  301. },
  302. serve_008:function() {
  303. this.serve_003();
  304. },
  305. serve_009:function() {
  306. this.serve_003();
  307. },
  308. serve_010:function() {
  309. this.serve_003();
  310. },
  311. serve_011:function() {
  312. this.serve_003();
  313. },
  314. serve_012:function() {
  315. this.idle();
  316. },
  317. serve_013:function() {
  318. // 画脑袋
  319. this.g.lineWidth = 3;
  320. this.g.fillColor.fromHEX('#ffffff');
  321. // this.g.ellipse(18, 116, 15, 5);
  322. this.g.arc(1, 112, this.headSize + 2, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, true);
  323. this.g.lineTo(12, 105);
  324. this.g.arc(13, 111, this.headSize + 2, Math.PI * 1.5 - Math.PI / 12, Math.PI / 2 - Math.PI / 12, true);
  325. this.g.lineTo(2, 118);
  326. // 画个身体
  327. this.g.lineWidth = 7;
  328. this.g.fillColor.fromHEX('#ffffff');
  329. this.g.circle(21, 81, this.bodySize);
  330. this.g.close();
  331. this.g.stroke();
  332. this.g.fill();
  333. // 画手臂
  334. var handStart = cc.v2(9, 89);
  335. var handEnd = cc.v2(handStart.x - 52, handStart.y + 7);
  336. this.g.lineWidth = 3;
  337. this.g.moveTo(handStart.x, handStart.y);
  338. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 30, handStart.y + 28, handEnd.x, handEnd.y);
  339. this.g.stroke();
  340. // 画个球拍
  341. this.g.lineWidth = 3;
  342. this.g.fillColor.fromHEX('#ffffff');
  343. this.g.arc(-41, 105, this.batSize + 2, Math.PI - Math.PI / 12, 0 - Math.PI / 12, false);
  344. this.g.bezierCurveTo(-37, 104, -47, 80, -24, 53);
  345. this.g.arc(-28, 51, this.batSize + 2, 0 + Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, false);
  346. this.g.bezierCurveTo(-30, 46, -60, 75, -45, 106);
  347. // this.g.close();
  348. this.g.stroke();
  349. // this.g.fill();
  350. // 画手臂
  351. var handStart = cc.v2(35, 84);
  352. var handEnd = cc.v2(76, 61);
  353. this.g.lineWidth = 3;
  354. this.g.moveTo(handStart.x, handStart.y);
  355. this.g.bezierCurveTo(handStart.x, handStart.y, 58, 55, handEnd.x, handEnd.y);
  356. this.g.stroke();
  357. // 画裤子
  358. var trousersStart = cc.v2(11, 73);
  359. var trousersEnd = cc.v2(33, 73);
  360. this.g.moveTo(trousersStart.x, trousersStart.y);
  361. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  362. this.g.stroke();
  363. // 画腿
  364. var legStart = cc.v2(12, 70);
  365. var legEnd = cc.v2(0, 0)
  366. this.g.moveTo(legStart.x, legStart.y);
  367. this.g.bezierCurveTo(legStart.x, legStart.y, -15, 60, legEnd.x, legEnd.y);
  368. this.g.lineTo(legEnd.x - 10, legEnd.y);
  369. this.g.stroke();
  370. legStart = cc.v2(31, 69);
  371. legEnd = cc.v2(64, 2)
  372. this.g.moveTo(legStart.x, legStart.y);
  373. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 20, legStart.y - 10, legEnd.x, legEnd.y);
  374. this.g.lineTo(legEnd.x + 10, legEnd.y);
  375. this.g.stroke();
  376. },
  377. serve_014:function() {
  378. // 画脑袋
  379. this.g.lineWidth = 3;
  380. this.g.fillColor.fromHEX('#ffffff');
  381. // this.g.ellipse(18, 116, 15, 5);
  382. this.g.arc(53, 104, this.headSize + 1, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 8, true);
  383. this.g.lineTo(65, 96);
  384. this.g.arc(66, 101, this.headSize + 1, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  385. this.g.lineTo(49, 110);;
  386. // 画个身体
  387. this.g.lineWidth = 7;
  388. this.g.fillColor.fromHEX('#ffffff');
  389. this.g.circle(54, 78, this.bodySize);
  390. this.g.close();
  391. this.g.stroke();
  392. this.g.fill();
  393. // 画手臂
  394. var handStart = cc.v2(45, 89);
  395. var handEnd = cc.v2(70, 135);
  396. this.g.lineWidth = 3;
  397. this.g.moveTo(handStart.x, handStart.y);
  398. this.g.bezierCurveTo(handStart.x, handStart.y, 20, 128, handEnd.x, handEnd.y);
  399. this.g.stroke();
  400. // 画个球
  401. this.g.lineWidth = 7;
  402. this.g.fillColor.fromHEX('#ffffff');
  403. this.g.circle(handEnd.x - 1, handEnd.y - 5, this.batSize);
  404. this.g.close();
  405. this.g.stroke();
  406. this.g.fill();
  407. // 画手臂
  408. var handStart = cc.v2(55, 63);
  409. var handEnd = cc.v2(56, 30);
  410. this.g.lineWidth = 3;
  411. this.g.moveTo(handStart.x, handStart.y);
  412. this.g.bezierCurveTo(handStart.x, handStart.y, 40, 40, handEnd.x, handEnd.y);
  413. // this.g.lineTo(handEnd.x, handEnd.y);
  414. this.g.stroke();
  415. // 画裤子
  416. var trousersStart = cc.v2(41, 73);
  417. var trousersEnd = cc.v2(63, 66);
  418. this.g.moveTo(trousersStart.x, trousersStart.y);
  419. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  420. this.g.stroke();
  421. // 画腿
  422. var legStart = cc.v2(44, 67);
  423. var legEnd = cc.v2(0, 0)
  424. this.g.moveTo(legStart.x, legStart.y);
  425. this.g.bezierCurveTo(legStart.x, legStart.y, 30, 52, legEnd.x, legEnd.y);
  426. this.g.lineTo(legEnd.x - 6, legEnd.y);
  427. this.g.stroke();
  428. legStart = cc.v2(57, 64);
  429. legEnd = cc.v2(63, 1)
  430. this.g.moveTo(legStart.x, legStart.y);
  431. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 40, legStart.y - 15, legEnd.x, legEnd.y);
  432. this.g.lineTo(legEnd.x + 6, legEnd.y);
  433. this.g.stroke();
  434. },
  435. serve_015:function() {
  436. // 画脑袋
  437. this.g.lineWidth = 3;
  438. this.g.fillColor.fromHEX('#ffffff');
  439. // this.g.ellipse(18, 116, 15, 5);
  440. this.g.arc(70, 101, this.headSize + 1, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 8, true);
  441. this.g.lineTo(76, 92);
  442. this.g.arc(77, 97, this.headSize + 1, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  443. this.g.lineTo(71, 105);;
  444. // 画个身体
  445. this.g.lineWidth = 7;
  446. this.g.fillColor.fromHEX('#ffffff');
  447. this.g.circle(64, 75, this.bodySize);
  448. this.g.close();
  449. this.g.stroke();
  450. this.g.fill();
  451. // 画手臂
  452. var handStart = cc.v2(60, 90);
  453. var handEnd = cc.v2(102, 107);
  454. this.g.lineWidth = 3;
  455. this.g.moveTo(handStart.x, handStart.y);
  456. this.g.bezierCurveTo(handStart.x, handStart.y, 63, 140, handEnd.x, handEnd.y);
  457. this.g.stroke();
  458. // 画个球
  459. this.g.lineWidth = 7;
  460. this.g.fillColor.fromHEX('#ffffff');
  461. this.g.circle(handEnd.x - 4, handEnd.y - 5, this.batSize);
  462. this.g.close();
  463. this.g.stroke();
  464. this.g.fill();
  465. // 画手臂
  466. var handStart = cc.v2(64, 60);
  467. var handEnd = cc.v2(60, 33);
  468. this.g.lineWidth = 3;
  469. this.g.moveTo(handStart.x, handStart.y);
  470. this.g.bezierCurveTo(handStart.x, handStart.y, 50, 40, handEnd.x, handEnd.y);
  471. // this.g.lineTo(handEnd.x, handEnd.y);
  472. this.g.stroke();
  473. // 画裤子
  474. var trousersStart = cc.v2(50, 73);
  475. var trousersEnd = cc.v2(70, 60);
  476. this.g.moveTo(trousersStart.x, trousersStart.y);
  477. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  478. this.g.stroke();
  479. // 画腿
  480. var legStart = cc.v2(52, 64);
  481. var legEnd = cc.v2(0, 0)
  482. this.g.moveTo(legStart.x, legStart.y);
  483. this.g.lineTo(legEnd.x, legEnd.y);
  484. this.g.stroke();
  485. legStart = cc.v2(68, 60);
  486. legEnd = cc.v2(63, 1)
  487. this.g.moveTo(legStart.x, legStart.y);
  488. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y);
  489. this.g.lineTo(legEnd.x + 6, legEnd.y);
  490. this.g.stroke();
  491. },
  492. // update (dt) {},
  493. });