function star_map(s_text1, s_text2, num1, num2) { var stars_pos = [{ x: 390, y: 345, scale: 0.45, maxscale: 0.4, minscale: 0.22 }, { x: 356, y: 70, scale: 0.35, maxscale: 0.35, minscale: 0.15 }, { x: 276, y: 500, scale: 0.3, maxscale: 0.3, minscale: 0.1 }, { x: 255, y: -200, scale: 0.55, maxscale: 0.55, minscale: 0.28 }, { x: 474, y: 206, scale: 0.3, maxscale: 0.3, minscale: 0.2 }, { x: 130, y: 555, scale: 0.5, maxscale: 0.5, minscale: 0.15 }, { x: 190, y: 204, scale: 0.45, maxscale: 0.45, minscale: 0.12 }, { x: 183, y: 70, scale: 0.25, maxscale: 0.25, minscale: 0.1 }, { x: 52, y: 358, scale: 0.4, maxscale: 0.4, minscale: 0.16 }, { x: 352, y: 658, scale: 0.23, maxscale: 0.23, minscale: 0.16 }] var stars_pos2 = [{ x: 147, y: 180, scale: 0.1, minscale: 0.1, maxscale: 0.25 }, { x: 337, y: 462, scale: 0.17, minscale: 0.17, maxscale: 0.3 }, { x: 325, y: 157, scale: 0.1, minscale: 0.1, maxscale: 0.4 }, { x: 230, y: -10, scale: 0.15, minscale: 0.15, maxscale: 0.3 }, { x: 150, y: 350, scale: 0.12, minscale: 0.12, maxscale: 0.44 }, { x: 451, y: 300, scale: 0.14, minscale: 0.14, maxscale: 0.47 }, { x: 199, y: 676, scale: 0.1, minscale: 0.1, maxscale: 0.2 }, { x: 240, y: 599, scale: 0.15, minscale: 0.15, maxscale: 0.39 }, { x: 376, y: -220, scale: 0.2, minscale: 0.2, maxscale: 0.5 }, { x: 61, y: 586, scale: 0.16, minscale: 0.16, maxscale: 0.55 }]; // if (s_text1.length < 20) { // for (var i = s_text1.length; i < 20; i++) { // s_text1[i] = ''; // } // } // if (s_text2.length < 20) { // for (var i = s_text2.length; i < 20; i++) { // s_text2[i] = ''; // } // } var imgsize = 0, winwidth = 0, winheight = 0, picmw = 0, picmh = 0; var bgimg1 = null, bgimg2 = null; var bigstars = []; var movexspeed = [], moveyspeed = []; var starsoutflag = true, starsinflag = false, initflag = true, starcase = 1, exflag = false; var timer1 = 0; var bgchangeflag = 3; var logoflag = true; var textindex = 0; var star_text = s_text1; var stage = new createjs.stage('democanvas'); stage.enablemouseover(); var wholebg = new createjs.container(); var littlestarscontainer = new createjs.container(); wholebg.addchild(littlestarscontainer); var logocontainer = new createjs.container(); var wholebigstars = new createjs.container(); wholebigstars.set({ x: winwidth / 2, y: winheight / 2, regx: winwidth / 2, regy: winheight / 2 }) stage.addchild(wholebg, logocontainer); var init = function(cb) { imgsize = 1920; winwidth = $(window).width() < 1250 ? 1250 : $(window).width(); winheight = ($(window).height() - 100 - 109) < 450 ? 450 : ($(window).height() - 100 - 109); picmw = winwidth / imgsize; picmh = winheight / imgsize; littlestarscontainer.cache(0, 0, winwidth, winheight); $('#democanvas').attr({ 'width': winwidth, 'height': winheight }) wholebg.set({ x: winwidth / 2, y: winheight / 2, regx: winwidth / 2, regy: winheight / 2 }); cb && cb(); } loadingimg('/themes/simplebootx/public/images/starcloud.png', function() { init(function() { createbg(wholebg); createlittlestars(littlestarscontainer); createbigstars_text(bigstars, wholebigstars); addlogo(logocontainer); for (var i = 0; i < bigstars.length; i++) { var a = math.round(math.random()) * -1; if (a === 0) { movexspeed[i] = (10 * math.random() + 5); } else { movexspeed[i] = (10 * math.random() * -1 - 5); } var b = math.round(math.random()) * -1; if (b === 0) { moveyspeed[i] = (10 * math.random() + 5); } else { moveyspeed[i] = (10 * math.random() * -1 - 5); } } }) stage.enablemouseover(); createjs.ticker.setfps(60); createjs.ticker.addeventlistener('tick', update); }) // $(window).resize(function() { // init(function() { // createbg(wholebg); // createlittlestars(littlestarscontainer); // // createbigstars_text(bigstars, wholebigstars); // addlogo(logocontainer); // }); // }) function btnclick() { var state = $(this).attr("data-z"); if (state === "true") { return false; } else { $("#stellar_content .btn").unbind(); starsoutflag = true; bgchangeflag = $(this).index() - 1; if ($(this).index() === 0) { star_text = s_text1; } else if ($(this).index() === 1) { star_text = s_text2; } for (var i = 0; i < bigstars.length; i++) { bigstars[i].star.alpha = 1; } $(this).find(".z-crt").show(); $(this).find(".nor").hide(); $(this).siblings().find(".z-crt").hide(); $(this).siblings().find(".nor").show(); $(this).attr({ "data-z": "true" }).siblings().attr({ "data-z": "false" }); $("#stellar_content .detail_txt").eq($(this).index() - 2).show().siblings(".detail_txt").hide(); } } var rotaspeed = 0.007; var clickspeed = 0.01; var buttonamflag = 1; var textchangeflag = true; function update() { stage.update(); if (logoflag) { logoanimation(); } else { if (buttonamflag === 1) { button1animation(); } else if (buttonamflag === 2) { button2animation(); } } // 背景缓动动画 wholebg.rotation += rotaspeed; if (wholebg.rotation > 2) { rotaspeed = -rotaspeed; } else if (wholebg.rotation < -2) { rotaspeed = -rotaspeed; } // 按钮动画 if (bgchangeflag === 2) { if (bgimg1.bg.alpha > 0) { bgimg1.bgchangealpha(-clickspeed); bgimg1.bgrotate(1); bgimg1.bgzoom(0.01); bgimg2.bgchangealpha(clickspeed); bgimg2.bgrotate(1); bgimg2.bgzoom(0.007); } else { bgchangeflag = 3; bgimg1.bgreset(); bgimg1.bgzoom(-1); bgimg1.bgrotate(-(1 / clickspeed) * 1); } } else if (bgchangeflag === 1) { if (bgimg2.bg.alpha > 0) { bgimg1.bgchangealpha(clickspeed); bgimg1.bgrotate(1); bgimg1.bgzoom(0.007); bgimg2.bgchangealpha(-clickspeed); bgimg2.bgrotate(1); bgimg2.bgzoom(0.01); } else { bgchangeflag = 3; bgimg2.bgreset(); bgimg2.bgzoom(-1); bgimg2.bgrotate(-(1 / clickspeed) * 1); } } if (starsoutflag) { starsoutanimation(bigstars, function() { settimeout(function() { starsoutflag = false; starsinflag = true; if (initflag) { stage.addchild(wholebigstars); initflag = false; } }, 200); }); } else if (starsinflag) { starsinanimation(bigstars, function() { starsoutflag = false; starsinflag = false; if (starcase === 1) { for (var i = 0; i < stars_pos.length; i++) { bigstars[i].textshow(); } } else if (starcase === 2) { for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { bigstars[i].textshow(); } } }); } else { // 星星交替时间 timer1++; if (timer1 === 500) { exflag = true; timer1 = 0; } /*大星星动画*/ if (wholebigstars.getnumchildren()) { for (var i = 0; i < stars_pos.length; i++) { var speed = bigstars[i].speed; bigstars[i].starmoveto(); bigstars[i].starzoom(); bigstars[i].changealpha(); if (bigstars[i].x > bigstars[i].oldx + 2) { speed.speedx = -speed.speedx; speed.speedy = -speed.speedx; speed.zoomspeed = -speed.zoomspeed; speed.alphaspeed = -speed.alphaspeed; } else if (bigstars[i].x < bigstars[i].oldx) { speed.speedx = -speed.speedx; speed.speedy = -speed.speedx; speed.zoomspeed = -speed.zoomspeed; speed.alphaspeed = -speed.alphaspeed; } } for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { var speed = bigstars[i].speed; bigstars[i].starmoveto(); bigstars[i].starzoom(); bigstars[i].changealpha(); if (bigstars[i].x > bigstars[i].oldx + 2) { speed.speedx = -speed.speedx; speed.speedy = -speed.speedx; speed.zoomspeed = -speed.zoomspeed; speed.alphaspeed = -speed.alphaspeed; } else if (bigstars[i].x < bigstars[i].oldx) { speed.speedx = -speed.speedx; speed.speedy = -speed.speedx; speed.zoomspeed = -speed.zoomspeed; speed.alphaspeed = -speed.alphaspeed; } } for (var i = (stars_pos.length + stars_pos2.length); i < bigstars.length; i++) { var speed = bigstars[i].speed; bigstars[i].starmoveto(); bigstars[i].changealpha(); if (bigstars[i].star.alpha > 1) { speed.speedx = -speed.speedx; speed.speedy = -speed.speedx; speed.alphaspeed = -speed.alphaspeed; } else if (bigstars[i].star.alpha < 0) { speed.speedx = -speed.speedx; speed.speedy = -speed.speedx; speed.alphaspeed = -speed.alphaspeed; } } } /*大星星交替*/ if (exflag) { var finishex = true; if (starcase === 1) { for (var i = 0; i < stars_pos.length; i++) { if (bigstars[i].star.scalex > bigstars[i].minscale) { bigstars[i].starzoom(-0.005); bigstars[i].textchangalpha(-0.1); bigstars[i].textzoom(); finishex = false; } } for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { if (textchangeflag) { if (star_text[textindex]) { bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } else { textindex = 0; bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } textindex++; } if (bigstars[i].star.scalex < bigstars[i].maxscale) { bigstars[i].starzoom(0.005); bigstars[i].textchangalpha(0.1); bigstars[i].textzoom(); finishex = false; } } textchangeflag = false; if (finishex) { for (var i = 0; i < stars_pos.length; i++) { bigstars[i].texthide(); } for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { bigstars[i].textshow(); } exflag = false; textchangeflag = true; starcase = 2; } } else if (starcase === 2) { for (var i = 0; i < stars_pos.length; i++) { if (textchangeflag) { if (star_text[textindex]) { bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } else { textindex = 0; bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } textindex++; } if (bigstars[i].star.scalex < bigstars[i].maxscale) { bigstars[i].starzoom(0.005); bigstars[i].textchangalpha(0.1); bigstars[i].textzoom(); finishex = false; } } textchangeflag = false; for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { if (bigstars[i].star.scalex > bigstars[i].minscale) { bigstars[i].starzoom(-0.005); bigstars[i].textchangalpha(-0.1); bigstars[i].textzoom(); finishex = false; } } if (finishex) { for (var i = 0; i < stars_pos.length; i++) { bigstars[i].textshow(); } for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { bigstars[i].texthide(); } exflag = false; textchangeflag = true; starcase = 1; } } } } } /*-------------------------动画---------------------------------------*/ function starsoutanimation(stars, cb) { var outfinish = true; for (var i = 0; i < stars.length; i++) { stars[i].texthide(); if (stars[i].star.alpha > 0) { stars[i].starmoveto(movexspeed[i], moveyspeed[i]); stars[i].changealpha(-0.02); outfinish = false; } } if (outfinish) { if (starcase === 1) { textindex = 0; for (var i = 0; i < stars_pos.length; i++) { if (star_text[textindex]) { bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } else { textindex = 0; bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } textindex++; } } else if (starcase === 2) { textindex = 0; for (var i = stars_pos.length; i < (stars_pos.length + stars_pos2.length); i++) { if (star_text[textindex]) { bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } else { textindex = 0; bigstars[i].textchange(star_text[textindex].txt); txtclick(bigstars[i].text, star_text[textindex].txt_link); } textindex++; } } cb && cb(); } } var infinish = false; function starsinanimation(stars, cb) { infinish = true; for (var i = 0; i < stars.length; i++) { stars[i].texthide(); if (stars[i].star.alpha < 1) { stars[i].starmoveto(-movexspeed[i], -moveyspeed[i]); stars[i].changealpha(0.02); infinish = false; } } if (infinish) { console.log(buttonamflag) if (buttonamflag === 1) { logocontainer.getchildat(3).getchildat(4).on('click', button2click, null, true); } else if (buttonamflag === 2) { logocontainer.getchildat(2).getchildat(4).on('click', button1click, null, true); } cb && cb(); } } var button1click = function() { var button1 = logocontainer.getchildat(2); var button2 = logocontainer.getchildat(3); var star1 = logocontainer.getchildat(6); var star2 = logocontainer.getchildat(7); var light = logocontainer.getchildat(8); var txt1 = logocontainer.getchildat(4); var txt2 = logocontainer.getchildat(5); starsoutflag = true; bgchangeflag = 1; buttonamflag = 1; star_text = s_text1; for (var i = 0; i < bigstars.length; i++) { bigstars[i].star.alpha = 1; } if (starcase === 1) { textindex = stars_pos.length; } else if (starcase === 2) { textindex = 0; } bgimg1.bg.set({ scalex: 0, scaley: 0 }) txt1.alpha = 1; txt2.alpha = 0; light.set({ x: 30, y: 158, scalex: 0.9, scaley: 0.9, alpha: 0 }) star1.set({ x: 0, y: 79, alpha: 0.2, }) star2.set({ x: 205, y: 143, alpha: 0.2 }) button1.getchildat(3).graphics._stroke.style = "#f5c468"; button1.getchildat(2).graphics._fill.style = "#f5c468"; button1.getchildat(1).graphics._fill.style = "#f5c468"; button1.getchildat(0).color = "#f5c468"; button2.getchildat(3).graphics._stroke.style = "#a9a7a7"; button2.getchildat(2).graphics._fill.style = "#a9a7a7"; button2.getchildat(1).graphics._fill.style = "#a9a7a7"; button2.getchildat(0).color = "#a9a7a7"; } var button2click = function() { var button1 = logocontainer.getchildat(2); var button2 = logocontainer.getchildat(3); var star1 = logocontainer.getchildat(6); var star2 = logocontainer.getchildat(7); var light = logocontainer.getchildat(8); var txt1 = logocontainer.getchildat(4); var txt2 = logocontainer.getchildat(5); starsoutflag = true; bgchangeflag = 2; buttonamflag = 2; star_text = s_text2; for (var i = 0; i < bigstars.length; i++) { bigstars[i].star.alpha = 1; } if (starcase === 1) { textindex = stars_pos.length; } else if (starcase === 2) { textindex = 0; } bgimg2.bg.set({ scalex: 0, scaley: 0 }) txt1.alpha = 0; txt2.alpha = 1; light.set({ x: 400, y: 158, scalex: 0.9, scaley: 0.9, alpha: 0 }) star1.set({ x: 398, y: 79, alpha: 0.2 }) star2.set({ x: 249, y: 143, alpha: 0.2 }) button2.getchildat(3).graphics._stroke.style = "#f5c468"; button2.getchildat(2).graphics._fill.style = "#f5c468"; button2.getchildat(1).graphics._fill.style = "#f5c468"; button2.getchildat(0).color = "#f5c468"; button1.getchildat(3).graphics._stroke.style = "#a9a7a7"; button1.getchildat(2).graphics._fill.style = "#a9a7a7"; button1.getchildat(1).graphics._fill.style = "#a9a7a7"; button1.getchildat(0).color = "#a9a7a7"; } function logoanimation() { var title1 = logocontainer.getchildat(1); var title2 = logocontainer.getchildat(0); var button1 = logocontainer.getchildat(2); var button2 = logocontainer.getchildat(3); var txt1 = logocontainer.getchildat(4); var txt2 = logocontainer.getchildat(5); if (title1.scalex > 1) { title1.scalex -= 0.01; title1.scaley -= 0.01; title2.scalex -= 0.01; title2.scaley -= 0.01; title1.alpha += 0.005; title2.alpha += 0.005; } else { title1.alpha = 1; title2.alpha = 1; if (button1.alpha < 1) { button1.alpha += 0.01; button2.alpha += 0.01; txt1.alpha += 0.01; } else { logoflag = false; var star1 = logocontainer.getchildat(6); var star2 = logocontainer.getchildat(7); var light = logocontainer.getchildat(8); button2.getchildat(4).on('click', button2click, null, true); } } } function button1animation() { var star1 = logocontainer.getchildat(6); var star2 = logocontainer.getchildat(7); var light = logocontainer.getchildat(8); var movespeed = 2.5; star1.alpha += star1.alphaspeed; if (star1.alpha > 0.8) { star1.alphaspeed = -star1.alphaspeed; } else if (star1.alpha < 0.2) { star1.alphaspeed = -star1.alphaspeed; } star2.alpha += star2.alphaspeed; if (star2.alpha > 0.8) { star2.alphaspeed = -star2.alphaspeed; } else if (star2.alpha < 0.2) { star2.alphaspeed = -star2.alphaspeed; } if (light.x < 190 && light.y === 158) { light.alpha += light.alphaspeed; light.x += movespeed; if (light.alpha > 0.7) { light.alphaspeed = -light.alphaspeed; } else if (light.alpha < 0) { light.alphaspeed = -light.alphaspeed; } } else if (light.x >= 190 && light.y === 158) { light.alpha = 0; light.y = 185; } else if (light.x > 30 && light.y === 185) { light.x -= movespeed; light.alpha += light.alphaspeed; if (light.alpha > 0.7) { light.alphaspeed = -light.alphaspeed; } else if (light.alpha < 0) { light.alphaspeed = -light.alphaspeed; } } else if (light.x <= 30 && light.y === 185) { light.alpha = 0; light.y = 158; } } function button2animation() { var star1 = logocontainer.getchildat(6); var star2 = logocontainer.getchildat(7); var light = logocontainer.getchildat(8); var movespeed = 2.5; star1.alpha += star1.alphaspeed; if (star1.alpha > 0.8) { star1.alphaspeed = -star1.alphaspeed; } else if (star1.alpha < 0.2) { star1.alphaspeed = -star1.alphaspeed; } star2.alpha += star2.alphaspeed; if (star2.alpha > 0.8) { star2.alphaspeed = -star2.alphaspeed; } else if (star2.alpha < 0.2) { star2.alphaspeed = -star2.alphaspeed; } if (light.x > 250 && light.y === 158) { light.alpha += light.alphaspeed; light.x -= movespeed; if (light.alpha > 0.7) { light.alphaspeed = -light.alphaspeed; } else if (light.alpha < 0) { light.alphaspeed = -light.alphaspeed; } } else if (light.x <= 250 && light.y === 158) { light.alpha = 0; light.y = 185; } else if (light.x < 400 && light.y === 185) { light.x += movespeed; light.alpha += light.alphaspeed; if (light.alpha > 0.7) { light.alphaspeed = -light.alphaspeed; } else if (light.alpha < 0) { light.alphaspeed = -light.alphaspeed; } } else if (light.x >= 400 && light.y === 185) { light.alpha = 0; light.y = 158; } } /*-------------------------动画---------------------------------------*/ /*-----------------------实例-------------------------------------*/ function addlogo(container, cb) { if (container.getnumchildren()) { container.removeallchildren(); } container.set({ x: winwidth / 2 - 0.323 * imgsize, y: winheight * (picmw > 0.8 ? 0.8 : picmw) * 0.3 }) var title1 = new createjs.bitmap('/themes/simplebootx/public/images/title.png'); title1.set({ x: 20, y: 45, scalex: 1.5, scaley: 1.5, alpha: 0 }) var title2 = new createjs.text("跨界全营销•拥抱大数据•打造新平台", "25px simhei", "#fff"); title2.set({ x: 65, y: 0, scalex: 1.5, scaley: 1.5, alpha: 0 }) var button1 = new createjs.container(); button1.set({ alpha: 0, y: -20 }) var rect1 = new createjs.shape(); rect1.graphics.beginfill('#000').drawrect(68, 190, 175, 27); rect1.alpha = 0.1; var border1 = new createjs.shape(); border1.graphics.setstrokestyle(2).beginstroke("#f5c468").drawrect(68, 190, 175, 27); var button1_t = new createjs.text('全营销星力量', '16px simhei', '#f5c468'); button1_t.set({ x: 109, y: 195 }) var sjx1 = new createjs.shape(); sjx1.graphics.beginfill("#f5c468") .moveto(8, 0) .lineto(0, 5) .lineto(8, 10) .closepath() sjx1.set({ x: 80, y: 199 }) var sjx2 = new createjs.shape(); sjx2.graphics.beginfill("#f5c468") .moveto(0, 0) .lineto(8, 5) .lineto(0, 10) .closepath() sjx2.set({ x: 225, y: 199 }) var star1 = new createjs.bitmap('/themes/simplebootx/public/images/star1.png'); var star2 = new createjs.bitmap('/themes/simplebootx/public/images/star2.png'); var light = new createjs.bitmap('/themes/simplebootx/public/images/light.png'); light.alphaspeed = 0.022; star1.alphaspeed = 0.01; star2.alphaspeed = 0.007; light.set({ x: 30, y: 158, scalex: 0.9, scaley: 0.9, alpha: 0 }) star1.set({ x: 0, y: 79, alpha: 0.2, }) star2.set({ x: 205, y: 143, alpha: 0.2 }) button1.addchild(button1_t, sjx1, sjx2, border1, rect1); var button2 = new createjs.container(); button2.set({ x: 220, y: -20, alpha: 0 }) var rect2 = new createjs.shape(); rect2.graphics.beginfill('#000').drawrect(68, 190, 175, 27); rect2.alpha = 0.1; var border2 = new createjs.shape(); border2.graphics.setstrokestyle(2).beginstroke("#a9a7a7").drawrect(68, 190, 175, 27); var button2_t = new createjs.text('大数据星力量', '16px simhei', '#a9a7a7'); button2_t.set({ x: 109, y: 195 }) var sjx2_1 = new createjs.shape(); sjx2_1.graphics.beginfill("#a9a7a7") .moveto(8, 0) .lineto(0, 5) .lineto(8, 10) .closepath() sjx2_1.set({ x: 80, y: 199 }) var sjx2_2 = new createjs.shape(); sjx2_2.graphics.beginfill("#a9a7a7") .moveto(0, 0) .lineto(8, 5) .lineto(0, 10) .closepath() sjx2_2.set({ x: 225, y: 199 }) button2.addchild(button2_t, sjx2_1, sjx2_2, border2, rect2); var txt1 = new createjs.container(); txt1.set({ x: 0, y: 230, alpha: 0 }) var board = new createjs.container(); board.set({ x: 145, y: 90 }) var led = []; var led_num = []; for (var i = 0; i < num1.length; i++) { led[i] = new createjs.bitmap('/themes/simplebootx/public/images/led.png'); led[i].set({ x: 0 + i * 24, y: 0 }); led_num[i] = new createjs.text(num1[i], '22px simhei', "#f8cd6f"); led_num[i].set({ x: 7 + i * 24, y: 7 }) board.addchild(led[i], led_num[i]); } var txt1_1 = new createjs.text("从中国广告业的扛旗者到营销产业整合者,gimc成就了无数品牌", "14px simhei", "#a9a7a7"); txt1_1.set({ x: 65, y: 0 }) var txt1_2 = new createjs.text("今天,为了迎接数字时代的全新挑战,gimc致力于构建多方共赢的生态平台", "14px simhei", "#a9a7a7"); txt1_2.set({ x: 30, y: 30 }) var txt1_3 = new createjs.text("聚合营销新力量,激发前所未有的产业整合力,为营销带来多维度、全方位的创新与突破", "14px simhei", "#a9a7a7"); txt1_3.set({ x: -10, y: 60 }) var txt1_4 = new createjs.text("现在,gimc与", "14px simhei", "#a9a7a7"); txt1_4.set({ x: 55, y: 110 }) var txt1_5 = new createjs.text("家成员企业,期待与您共同开启大数据全营销时代", "14px simhei", "#a9a7a7"); txt1_5.set({ x: 148 + num1.length * 24, y: 110 }) txt1.addchild(txt1_1, txt1_2, txt1_3, txt1_4, txt1_5, board); var txt2 = new createjs.container(); var board2 = new createjs.container(); board2.set({ x: 210, y: -20 }) var led2 = []; var led_num2 = []; for (var i = 0; i < num2.length; i++) { led2[i] = new createjs.bitmap('/themes/simplebootx/public/images/led.png'); led2[i].set({ x: 0 + i * 24, y: 0 }); led_num2[i] = new createjs.text(num2[i], '22px simhei', "#f8cd6f"); led_num2[i].set({ x: 7 + i * 24, y: 7 }) board2.addchild(led2[i], led_num2[i]); } txt2.set({ x: 0, y: 250, alpha: 0 }) var txt2_1 = new createjs.text("在gimc大数据联盟,已有", "14px simhei", "#a9a7a7"); txt2_1.set({ x: 50, y: 0 }) var txt2_2 = new createjs.text("名成员正在提供卓越的技术服务", "14px simhei", "#a9a7a7"); txt2_2.set({ x: 215 + num2.length * 24, y: 0 }) var txt2_3 = new createjs.text("品牌将以更高效、更快捷的方式的与大数据技术结合", "14px simhei", "#a9a7a7"); txt2_3.set({ x: 110, y: 30 }) var txt2_4 = new createjs.text("让大数据激活营销体系,重塑品牌新价值。", "14px simhei", "#a9a7a7"); txt2_4.set({ x: 140, y: 60 }) txt2.addchild(txt2_1, txt2_2, txt2_3, txt2_4, board2); container.addchild(title2, title1, button1, button2, txt1, txt2, star1, star2, light) cb && cb({ button1: button1, button2: button2, text1: txt1, text2: txt2, }); } function createbg(container) { var bgscale = picmw > 0.8 ? 0.8 : picmw; var bgpotx = (imgsize * bgscale - winheight) / 2; if (this.bgpotx < 0) { this.bgpotx = 0; } var bgoption1 = { imgsrc: '/themes/simplebootx/public/images/starcloud.png', x: winwidth / 2, y: -bgpotx + imgsize * bgscale / 2, scale: bgscale, regx: imgsize / 2, regy: imgsize / 2, alpha: 1 }; var bgoption2 = { imgsrc: '/themes/simplebootx/public/images/starcloud2.png', x: winwidth / 2, y: -bgpotx + imgsize * bgscale / 2, scale: bgscale, regx: imgsize / 2, regy: imgsize / 2, alpha: 0 }; if (bgimg1 === null) { bgimg1 = new bgimg(); bgimg2 = new bgimg(); bgimg1.init(bgoption1); bgimg2.init(bgoption2); bgimg1.render(container); bgimg2.render(wholebg); bgimg2.bgzoom(-1); bgimg2.bgrotate(-(1 / clickspeed) * 1); } else { bgimg1.bgresize(bgoption1); bgimg2.bgresize(bgoption2); } } function createlittlestars(container) { if (container.getnumchildren()) { container.removeallchildren(); } var purple_stars = []; var blue_stars = []; var stars = new createjs.container(); container.addchild(stars); var purple_count = winwidth / 10; var blue_count = winwidth / 4; var star = null; for (var i = 0; i < purple_count; i++) { purple_stars[i] = { color: ["#99998c", '#6b4395', '#4c106d'], gradient: [0, 0.5, 1], x: 0.5 * winwidth * math.random(), y: winheight * math.random(), r: 2.3 * math.random(), al: math.random() * 0.7 + 0.3 } star = new littlestar(); star.init(purple_stars[i]); star.render(stars); } var stars2 = stars.clone(true); stars2.set({ x: 0.7 * winwidth, y: 0 }) container.addchild(stars2); container.updatecache(); } function createbigstars_text(starsarry, container) { if (container.getnumchildren()) { container.removeallchildren(); starsarry = []; } var star = null; var stars1 = new createjs.container(), stars2 = new createjs.container(), stars3 = new createjs.container(); stars1.set({ x: 0.4 * winwidth, y: 0.1 * winheight + winheight * 0.1 }); stars2.set({ x: 0.4 * winwidth, y: 0.1 * winheight + winheight * 0.1 }); stars3.set({ x: 0, y: 0 }); // 大星星1 for (var i = 0; i < stars_pos.length; i++) { star = new bigstar(); stars_pos[i].x = stars_pos[i].x / 0.8 * picmw; stars_pos[i].y = stars_pos[i].y / 0.8 * picmh; stars_pos[i].speed = { speedx: 0.02 * math.random() + 0.005, speedy: 0.03 * math.random() + 0.005, zoomspeed: -math.random() * 0.0005, alphaspeed: -0.0025 }; star.init(stars_pos[i]); if (star_text[textindex]) { star.textinit(star_text[textindex].txt); txtclick(star.text, star_text[textindex].txt_link); star.text.cursor = "pointer"; } else { textindex = 0; star.textinit(star_text[textindex].txt); txtclick(star.text, star_text[textindex].txt_link); star.text.cursor = "pointer"; } textindex++; star.render(stars1); starsarry.push(star); } // 大星星2 for (var i = 0; i < stars_pos2.length; i++) { star = new bigstar(); stars_pos2[i].x = stars_pos2[i].x / 0.8 * picmw; stars_pos2[i].y = stars_pos2[i].y / 0.8 * picmh; stars_pos2[i].speed = { speedx: 0.02 * math.random() + 0.005, speedy: 0.03 * math.random() + 0.005, zoomspeed: -math.random() * 0.0005, alphaspeed: -0.0025 }; star.init(stars_pos2[i]); star.textinit(''); txtclick(star.text, ''); star.text.cursor = "pointer"; star.render(stars2); star.texthide(); starsarry.push(star); } // 大星星旁边的小星星 for (var i = 0; i < winheight * 0.05; i++) { star = new bigstar(); star.init({ x: (400 * math.random() + 1000) * picmw, y: (1300 * math.random() + 300) * picmh, scale: 0.1 * math.random() + 0.1, speed: { speedx: 0.02 * math.random() + 0.02, speedy: 0.03 * math.random() + 0.02, zoomspeed: -math.random() * 0.001, alphaspeed: -0.01 * math.random() } }); star.render(stars3); starsarry.push(star); } container.addchild(stars3, stars2, stars1); } /*-----------------------实例-------------------------------------*/ /*tool*/ function bgimg() { this.init = function(option) { this.bg = new createjs.bitmap(option.imgsrc); this.x = option.x; this.y = option.y; this.alpha = option.alpha; this.regx = option.regx; this.regy = option.regy; this.scale = option.scale; }; this.render = function(container) { this.bg.set({ scalex: this.scale, scaley: this.scale, x: this.x, y: this.y, regx: this.regx, regy: this.regy, alpha: this.alpha }); container.addchildat(this.bg, 0); }; this.bgzoom = function(myspeed) { this.bg.set({ scalex: this.bg.scalex + myspeed, scaley: this.bg.scaley + myspeed }) }; this.bgrotate = function(myspeed) { this.bg.rotation += myspeed; }; this.bgchangealpha = function(myspeed) { this.bg.alpha += myspeed; }; this.bgreset = function() { this.bg.set({ scalex: this.scale, scaley: this.scale, rotation: 0 }); }; this.bgresize = function(option) { this.x = option.x; this.y = option.y; this.alpha = option.alpha; this.regx = option.regx; this.regy = option.regy; this.scale = option.scale; this.bg.set({ scalex: this.scale, scaley: this.scale, x: this.x, y: this.y, regx: this.regx, regy: this.regy, alpha: this.alpha }); } } function littlestar() { this.init = function(option) { this.star = new createjs.shape(); this.x = option.x; this.y = option.y; this.r = option.r; this.color = option.color; this.gradient = option.gradient; this.al = option.al; this.star.graphics .beginradialgradientfill(this.color, this.gradient, this.x, this.y, this.r / 50, this.x, this.y, this.r) .drawcircle(this.x, this.y, this.r); }; this.render = function(container) { this.star.alpha = this.al; container.addchild(this.star); }; this.starchangealpha = function(myspeed) { this.star.alpha += myspeed; } } function bigstar() { this.init = function(option) { this.star_txt = new createjs.container(); this.star = new createjs.bitmap('/themes/simplebootx/public/images/star.png'); this.x = option.x; this.y = option.y; this.oldx = option.x; this.oldy = option.y; this.scale = option.scale; this.maxscale = option.maxscale; this.minscale = option.minscale; this.speed = option.speed; }; this.textinit = function(txt) { this.text = new createjs.text(txt, "40px simhei", "#fff"); this.text.set({ x: this.x + this.scale * 200, y: this.y + this.scale * 200, scalex: this.scale, scaley: this.scale }) }; this.render = function(container) { this.star.set({ x: this.x, y: this.y, scalex: this.scale, scaley: this.scale }) this.star_txt.addchild(this.star, this.text); container.addchild(this.star_txt); }; this.starmoveto = function(myspeedx, myspeedy) { this.star.set({ x: this.star.x + (myspeedx ? myspeedx : this.speed.speedx), y: this.star.y + (myspeedy ? myspeedy : this.speed.speedy) }) this.x = this.star.x; this.y = this.star.y; }; this.starzoom = function(myspeed) { this.star.set({ scalex: this.star.scalex + (myspeed ? myspeed : this.speed.zoomspeed), scaley: this.star.scaley + (myspeed ? myspeed : this.speed.zoomspeed) }) } this.changealpha = function(myspeed) { this.star.set({ alpha: this.star.alpha + (myspeed ? myspeed : this.speed.alphaspeed) }) }; this.textchangalpha = function(myspeed) { this.text.alpha += myspeed; }; this.textzoom = function() { this.text.set({ scalex: this.star.scalex, scaley: this.star.scaley }) } this.texthide = function() { if (this.text) { this.text.alpha = 0; } }; this.textshow = function() { if (this.text) { this.text.alpha = 1; } }; this.textchange = function(txt) { this.text.text = txt; }; } function loadingimg(imgsrc, cb) { var img = new image(); img.src = imgsrc; img.onload = function() { cb && cb(); } } function txtclick(elm, e_link) { elm.removealleventlisteners('click'); function tolink() { window.open(e_link); } elm.addeventlistener('click', tolink); } }