美文网首页
高级弹幕×宅舞新尝试!

高级弹幕×宅舞新尝试!

作者: oliver661 | 来源:发表于2016-06-13 10:38 被阅读59次

花了大概三天的时间把 @黑白KUMA酱 @腰折的小饼 的宅舞新作http://www.bilibili.tv/video/av490339/ 加入了高级弹幕特效,从中文翻译歌词到视频特效,让宅舞更添色彩! 宽屏播放推奖!!!

全部高级弹幕代码如下!中文歌词见这里

/*☆◎ 魔 法 阵 爆 炸 ◎☆*/

function createHollowCircle(g,x,y,r,mr){

g.graphics.drawCircle(x,y,r);

g.graphics.drawCircle(x,y,mr);

}

function drawStar(g, x, y, innerRadius, outerRadius, points, angle ){

var drawStar_count=Math.abs(points);

if (drawStar_count>=2){

var step=(Math.PI*2)/points;

var halfStep=step/2;

var start=(angle/180)*Math.PI;

g.graphics.moveTo(x+(Math.cos(start)*outerRadius),y-(Math.sin(start)*outerRadius));

for (var i=1;i<=drawStar_count*2;i++){

var radius = (i%2==0 ? outerRadius : innerRadius);

g.graphics.lineTo(x+(Math.cos(start+(halfStep*i))*radius),y-(Math.sin(start+(halfStep*i))*radius));

}

}

}

var i=0;

for(i=1;i<40;i++){ clear; var randangle=(Math.random()*2)*Math.PI; var randlongway=400+Math.random()*800; var bb = $.createShape({ lifeTime: 0.7+Math.random()*1, motionGroup:[{ x:{ fromValue:Player.videoWidth/2, toValue:Player.videoWidth/2+Math.cos(randangle)*randlongway }, y:{ fromValue:Player.videoHeight/2, toValue:Player.videoHeight/2+Math.sin(randangle)*randlongway }, alpha:{ fromValue:Math.random()*0.7, toValue:Math.random()*0.2, easing:"Back" } }] }); bb.graphics.beginFill(Math.random()>0.5?"0xFFF000":"0xFFFFF1");

/*bb.graphics.drawCircle(0,0,5+Math.random()*5); */

createHollowCircle(bb,0,0,5+Math.random()*5,Math.random()*5);

bb.graphics.endFill();

}

var r=0;

var turn=1;

interval(function(){

turn+=1;

/*r=turn*turn/10*20;*/

r=-0.5*turn*turn+20*turn;

}, 50, 20);

interval(function() {

clear;

var clr = $.createShape({

x : Player.videoWidth/2,

y : Player.videoHeight/2,

lifeTime : 0.05,

alpha: 0.7*(25-turn)/25

});

clr.graphics.beginFill(Math.random()>0.3?"0xFF6666":"0xFEFEFE");

createHollowCircle(clr,0,0,r*2+40,r*2+20);

clr.graphics.endFill();

}, 50, 20);

interval(function() {

clear;

var str = $.createShape({

x : Player.videoWidth/2,

y : Player.videoHeight/2,

lifeTime : 0.05,

alpha: 0.7*(25-turn)/25

});

str.graphics.beginFill(Math.random()>0.5?"0xFFF000":"0xFFFFF1");

drawStar(str,0,0,r+20,(r+20)*2,5,r*0.5);

drawStar(str,0,0,r,r*2,5,r*0.5);

str.graphics.endFill();

}, 50, 20);

/* 介 绍 */

function createTriangle(g,width,height){

/*g.graphics.moveTo(0,0);

g.graphics.lineTo(width/2,0);

g.graphics.lineTo(0,height);

g.graphics.lineTo(-width/2,0);

g.graphics.lineTo(0,0);*/

g.graphics.moveTo(width/2,0);

g.graphics.lineTo(0,height);

g.graphics.lineTo(-width/2,0);

}

var triang_bing = $.createShape({

x: Player.videoWidth*0.32,

y: Player.videoHeight*0.20,

lifeTime: 4,

motionGroup:[{

rotationY:{

fromValue:0,toValue:1800

},

alpha:{

fromValue:0.9,toValue:0.3,startDelay:3000,lifeTime:1

}

}]

});

triang_bing.graphics.beginFill("0xC8CFB3");

createTriangle(triang_bing,10,20);

triang_bing.graphics.endFill();

triang_bing.graphics.lineStyle(0.5, "0x8F604F", 0.9, true, "normal","round", "miter", 10);

createTriangle(triang_bing,10,20);

var text_bing = $.createComment("小饼",{

x: Player.videoWidth*0.28,

y: Player.videoHeight*0.12,

lifeTime: 4,

motionGroup:[{

alpha:{

fromValue:0.9,toValue:0.3,startDelay:3000,lifeTime:1

}

}]

});

text_bing.fontsize=18;

text_bing.border=false;

var triang_kuma = $.createShape({

x: Player.videoWidth*0.69,

y: Player.videoHeight*0.20,

lifeTime: 4,

motionGroup:[{

rotationY:{

fromValue:0,toValue:1800

},

alpha:{

fromValue:0.9,toValue:0.3,startDelay:3000,lifeTime:1

}

}]

});

triang_kuma.graphics.beginFill("0xB77B65");

createTriangle(triang_kuma,10,20);

triang_kuma.graphics.endFill();

triang_kuma.graphics.lineStyle(0.5, "0x231C24", 0.9, true, "normal","round", "miter", 10);

createTriangle(triang_kuma,10,20);

var text_kuma = $.createComment("KUMA酱",{

x: Player.videoWidth*0.63,

y: Player.videoHeight*0.12,

lifeTime: 4,

motionGroup:[{

alpha:{

fromValue:0.9,toValue:0.3,startDelay:3000,lifeTime:1

}

}]

});

text_kuma.fontsize=18;

text_kuma.border=false;

/* 圆 雪 片 */

function creatLeafParticle(){

var lfprt = $.createShape({

x:Player.videoWidth*Math.random(),

y:0,

lifeTime: 3+Math.random()*5,

motionGroup:[{

y:{

fromValue:Player.videoHeight*Math.random()*0.2,

toValue:Player.videoHeight*(0.3+Math.random()*0.7),

easing:"Circular"

},

alpha:{

fromValue:0.7*Math.random(),

toValue:0,

startDelay:3+Math.random()*2

},

rotationX:{

fromValue:0,

toValue:180+Math.random()*540

},

rotationY:{

fromValue:0,

toValue:180+Math.random()*540

},

rotationZ:{

fromValue:0,

toValue:180+Math.random()*540

}

}]

});

lfprt.graphics.beginGradientFill("linear", [0xFFFFFF, 0xFF6666],[1,0.3],[0,255] , $.createGradientBox(10,10,Math.PI/2,0,0));

lfprt.graphics.drawCircle(0,0,0.5+Math.random()*3);

lfprt.graphics.endFill();

}

interval(function() {

clear;

for(i=1;i<40;i++){ creatLeafParticle(); } }, 500, 25); /* 间 奏 进 行 中 */ function drawNote1(drwNt1,w,h){ var sclw=w/300; var sclh=h/350; drwNt1.graphics.moveTo(-60*sclw,-151*sclh); drwNt1.graphics.lineTo (-60*sclw,97*sclh); drwNt1.graphics.curveTo(-102*sclw,88*sclh,-139*sclw,136*sclh); drwNt1.graphics.curveTo(-163*sclw,182*sclh,-130*sclw,196*sclh); drwNt1.graphics.curveTo(-98*sclw,200*sclh, -72*sclw,177*sclh); drwNt1.graphics.curveTo(-41*sclw,153*sclh,-48*sclw,100*sclh); drwNt1.graphics.lineTo(-48*sclw,53*sclh); drwNt1.graphics.lineTo(-48*sclw,-122*sclh); drwNt1.graphics.lineTo (129*sclw,-122*sclh); drwNt1.graphics.lineTo(129*sclw,97*sclh); drwNt1.graphics.curveTo(85*sclw,89*sclh,49*sclw,136*sclh); drwNt1.graphics.curveTo(25*sclw,181*sclh,58*sclw,196*sclh); drwNt1.graphics.curveTo(90*sclw,200*sclh,116*sclw,177*sclh); drwNt1.graphics.curveTo(146*sclw,153*sclh,141*sclw,100*sclh); drwNt1.graphics.lineTo(140*sclw,53*sclh); drwNt1.graphics.lineTo (140*sclw,-151*sclh); drwNt1.graphics.lineTo(-60*sclw,-151*sclh); } function drawNote2(drwNt2,w,h){ var sclw=w/200; var sclh=h/350; drwNt2.graphics.moveTo(sclw*-0,sclh*-150); drwNt2.graphics.lineTo (sclw*-0,sclh*100); drwNt2.graphics.curveTo(sclw*-45,sclh*90,sclw*-83,sclh*140); drwNt2.graphics.curveTo(sclw*-108,sclh*188,sclw*-74,sclh*203); drwNt2.graphics.curveTo(sclw*-40,sclh*207,sclw*-13, sclh*183); drwNt2.graphics.curveTo(sclw*19,sclh*158,sclw*10,sclh*102); drwNt2.graphics.lineTo(sclw*10,sclh*100); drwNt2.graphics.lineTo(sclw*10,sclh*-90); drwNt2.graphics.curveTo(sclw*102,sclh*19, sclw*64,sclh*95); drwNt2.graphics.curveTo(sclw*125,sclh*3,sclw*53,sclh*-81); drwNt2.graphics.curveTo(sclw*20,sclh*-116,sclw*10,sclh*-150); drwNt2.graphics.lineTo(sclw*-0,sclh*-150); } function creatNoteflow(){ var sx=Math.random()>0.5?10*Math.random():Player.videoWidth-10*Math.random();

var noteflow= $.createShape({

y:sx>100?10*Math.random()+20:Player.videoHeight-20*Math.random(),

lifeTime:1+1.5*Math.random(),

motionGroup:[{

x:{

fromValue:sx,

toValue:sx>100?0:Player.videoWidth

},

alpha:{

fromValue:0.7+0.3*Math.random(),

toValue:Math.random()*0.3,

startDelay:1

},

rotationY:{

fromValue:0,

toValue:180+Math.random()*540,

repeat:1+Math.random()*3,

lifeTime:0.7

}

}]

});

noteflow.graphics.beginFill(0xFFFFFF*Math.random());

Math.random()>0.5?drawNote1(noteflow,20+15*Math.random(),25+15*Math.random()):drawNote2(noteflow,20+5*Math.random(),25+15*Math.random());

noteflow.graphics.endFill();

}

interval(function() {

clear;

for(i=1;i<6;i++){

creatNoteflow();

}

}, 160, 110);

var bgmwd=$.createComment("间奏进行中...",{

x:Player.videoWidth-160,

y:Player.videoHeight-40,

fontsize:23,

lifeTime:20,

motion:{

alpha:{

fromValue:0.9,

toValue:0.3,

repeat:30,

lifeTime:0.652

}

}

});

bgmwd.font="楷体";

bgmwd.bold=true;

var sndnote1 = $.createShape({

x:Player.videoWidth-150,

y:Player.videoHeight-40,

lifeTime: 22,

alpha:0.3,

motionGroup:[{

x:{

fromValue:Player.videoWidth-150,

toValue:Player.videoWidth-20

},

rotationZ:{

fromValue:0,

toValue:360,

lifeTime:1.4,

repeat:15

},

alpha:{

fromValue:0.3,

toValue:0,

stratDelay:21

}

}]

});

sndnote1.graphics.beginFill("0xFFFFFF");

drawNote1(sndnote1,60,70);

sndnote1.graphics.endFill();

var sndnote2 = $.createShape({

x:Player.videoWidth-125,

y:Player.videoHeight-55,

lifeTime: 22,

alpha:0.5,

motionGroup:[{

x:{

fromValue:Player.videoWidth-150,

toValue:Player.videoWidth-10,

easing:"Exponential"

},

rotationZ:{

fromValue:0,

toValue:720,

lifeTime:1.4,

repeat:15

},

alpha:{

fromValue:0.2,

toValue:0,

stratDelay:21

}

}]

});

sndnote2.graphics.beginFill("0xFFFFFF");

drawNote2(sndnote2,35,60);

sndnote2.graphics.endFill();

var sndnote3 = $.createShape({

x:Player.videoWidth-175,

y:Player.videoHeight-30,

lifeTime: 22,

alpha:0.4,

motionGroup:[{

x:{

fromValue:Player.videoWidth-150,

toValue:Player.videoWidth-35,

easing:"Quadratic"

},

rotationZ:{

fromValue:0,

toValue:1080,

lifeTime:1.4,

repeat:15

},

alpha:{

fromValue:0.4,

toValue:0,

stratDelay:21

}

}]

});

sndnote3.graphics.beginFill("0xFFFFFF");

drawNote2(sndnote3,20,35);

sndnote3.graphics.endFill();

相关文章

网友评论

      本文标题:高级弹幕×宅舞新尝试!

      本文链接:https://www.haomeiwen.com/subject/gmrydttx.html