diff --git a/ctrip/.project b/ctrip/.project new file mode 100644 index 0000000..26e2ff1 --- /dev/null +++ b/ctrip/.project @@ -0,0 +1,43 @@ + + + ctrip + Create By HBuilder + + + + + com.aptana.ide.core.unifiedBuilder + + + + + com.aptana.editor.php.aptanaPhpBuilder + + + + + + com.aptana.projects.webnature + com.aptana.editor.php.phpNature + + + + 1429798119704 + + 10 + + org.eclipse.ui.ide.orFilterMatcher + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-bin + + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-setting + + + + + + diff --git a/ctrip/canvas.js b/ctrip/canvas.js deleted file mode 100644 index 2f56d88..0000000 --- a/ctrip/canvas.js +++ /dev/null @@ -1,153 +0,0 @@ - - -;(function(exports, require){ - var canvas = document.getElementsByTagName('canvas')[0]; - var context = canvas.getContext('2d'); - var ajax = require.ajax; - var addEvent = require.addEvent; - var data = require.data; - - //缩放比例 - var SCALE_BIG = 1; - var SCALE_SML = 0.25; - - //颜色对应表 - var COLOR_LIST = { - BODY: '#63CEF6', - DUPI: '#FFF', - EYE: '#034E68', - ZUIBA: '#0089B5', - TOUQUAN: '#BDF9FB', - JIUWO: '#FFBFE3', - QIPAO: '#C9E8FB', - BISHANG: '#46BEEF', - BIXIA: '#54C5F2', - GO: '#B1DBF2' - }; - - if(!context){ - return; - } - - if(!window.requestAnimationFrame){ - return window.requestAnimationFrame = (function(){ - window.webkitRequestAnimationFrame - || window.mozRequestAnimationFrame - || window.oRequestAnimationFrame - || window.msRequestAnimationFrame - || function(callback, el){ - window.setTimeout(callback, 1000/ 60); - }; - })(); - } - - - context.scale(SCALE_SML, SCALE_SML); - //draw polygon - function drawPolygon(data, part, color){ - var xys = data[part]; - context.beginPath(); - context.fillStyle = color; - - context.moveTo(xys[0], xys[1]); - for(var i = 2; i < xys.length; i++){ - if(i % 2 !== 0){ - context.lineTo(xys[i-1], xys[i]); - } - } - - context.fill(); - context.closePath(); - } - - //draw eye - function drawEye(data, part, color){ - var xys = data[part]; - context.beginPath(); - context.fillStyle = color; - - //变形 - context.save(); - context.scale(1.5, 2); - context.arc(xys[0]/1.5, xys[1]/2, 6, 0, Math.PI * 2, false); - context.restore(); - - context.fill(); - context.closePath(); - - } - - //drawCircle - function drawCircle(data, part, color, radius){ - var xys = data[part]; - context.beginPath(); - context.fillStyle = color; - - context.arc(xys[0], xys[1], radius, 0, Math.PI * 2, false); - - context.fill(); - context.closePath(); - } - - - - //draw line - function drawLine(data, part, color, width){ - var xys = data[part]; - context.beginPath(); - context.strokeStyle = color; - context.lineWidth = width; - context.moveTo(xys[0], xys[1]); - for(var i = 0; i < xys.length; i++){ - if(i % 2 !== 0){ - context.lineTo(xys[i-1], xys[i]); - } - } - context.stroke(); - context.closePath(); - } - - //draw text - function drawText(x, y){ - context.beginPath(); - context.fillStyle = '#FFFFFF'; - context.font = '40px arial,sans-serif'; - context.fillText('go...', x, y) - context.fill(); - context.closePath(); - } - - - //绘制 - function draw(fileName){ - drawPolygon(data, 'polygon_body', COLOR_LIST.BODY); - drawPolygon(data, 'polygon_dupi', COLOR_LIST.DUPI); - drawPolygon(data, 'polygon_touquan', COLOR_LIST.TOUQUAN); - drawPolygon(data, 'polygon_jiuwo1', COLOR_LIST.JIUWO); - drawPolygon(data, 'polygon_jiuwo2', COLOR_LIST.JIUWO); - drawPolygon(data, 'polygon_go', COLOR_LIST.GO); - - drawEye(data, 'circle_eye1', COLOR_LIST.EYE); - drawEye(data, 'circle_eye2', COLOR_LIST.EYE); - - drawLine(data, 'line_zui', COLOR_LIST.ZUIBA, 4); - drawLine(data, 'line_bishang', COLOR_LIST.BISHANG, 8); - drawLine(data, 'line_bixia', COLOR_LIST.BIXIA, 5); - - drawCircle(data, 'circle_qipao1', COLOR_LIST.QIPAO, 30); - drawCircle(data, 'circle_qipao2', COLOR_LIST.QIPAO, 25); - drawCircle(data, 'circle_qipao3', COLOR_LIST.QIPAO, 15); - drawCircle(data, 'circle_qipao4', COLOR_LIST.QIPAO, 20); - drawCircle(data, 'circle_qipao5', COLOR_LIST.QIPAO, 15); - drawCircle(data, 'circle_qipao6', COLOR_LIST.QIPAO, 10); - drawCircle(data, 'circle_qipao7', COLOR_LIST.QIPAO, 16); - - drawText(320, 69); - } - - //执行流程 - draw('dist_3'); - - - -})(window, window); diff --git a/ctrip/data.js b/ctrip/data.js deleted file mode 100644 index d7a3c9d..0000000 --- a/ctrip/data.js +++ /dev/null @@ -1 +0,0 @@ -window.data = {"circle_eye1":["169","180"],"circle_eye2":["283","150"],"circle_qipao1":["44","270"],"circle_qipao2":["331","420"],"circle_qipao3":["91","405"],"circle_qipao4":["124","427"],"circle_qipao5":["279","446"],"circle_qipao6":["356","369"],"circle_qipao7":["413","270"],"line_bishang":["219","171","224","168","228","166","231","162","235","159","241","159","248","159","254","159"],"line_bixia":["239","219","244","219","249","218","251","218","254","215","255","211"],"line_zui":["190","204","197","204","204","204","208","202","213","201","216","199","221","194","225","192","229","187","232","184","237","180","241","179","244","179","248","177","252","177","258","177","261","177","264","177","270","178","275","181","280","181","284","181"],"polygon_body":["89","312","91","307","91","303","90","299","90","294","91","289","92","284","95","280","99","274","101","271","103","266","107","262","110","257","109","249","109","245","107","242","106","240","106","237","104","234","102","231","101","225","101","220","101","211","101","205","101","200","101","195","101","191","101","188","101","182","101","175","101","168","101","162","102","154","102","148","102","145","103","141","106","136","108","135","109","130","115","127","115","122","121","122","121","116","126","115","126","112","129","110","131","109","134","106","137","104","140","101","145","97","149","96","154","93","163","91","171","88","179","87","186","85","195","85","202","83","214","85","225","85","233","85","240","88","248","87","257","90","264","93","272","100","280","107","285","117","290","126","293","136","297","145","303","151","308","159","311","162","314","170","319","180","320","188","320","194","319","204","316","207","314","210","311","218","315","224","318","230","326","237","335","242","342","244","345","247","349","247","353","248","358","251","361","254","366","255","370","260","371","265","378","272","377","281","369","283","366","283","362","281","354","281","353","281","351","280","349","280","347","278","340","278","339","277","335","278","333","276","329","276","329","280","329","288","329","293","328","303","324","312","319","325","318","328","313","335","308","347","306","347","304","349","301","353","297","360","294","362","290","365","285","368","282","373","279","376","277","377","274","379","269","383","261","390","255","391","249","393","245","394","241","395","237","397","233","397","229","400","225","404","231","413","239","418","244","424","248","436","245","443","241","447","237","452","232","459","230","454","227","450","224","448","223","447","221","442","217","439","213","436","211","434","209","432","208","427","207","421","207","418","204","418","200","419","196","423","193","427","190","427","182","428","177","430","174","430","169","431","163","431","156","432","153","432","150","430","151","424","151","421","152","414","158","408","163","405","168","404","175","404","183","404","187","404","191","404","197","399","195","398","195","395","192","392","192","391","188","388","183","386","179","381","175","378","172","375","169","372","166","370","163","366","160","361","157","358","153","357","151","354","148","348","147","343","143","338","141","333","139","329","137","324","136","319","134","314","132","310","131","303","130","297","129","292","127","291","124","292","121","296","118","300","113","302","109","306","106","311","102","314","97","316","95","318","94","316","92","318","90","315"],"polygon_dupi":["173","277","173","271","175","267","176","264","177","261","177","260","179","255","183","252","185","249","187","249","194","248","199","248","203","248","209","247","215","247","220","245","226","244","232","242","234","242","238","239","245","238","248","236","254","233","262","231","270","230","277","230","287","232","294","235","305","241","311","247","315","253","318","260","316","276","316","283","316","295","315","304","312","314","309","321","305","329","304","333","300","340","297","343","295","347","291","350","289","355","285","360","282","361","279","366","278","368","275","371","268","375","257","381","252","380","248","380","239","380","235","380","229","378","225","376","221","372","218","368","214","363","209","360","204","355","204","353","202","349","199","346","197","341","194","337","189","332","188","330","187","325","185","321","180","311","179","305","177","301","176","298","176","293","175","288"],"polygon_go":["309","102","310","99","312","95","314","90","314","84","312","79","308","74","307","68","305","64","305","54","308","49","311","42","312","39","316","36","320","33","324","30","329","26","333","25","341","22","347","22","353","22","359","22","366","22","372","24","378","25","382","26","391","28","397","30","403","35","408","39","412","43","415","51","418","59","418","67","415","72","413","77","409","80","407","85","403","87","397","89","390","90","385","90","378","96","373","96","367","97","362","98","355","98","350","98","346","98","341","96","337","96","332","95","328","95","323","101","317","105","313","109","311","108"],"polygon_jiuwo1":["145","216","149","213","153","209","157","205","162","203","167","202","174","202","181","208","178","210","175","211","171","216","169","216","164","217","161","219","156","219","151","220","150","220"],"polygon_jiuwo2":["294","174","295","173","297","171","300","168","307","168","313","173","313","179","309","182","306","182","303","181","300","181","299","179","300","181"],"polygon_touquan":["67","129","69","124","71","120","71","115","74","112","75","110","79","110","87","118","92","119","102","127","110","131","115","127","117","124","121","121","132","121","140","121","149","121","157","120","167","118","178","117","185","118","196","117","203","115","208","113","216","112","220","111","225","110","228","108","235","106","241","104","242","104","248","104","250","101","250","103","255","100","258","95","263","93","269","94","274","100","278","110","273","112","270","113","266","117","265","117","260","118","258","121","252","122","248","124","245","125","240","127","236","128","230","130","226","130","222","131","216","132","213","133","207","136","201","136","197","137","189","137","185","140","180","140","175","140","166","143","159","141","153","141","148","141","143","143","139","143","131","143","124","143","119","143","114","142","109","142","106","142","104","147","104","154","100","160","95","164","90","167","86","168","83","170","78","170","78","170","73","170","71","169","71","164","69","161","68","156","67","151","67","146","73","147","78","148","85","148","89","148","94","148","94","145","92","143","92","143","92","145","90","142","89","139","86","139","84","138","83","138","81","137","76","137","74","137","70","137","72","136","71","134","71","131"]}; \ No newline at end of file diff --git a/ctrip/img/2.png b/ctrip/img/2.png new file mode 100644 index 0000000..6d49628 Binary files /dev/null and b/ctrip/img/2.png differ diff --git a/ctrip/index.html b/ctrip/index.html index fbe7230..f90db96 100644 --- a/ctrip/index.html +++ b/ctrip/index.html @@ -1,14 +1,24 @@ - - 携程游游矢量化 + + - - - - - + + + + + + + + + + diff --git a/ctrip/js/canvas_2.js b/ctrip/js/canvas_2.js new file mode 100644 index 0000000..3e19e64 --- /dev/null +++ b/ctrip/js/canvas_2.js @@ -0,0 +1,275 @@ +;(function(exports){ + if(!document.createElement('canvas').getContext('2d')){ + return; + } + + var COLOR_LIST = { + BODY: '#86CFF8', + DU_PI: '#FFF', + TOU_QUAN: '#B6F5F8', + CHI_BANG_1: '#86CFF8', + CHI_BANG_2: '#86CFF8', + WEI_BA: '#86CFF8' + }; + var body = [112, 253, 95, 209, 110, 149, + 110, 145, 118, 112, 173, 92, + 173, 92, 253, 70, 282, 104, + 286, 103, 288, 131, 305, 150, + 305, 151, 320, 173, 315, 196, + 314, 199, 314, 210, 307, 217, + 306, 221, 313, 228, 319, 236, + 319, 236, 323, 260, 323, 288, + 323, 290, 322, 319, 309, 343, + 309, 344, 295, 367, 274, 379, + 274, 379, 256, 392, 230, 399, + 228, 401, 212, 400, 190, 384, + 190, 386, 155, 363, 136, 328, + 130, 318, 123, 272, 112, 253]; + + var dupi = [171, 292, 163, 260, 184, 246, + 184, 246, 208, 237, 228, 242, + 230, 242, 253, 227, 262, 225, + 262, 225, 292, 218, 304, 230, + 306, 232, 317, 254, 315, 282, + 315, 282, 310, 329, 298, 344, + 298, 344, 277, 375, 254, 379, + 254, 379, 226, 385, 210, 367, + 208, 369, 187, 344, 173, 305, + 172, 306, 165, 280, 171, 269]; + + var touquan = [79, 130, 83, 106, 89, 105, + 132, 144, 114, 123, 124, 124, + 185, 115, 221, 106, 268, 92, + 268, 92, 273, 96, 285, 105, + 214, 133, 169, 142, 116, 142, + 119, 142, 89, 166, 79, 168, + 86, 168, 80, 157, 73, 148, + 130, 142, 87, 137, 79, 130]; + + var chibang_1 = [88, 308, 89, 281, 112, 255, + 114, 257, 125, 252, 130, 257, + 130, 258, 139, 266, 139, 274, + 139, 274, 124, 290, 98, 310, + 98, 310, 92, 314, 88, 310]; + + var chibang_2 = [318, 234, 349, 243, 372, 270, + 372, 270, 379, 274, 372, 282, + 372, 282, 356, 280, 320, 271, + 320, 272, 320, 266, 315, 246]; + + var chibang_2_new = [314, 232, 324, 230, 341, 233, + 342, 233, 350, 234, 366, 242, + 368, 244, 374, 253, 376, 258, + 375, 262, 347, 263, 315, 257]; + + var chibang_1_new = [72, 288, 84, 269, 101, 256, + 114, 243, 127, 253, 127, 253, + 127, 255, 128, 265, 123, 273, + 126, 278, 112, 284, 87, 296, + 87, 296, 79, 299, 70, 290]; + + var weiba = [145, 425, 152, 398, 160, 398, + 160, 398, 172, 391, 191, 391, + 191, 391, 187, 380, 189, 370, + 191, 371, 208, 380, 226, 388, + 228, 390, 221, 393, 228, 404, + 230, 406, 241, 414, 245, 432, + 245, 432, 240, 457, 231, 446, + 231, 446, 211, 433, 204, 414, + 204, 409, 185, 424, 145, 425]; + + var weiba_new = [200, 438, 190, 397, 230, 394, + 230, 397, 262, 410, 260, 445, + 260, 425, 200, 415, 240, 405, + 230, 407, 220, 430, 200, 440 + ]; + + + + function drawZui(ctx){ + //重复加粗 + for(var i = 0; i < 3; i++){ + ctx.beginPath(); + ctx.strokeStyle = '#099FDE'; + ctx.bezierCurveTo(195 - i, 210, 209, 210 + i, 224, 189); + ctx.bezierCurveTo(224, 189, 228, 180 + i, 244, 183); + ctx.bezierCurveTo(244, 183, 267, 189 + i, 270, 186); + ctx.stroke(); + ctx.closePath(); + } + } + + function drawEye(ctx, x, y){ + ctx.beginPath(); + ctx.fillStyle = '#000'; + ctx.save(); + ctx.scale(1.5, 2); + ctx.arc(x/1.5, y/2, 6, 0, Math.PI * 2, false); + ctx.restore(); + ctx.fill(); + ctx.closePath(); + + ctx.beginPath(); + ctx.fillStyle = '#ddd'; + ctx.save(); + ctx.scale(1.5, 2); + ctx.arc((x + 3)/1.5, (y - 5)/2, 3, 0, Math.PI * 2, false); + ctx.restore(); + ctx.fill(); + ctx.closePath(); + } + + //酒窝 + function drawJiuWo(ctx, x, y){ + ctx.beginPath(); + ctx.fillStyle = '#FFBFE3'; + ctx.save(); + ctx.scale(2.1, 1.2); + ctx.arc(x/2.1, y/1.2, 5, 0, Math.PI * 2, false); + ctx.restore(); + ctx.fill(); + ctx.closePath(); + } + + //重复鼻子 + function drawBiZi(ctx){ + for(var n = 0; n < 5; n++){ + ctx.beginPath(); + ctx.strokeStyle = '#46BEEF'; + ctx.bezierCurveTo(220, 173, 223, 164 + n, 247, 168); + ctx.stroke(); + ctx.closePath(); + } + } + + //气泡,以下参数经过计算后得出 + function drawPao(ctx, x, y, radius){ + ctx.beginPath(); + ctx.fillStyle = '#C9E8FB'; + ctx.arc(x, y, radius, 0, Math.PI * 2, false); + ctx.fill(); + ctx.closePath(); + //气泡内球 + ctx.beginPath(); + ctx.fillStyle = '#EBF3F7'; + ctx.save(); + ctx.scale(1.2, 1.8); + ctx.arc((x - (radius/2))/1.2, (y - (radius/4))/1.8, radius/7, 0, Math.PI * 2, false); + ctx.restore(); + ctx.fill(); + ctx.closePath(); + //气泡内多边形 + ctx.beginPath(); + ctx.fillStyle = '#EBF3F7'; + ctx.bezierCurveTo(x- radius/4, y+radius/2, x+radius/2.7, y+radius/2, x+radius/1.6, y+radius/4); + ctx.lineTo(x+radius/1.3, y+radius/2); + ctx.bezierCurveTo(x+radius/1.3, y+radius/2, x+radius/2.7, y+radius/1.3, x-radius/4, y+radius/1.3); + ctx.fill(); + ctx.closePath(); + } + + function drawGo(ctx){ + ctx.beginPath(); + ctx.fillStyle = '#C9E8FB'; + ctx.save(); + ctx.scale(2, 1.5); + ctx.arc(355/2, 80/1.5, 20, 0, Math.PI * 2, false); + ctx.restore(); + ctx.fill(); + ctx.closePath(); + //go尖 + ctx.beginPath(); + ctx.fillStyle = '#C9E8FB'; + ctx.bezierCurveTo(305, 113, 320, 103, 325, 90); + ctx.bezierCurveTo(346, 107, 320, 103, 305, 113); + ctx.fill(); + ctx.closePath(); + } + + function drawText(ctx, text, x, y, color){ + ctx.beginPath(); + ctx.fillStyle = color; + ctx.font = '36px arial,sans-serif'; + ctx.fillText(text, x, y) + ctx.fill(); + ctx.closePath(); + } + + function drawPolygon(ctx, data, color){ + ctx.beginPath(); + ctx.fillStyle = color; + for(var i = 0; i < data.length; i++){ + if(i % 6 === 0){ + ctx.bezierCurveTo(data[i], data[i+1], data[i+2], data[i+3], data[i+4], data[i+5]); + } + } + ctx.fill(); + ctx.closePath(); + } + + var UU = function(canvas, scale){ + this.canvas = canvas; + this.scale = scale; + this.ctx = canvas.getContext('2d'); + } + UU.prototype.draw = function(){ + this.ctx.scale(this.scale, this.scale); + var ctx = this.ctx; + var canvas = this.canvas; + var i = 0; + setInterval(function(){ + ctx.clearRect(0, 0, canvas.width, canvas.height); + drawPolygon(ctx, body, '#86CFF8'); + drawPolygon(ctx, dupi, COLOR_LIST.DU_PI); + drawPolygon(ctx, touquan, COLOR_LIST.TOU_QUAN); + drawZui(ctx); + drawJiuWo(ctx, 161, 211); + drawJiuWo(ctx, 300, 174); + drawBiZi(ctx); + drawGo(ctx); + drawText(ctx, 'go...', 320, 85, '#fff'); + + if(i % 2 === 0){ + drawPolygon(ctx, weiba, COLOR_LIST.WEI_BA); + drawPolygon(ctx, chibang_1, COLOR_LIST.CHI_BANG_1); + drawPolygon(ctx, chibang_2, COLOR_LIST.CHI_BANG_2); + }else{ + drawPolygon(ctx, weiba_new, COLOR_LIST.WEI_BA); + drawPolygon(ctx, chibang_1_new, COLOR_LIST.CHI_BANG_1); + drawPolygon(ctx, chibang_2_new, COLOR_LIST.CHI_BANG_2); + } + + if(i % 4 === 0){ + drawText(ctx, '>', 169 - 0, 180 + 5, '#099FDE'); + drawText(ctx, '<', 283 - 16, 150 + 16, '#099FDE'); + drawText(ctx, '‿', 169 + 10, 180 - 35, '#099FDE'); + drawText(ctx, '‿', 283 - 55, 150 - 14, '#099FDE'); + }else{ + drawEye(ctx, 169, 180); + drawEye(ctx, 283, 150); + } + if(i % 2 === 0){ + drawPao(ctx, 44, 270, 40); + drawPao(ctx, 331, 420, 25); + drawPao(ctx, 91, 405, 12); + drawPao(ctx, 124, 427, 11); + drawPao(ctx, 279, 446, 10); + drawPao(ctx, 356, 369, 12); + drawPao(ctx, 413, 270, 18); + }else{ + drawPao(ctx, 44, 270 + 10, 40); + drawPao(ctx, 331, 420 + 10, 25); + drawPao(ctx, 91, 405 + 10, 12); + drawPao(ctx, 124, 427 + 10, 11); + drawPao(ctx, 279, 446 + 10, 10); + drawPao(ctx, 356, 369 + 10, 12); + drawPao(ctx, 413, 270 + 10, 18); + } + + i++; + }, 380); + }; + + exports.UU = UU; + +})(window); diff --git a/ctrip/util.js b/ctrip/js/util.js similarity index 100% rename from ctrip/util.js rename to ctrip/js/util.js diff --git a/ctrip/mobile.html b/ctrip/mobile.html new file mode 100644 index 0000000..a01ddfb --- /dev/null +++ b/ctrip/mobile.html @@ -0,0 +1,16 @@ + + + + + + 游游矢量化 + + + + + + + +