var beat_duration = 22312 - 21963;
var time_sb_zero = -13;
var time_intro = 1381;
var time_part1 = 22312;
var time_part2 = 44637;
var time_part3 = 66963;
var time_part3_end = 108823;
var time_part4 = 111614;
var time_part4_spin1_start = 122777;
var time_part4_spin1_end = 124521;
var time_part4_spin2_start = 133939;
var time_part4_spin2_end = 135684;
var time_part4_spin3_start = 139521;
var time_part4_spin3_end = 140916;
var time_part4_spin4_start = 145102;
var time_part4_spin4_end = 146846;
var time_part4_spin5_start = 147893;
var time_part4_spin5_end = 148416;
var time_part4_spin6_start = 156265;
var time_part4_spin6_end = 157486;
var time_part4_spin7_start = 159056;
var time_part4_spin7_end = 160277;
var time_part4_spin8_start = 161846;
var time_part4_spin8_end = 163067;
var time_part4_spin9_start = 164637;
var time_part4_spin9_end = 165858;
var time_part5 = 167428;
var time_part6 = 178591;
var time_part7 = 223242;
var time_part7b = 228823;
var time_part7c = 234405;
var time_part7d = 239986;
var time_part7e = 242777;
var time_part7f = 244085;
var time_kiai1 = 245567;
var time_kiai1_end = 267195;
var time_part_8 = 267893;
var time_kiai2 = 290218;
var time_kiai2_end = 311149;
var time_part_9 = 312544;
var time_part_10 = 357195;
var time_end = 379521;
var time_scoreboard = 396265;
// --- BACKGROUND
var bg_height = 768.0;
var widescreen_scale = 1024.0 / 1366.0;
var sb_scale = 480.0 / bg_height;
var bg = new Sprite("bg.png", Background, Centre);
bg.scale(sb_scale);
bg.fade(time_sb_zero, 0);
// --- BLACK SUN
var bs1 = new Sprite("bs1.png", Foreground, Centre);
var bs2 = new Sprite("bs2.png", Foreground, Centre);
var bs3 = new Sprite("bs3.png", Foreground, Centre);
bs1.scale(sb_scale);
bs2.scale(sb_scale);
bs3.scale(sb_scale * 2);
bs1.fade(0);
bs2.fade(0);
bs3.fade(0);
bs1.moveX(320);
bs2.moveX(320);
bs3.moveX(320);
bs1.moveY(240);
bs2.moveY(240);
bs3.moveY(240);
bs1.rotate(time_sb_zero, time_scoreboard, 0, 200);
bs2.rotate(time_sb_zero, time_scoreboard, 0, -250);
bs3.rotate(time_sb_zero, time_scoreboard, 0, -50);
bs1.additive(time_sb_zero, time_scoreboard);
bs2.additive(time_sb_zero, time_scoreboard);
bs3.additive(time_sb_zero, time_scoreboard);
// --- CIRCLES
var a = new Sprite("a.png", Foreground, Centre);
var b = new Sprite("b.png", Foreground, Centre);
var c = new Sprite("c.png", Foreground, Centre);
a.scale(sb_scale);
b.scale(sb_scale);
c.scale(sb_scale);
a.fade(0);
b.fade(0);
c.fade(0);
a.moveX(320);
b.moveX(320);
c.moveX(320);
a.moveY(240);
b.moveY(240);
c.moveY(240);
a.additive(time_sb_zero, time_scoreboard);
b.additive(time_sb_zero, time_scoreboard);
c.additive(time_sb_zero, time_scoreboard);
function make_bump(a,b,c, time, duration, opacity0, opacity1, instant) {
var blue = 22312 - 22224;
var ta = time;
var tb = time;
var tc = time;
if (instant) {
tb = tb + blue / 2;
tc = tc + blue;
duration = duration - blue;
} else {
ta = ta - blue * 2;
tb = tb - blue;
}
a.fade(1, ta, ta + duration, opacity0, opacity1);
b.fade(1, tb, tb + duration, opacity0, opacity1);
c.fade(1, tc, tc + duration, opacity0, opacity1);
}
function make_bumps(a,b,c, time_start, time_end, duration, opacity0, opacity1, instant) {
var t = time_start;
while (t < time_end) {
var d = duration;
if (t + d > time_end) {
d = t - time_end;
}
make_bump(a,b,c, t, duration, opacity0, opacity1, instant);
t = t + duration;
}
}
function spin(a,b,c, time_start, time_end, type, from, to) {
var deg_to_rad = 3.14 / 180;
var angle = 90 * deg_to_rad;
a.rotate(type, time_start, time_end, angle * from, angle * to);
b.rotate(type, time_start, time_end, - angle * from, - angle * to);
c.rotate(type, time_start, time_end, angle * from, angle * to);
}
function spinbump(a,b,c, time_start, time_end, type, from, to, opacity0, opacity1, instant) {
make_bump(a,b,c, time_start, time_end - time_start, opacity0, opacity1, instant);
spin(a,b,c, time_start, time_end, type, from, to);
}
function shake(a,b,c, time, duration, amplitude, times) {
var x = 320;
var y = 240;
var i = 0;
while (i < times) {
var t = time + duration * i;
a.moveY(t, t + duration, y + amplitude, y - amplitude);
a.moveY(t + duration, y);
b.moveY(t, t + duration, y - amplitude, y + amplitude);
b.moveY(t + duration, y);
c.moveY(t, t + duration, y + amplitude, y - amplitude);
c.moveY(t + duration, y);
i = i + 1;
}
}
function wave(a,b,c, time, duration, amplitude, times) {
var x = 320;
var y = 240;
var i = 0;
while (i < times) {
var t = time + duration * i;
a.moveX(t, t + duration / 2, x - amplitude * 0.5, x + amplitude * 0.5);
a.moveX(t + duration / 2, t + duration, x + amplitude * 0.5, x);
b.moveX(t, t + duration / 2, x - amplitude, x + amplitude);
b.moveX(t + duration / 2, t + duration, x + amplitude, x);
c.moveX(t, t + duration / 2, x + amplitude, x - amplitude);
c.moveX(t + duration / 2, t + duration, x - amplitude, x);
i = i + 1;
}
}
function glow(a,b,c, time_start, time_end) {
var blue = 22312 - 22224;
a.color(1, time_start, time_end, 255, 255, 255, 200, 200, 255);
a.color(time_end, time_end + blue * 4, 200, 200, 255, 255, 255, 255);
b.color(1, time_start, time_end, 255, 255, 255, 200, 200, 255);
b.color(time_end, time_end + blue * 4, 200, 200, 255, 255, 255, 255);
c.color(1, time_start, time_end, 255, 255, 255, 200, 200, 255);
c.color(time_end, time_end + blue * 4, 200, 200, 255, 255, 255, 255);
}
function scalebump(a, b, c, trigger_name, start_time, end_time, duration, base_scale) {
a.startTriggerLoop(trigger_name, start_time, end_time);
a.scale(1, 0, duration, base_scale * 0.90, base_scale);
a.endLoop();
b.startTriggerLoop(trigger_name, start_time, end_time);
b.scale(1, 0, duration, base_scale * 1.10, base_scale);
b.endLoop();
c.startTriggerLoop(trigger_name, start_time, end_time);
c.scale(1, 0, duration, base_scale * 2 * 1.05, base_scale * 2);
c.endLoop();
}
var bump_offset = - beat_duration * 4;
var bump_duration = beat_duration * 8;
// intro / part 1 / 2 / 3
make_bumps(a,b,c, time_intro, time_part1 + bump_offset, bump_duration, 0.3, 0.1, false);
make_bumps(a,b,c, time_part1 + bump_offset, time_part2 + bump_offset, bump_duration, 0.5, 0.2, false);
spin(a,b,c, time_part2, time_part3, 2, 0, 1);
make_bumps(a,b,c, time_part2 + bump_offset, time_part3 + bump_offset, bump_duration, 0.5, 0.3, false);
spin(a,b,c, time_part3, time_part4, 0, 1, 10);
make_bumps(a,b,c, time_part3 + bump_offset, time_part4 + bump_offset * 3, bump_duration, 1, 0.6, false);
make_bump(a,b,c, time_part3_end, time_part4 - time_part3_end, 0.6, 0, false);
// part 4
var shake_amplitude = 8;
spinbump(a,b,c, time_part4_spin1_start, time_part4_spin1_end, 0, 0, 1, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin2_start, time_part4_spin2_end, 0, 1, 2, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin3_start, time_part4_spin3_end, 0, 2, 3, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin4_start, time_part4_spin4_end, 0, 3, 4, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin5_start, time_part4_spin5_end, 0, 4, 5, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin6_start, time_part4_spin6_end, 0, 5, 6, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin7_start, time_part4_spin7_end, 0, 6, 7, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin8_start, time_part4_spin8_end, 0, 7, 8, 0.8, 0.2, true);
spinbump(a,b,c, time_part4_spin9_start, time_part4_spin9_end, 0, 8, 9, 0.8, 0.2, true);
shake(a,b,c, 128358, beat_duration / 8, shake_amplitude, 2);
shake(a,b,c, 128881, beat_duration / 8, shake_amplitude / 2, 2);
shake(a,b,c, 129405, beat_duration / 8, shake_amplitude / 4, 2);
// part 5 / 6
spin(a,b,c, time_part5, time_part6, 2, 9, 10);
spin(a,b,c, time_part6, time_part7, 0, 10, 20);
shake(a,b,c, 180684, beat_duration / 4, shake_amplitude / 4, 7);
shake(a,b,c, 183474, beat_duration / 2, shake_amplitude / 4, 3);
shake(a,b,c, 186265, beat_duration / 4, shake_amplitude / 4, 7);
shake(a,b,c, 189056, beat_duration, shake_amplitude / 4, 2);
shake(a,b,c, 191846, beat_duration / 4, shake_amplitude / 4, 7);
shake(a,b,c, 194637, beat_duration / 2, shake_amplitude / 4, 3);
shake(a,b,c, 197428, beat_duration / 4, shake_amplitude / 4, 7);
shake(a,b,c, 197428, beat_duration / 4, shake_amplitude / 4, 7);
shake(a,b,c, 200218, beat_duration, shake_amplitude / 4, 2);
shake(a,b,c, 206323, beat_duration / 2, shake_amplitude / 4, 1);
shake(a,b,c, 211381, beat_duration / 2, shake_amplitude / 4, 3);
shake(a,b,c, 217486, beat_duration / 2, shake_amplitude / 4, 1);
// part 7
spin(a,b,c, time_part7c, time_part7f, 2, 20, 29);
make_bumps(a,b,c, time_part7, time_part7b, beat_duration * 4, 0.8, 0, true);
make_bumps(a,b,c, time_part7b, time_part7c, beat_duration * 2, 0.5, 0.1, true);
make_bumps(a,b,c, time_part7c, time_part7d, beat_duration, 0.4, 0.2, true);
make_bumps(a,b,c, time_part7d, time_part7e, beat_duration / 2, 0.4, 0.3, true);
make_bumps(a,b,c, time_part7e, time_part7f, beat_duration / 4, 0.5, 0.4, true);
make_bump(a,b,c, time_part7f, beat_duration / 4, 0.4, 0, true);
shake(a,b,c, 230916, beat_duration / 8, shake_amplitude / 4, 14);
shake(a,b,c, 231614, beat_duration / 8, shake_amplitude / 6, 14);
shake(a,b,c, 232312, beat_duration / 8, shake_amplitude / 8, 14);
shake(a,b,c, 233707, beat_duration / 8, shake_amplitude / 6, 14);
shake(a,b,c, 242777, beat_duration / 4, shake_amplitude / 8, 17);
// kiai 1
function kiai(a,b,c, bs1,bs2,bs3, start_time, end_time) {
var beat_duration = 22312 - 21963;
var offset = start_time - 245567;
var time_kiai1_start = 245567 + offset;
var time_kiai1_end = 250102 + offset;
var time_kiai2_start = 251149 + offset;
var time_kiai2_end = 256381 + offset;
var time_kiai3_start = 256730 + offset;
var time_kiai3_end = 261439 + offset;
var time_kiai4_start = 262312 + offset;
var time_kiai4_end = 267195 + offset;
if (time_kiai4_end > end_time) {
time_kiai4_end = end_time;
}
// black sun
make_bump(bs1,bs2,bs3, time_kiai1_start, time_kiai1_end - time_kiai1_start, 0, 1, true);
make_bump(bs1,bs2,bs3, time_kiai1_end, time_kiai2_start - time_kiai1_end, 0.2, 0, true);
make_bump(bs1,bs2,bs3, time_kiai2_start, time_kiai2_end - time_kiai2_start, 0, 1, true);
make_bump(bs1,bs2,bs3, time_kiai2_end, time_kiai3_start - time_kiai2_end, 0.2, 0, true);
make_bump(bs1,bs2,bs3, time_kiai3_start, time_kiai3_end - time_kiai3_start, 0, 1, true);
bs1.startTriggerLoop(HitSoundClap, start_time, end_time);
bs2.startTriggerLoop(HitSoundClap, start_time, end_time);
bs3.startTriggerLoop(HitSoundClap, start_time, end_time);
shake(bs1,bs2,bs3, 0, beat_duration / 4, 4, 2);
bs1.endLoop();
bs2.endLoop();
bs3.endLoop();
// circles
make_bump(a,b,c, time_kiai1_start, time_kiai1_end - time_kiai1_start, 0.3, 0.4, false);
make_bump(a,b,c, time_kiai2_start, time_kiai2_end - time_kiai2_start, 0.3, 0.4, false);
make_bump(a,b,c, time_kiai3_start, time_kiai3_end - time_kiai3_start, 0.3, 0.4, false);
spin(a,b,c, time_kiai1_start, time_kiai1_end, 2, 29, 50);
spin(a,b,c, time_kiai1_end, time_kiai2_start, 0, 50, 49);
spin(a,b,c, time_kiai2_start, time_kiai2_end, 2, 49, 70);
spin(a,b,c, time_kiai2_end, time_kiai3_start, 0, 70, 69);
spin(a,b,c, time_kiai3_start, time_kiai3_end, 2, 69, 90);
spin(a,b,c, time_kiai3_end, time_kiai4_start, 0, 90, 89);
spin(a,b,c, time_kiai4_start, time_kiai4_end, 2, 89, 120);
spin(a,b,c, time_kiai4_end, time_kiai4_end + beat_duration / 4, 1, 120, 29);
glow(a,b,c, time_kiai1_start, time_kiai1_end);
glow(a,b,c, time_kiai2_start, time_kiai2_end);
glow(a,b,c, time_kiai3_start, time_kiai3_end);
glow(a,b,c, time_kiai4_start, time_kiai4_end);
make_bump(a,b,c, time_kiai4_end, beat_duration / 4, 0.4, 0, true);
a.startTriggerLoop(HitSoundFinish, start_time, end_time);
b.startTriggerLoop(HitSoundFinish, start_time, end_time);
c.startTriggerLoop(HitSoundFinish, start_time, end_time);
wave(a,b,c, 0, beat_duration * 8, 16, 1);
a.endLoop();
b.endLoop();
c.endLoop();
}
kiai(a,b,c, bs1,bs2,bs3, time_kiai1, time_kiai1_end);
// part 8
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_8, time_kiai2, beat_duration, sb_scale);
make_bump(bs1,bs2,bs3, 288823, time_kiai2 - 288823, 1, 0, true);
// kiai 2
kiai(a,b,c, bs1,bs2,bs3, time_kiai2, time_kiai2_end);
// part 9
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_9, time_part_10, beat_duration, sb_scale);
// part 10
var part10_eigth = (time_end - time_part_10) / 8.0;
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10, time_part_10 + part10_eigth, beat_duration, sb_scale * 0.90);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth, time_part_10 + part10_eigth * 2, beat_duration, sb_scale * 0.85);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth * 2, time_part_10 + part10_eigth * 3, beat_duration, sb_scale * 0.80);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth * 3, time_part_10 + part10_eigth * 4, beat_duration, sb_scale * 0.75);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth * 4, time_part_10 + part10_eigth * 5, beat_duration, sb_scale * 0.70);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth * 5, time_part_10 + part10_eigth * 6, beat_duration, sb_scale * 0.65);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth * 6, time_part_10 + part10_eigth * 7, beat_duration, sb_scale * 0.60);
scalebump(bs1,bs2,bs3, HitSoundClap, time_part_10 + part10_eigth * 7, time_end, beat_duration, sb_scale * 0.55);
shake(bs1,bs2,bs3, 364870, beat_duration / 4, shake_amplitude / 4, 7);
shake(bs1,bs2,bs3, 365567, beat_duration / 4, shake_amplitude / 4, 7);
shake(bs1,bs2,bs3, 365567, beat_duration / 2, shake_amplitude / 4, 5);
// end
make_bump(bs1,bs2,bs3, time_end, time_scoreboard - time_end, 1, 0, true);