--Script Informationen script_name = "Sora no Otoshimono ED2" script_description = "Flying pantsu." script_author = "Youka" script_version = "1.0" --Kara-Skelett einfügen include("karaskel.lua") --ROMAJI function rom(subs,line,meta) --Variablen vorbereiten local ccolor = color_distro(line) local cpos = {} --Einblendung local posxa, ci, cn = line.left, 0, unicode.len(line.text_stripped) for c in unicode.chars(line.text_stripped) do local l = table.copy(line) ci = ci + 1 local cwidth,cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.middle l.layer = math.random(1,cn)+cn local in_t = math.random(line.infade+500,line.infade+800) l.start_time = line.start_time - in_t l.end_time = line.start_time local movx, movy = math.random(line.width/2,line.width*2/3), math.random(line.margin_v*2/3,line.margin_v+cheight) local wdur = fdur*10 local wush = math.ceil(in_t/wdur) for wi=1,2 do local cly1,cly2 if wi==1 then cly1,cly2 = 0, line.middle else cly1, cly2 = line.middle, meta.res_y end l.text = string.format("{\fs%d\alpha&HFF&\t(0.5,\alpha&H00&)\clip(0,%d,%d,%d)\t(\clip(0,%d,%d,%d)\fs%d)\an5\move(%.2f,%.2f,%.2f,%.2f)\bord1\be1%s}%s",line.styleref.fontsize+4,cly1+movy,meta.res_x,cly2+movy,cly1,meta.res_x,cly2,line.styleref.fontsize,posx-movx,posy+movy,posx,posy,ccolor[ci],c) for s=1, wush do local aa, bb = (s-1)*wdur,s*wdur local frx = 70*row_test(s,2)*row_test(wi,2) if s == wush then frx = 0 end local wing = string.format("\t(%d,%d,2,\frx%d)}",aa,bb,frx) l.text = l.text:gsub("}",wing) end subs.append(l) end posxa = posxa + cwidth end --Standard local ci,cn = 0, unicode.len(line.text_stripped) local cdur, tolerance = fdur * 50, 8 for k=1, #line.kara do local syl = line.kara[k] local posxa = line.left+syl.left for c in unicode.chars(syl.text_stripped) do ci = ci + 1 local l = table.copy(line) local cwidth, cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.top local posx1, posy1 = posx, posy local frames = math.ceil(line.duration/cdur) l.layer = cn-ci+1 for fi=1, frames do local movx, movy, posx2, posy2 repeat movx, movy = math.random(-2,2), math.random(-2,2) posx2, posy2 = posx1+movx, posy1+movy until (posx2posx-cwidth/tolerance) and (posy2posy-cheight/tolerance) if fi == frames then posx2, posy2 = posx,posy end l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1,posy1,posx2,posy2,ccolor[ci],c) l.start_time = line.start_time + (fi-1) * cdur l.end_time = l.start_time + cdur if l.end_time > line.start_time+syl.start_time then l.end_time = line.start_time+syl.start_time if l.start_time>l.end_time then break end cpos[ci] = { x = posx2, y = posy2, layer = l.layer } end posx1, posy1 = posx2, posy2 subs.append(l) end posxa = posxa + cwidth end end --Silben-Effekt local ci,cn = 0, unicode.len(line.text_stripped) for k=1, #line.kara do local syl = line.kara[k] for c in unicode.chars(syl.text_stripped) do ci = ci + 1 local l = table.copy(line) local posx, posy = cpos[ci].x, cpos[ci].y l.layer = 0 local sdur = syl.duration + 500 l.start_time = line.start_time + syl.start_time l.end_time = l.start_time + sdur local xway, yway = math.random(line.width/2,line.width*2/3), -(line.styleref.margin_v+line.height/2) local stribe = 1 local stribes = (line.height + 4)/stribe for s=1, stribes do local py = line.top-2 + (s-1)*stribe local aa, bb = sdur - 500, sdur local frz = math.random(5,20)*0.001 l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\fad(0,500)\clip(0,%d,%d,%d)\t(\clip(0,%d,%d,%d))\org(%d,100000)\t(%d,%d,\frz%.3f)}%s",posx,posy,posx+xway,posy+yway,ccolor[ci],py,meta.res_x,py+stribe,py+yway,meta.res_x,py+stribe+yway,meta.res_x/2,aa,bb,-frz,c) subs.append(l) end end end end function rom1(subs,line,meta) --Variablen vorbereiten local ccolor = color_distro(line) local cpos = {} --Einblendung local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped) for c in unicode.chars(line.text_stripped) do ci = ci + 1 local l = table.copy(line) local cwidth, cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.top l.layer = cn-ci l.start_time = line.start_time-line.infade-500 l.end_time = line.start_time for i=1, 2 do local al = (i-1)*130 l.start_time = l.start_time + fdur*(i-1) l.end_time = l.end_time + fdur*(i-1) l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\alpha&H%x&\fad(500,0)}%s",posx-math.random(line.width,line.width*1.2),posy+math.random(line.margin_v*2/3,line.margin_v+cheight),posx-15,posy,ccolor[ci],al,c) subs.append(l) end posxa = posxa + cwidth end --Standard local ci,cn = 0, unicode.len(line.text_stripped) local cdur, tolerance, way = fdur * 30, 6, 30 for k=1, #line.kara do local syl = line.kara[k] local posxa = line.left + syl.left for c in unicode.chars(syl.text_stripped) do ci = ci + 1 local l = table.copy(line) local cwidth, cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2 - way/2, line.top local posx1 = posx local frames = math.floor(line.duration/cdur) l.layer = cn-ci for fi=1, frames do local wstep1,wstep2 = math.ceil(way/frames)*(fi-1), math.ceil(way/frames)*fi local mini,maxi = posx-cwidth/tolerance, posx+cwidth/tolerance local movx, posx2 repeat movx = math.random(-3,3) posx2 = posx1+movx until (posx2mini) if fi == frames then posx2 = posx + way/2 - math.ceil(way/frames) end l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1+wstep1,posy,posx2+wstep2,posy,ccolor[ci],c) l.start_time = line.start_time + (fi-1) * cdur l.end_time = l.start_time + cdur if l.end_time > line.start_time+syl.start_time then l.end_time = line.start_time+syl.start_time if l.start_time>l.end_time then break end local t_mov = line.start_time+syl.start_time-l.start_time local pct_mov = t_mov/cdur local movx2 = (posx2-posx1)*pct_mov cpos[ci] = { x = posx2+wstep2, layer = l.layer } end posx1 = posx2 subs.append(l) end posxa = posxa + cwidth end end --Silben-Effekt local ci,cn = 0, unicode.len(line.text_stripped) for k=1, #line.kara do local syl = line.kara[k] for c in unicode.chars(syl.text_stripped) do ci = ci + 1 local l = table.copy(line) local posx, posy = cpos[ci].x, line.top l.layer = cpos[ci].layer local sdur = syl.duration + 500 l.start_time = line.start_time + syl.start_time l.end_time = l.start_time + sdur local xway, yway = math.random(line.width/2,line.width*2/3), -(line.margin_v+line.height+2) l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\fad(0,300)}%s",posx,posy,posx+xway,posy+yway,ccolor[ci],c) local fldur = fdur*4 local flak = math.ceil((sdur)/fldur) for f=flak, 1, -1 do local alp = (row_test(f-1,2)+1)/2*85 local aa, bb = (f-1) * fldur, f * fldur local altxt = string.format("{\t(%d,%d,\alpha&H%x&)",aa,bb,alp) l.text = l.text:gsub("{",altxt) end subs.append(l) local frames = math.ceil(sdur/fdur) for fr=1, frames do if row_test(fr,8)==1 then local pct = fr/frames local movxx, movyy = pct*xway, pct*yway local posxx, posyy = posx+movxx, line.middle+movyy l.text = string.format("{\an5\pos(%.2f,%.2f)\bord1\blur1\fad(200,600)\t(\fs%d)\1a&HFF&\3c&HB0B0B0&\3a&H20&}%s",posxx,posyy,line.styleref.fontsize+14,c) l.start_time = line.start_time + syl.start_time + (fr-1)*fdur l.end_time = l.start_time + 800 subs.append(l) end end end end end --TRANS function trans(subs,line,meta) --Variablen vorbereiten local ccolor = color_distro(line) --Einblendung local posxa, ci, cn = line.left, 0, unicode.len(line.text_stripped) for c in unicode.chars(line.text_stripped) do local l = table.copy(line) ci = ci + 1 local cwidth,cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.middle l.layer = math.random(1,cn)+cn local in_t = math.random(line.infade+500,line.infade+800) l.start_time = line.start_time - in_t l.end_time = line.start_time local movx, movy = math.random(line.width/2,line.width*2/3), math.random(line.margin_v*2/3,line.margin_v+cheight) local wdur = fdur*10 local wush = math.ceil(in_t/wdur) for wi=1,2 do local cly1,cly2 if wi==1 then cly1,cly2 = 0, line.middle else cly1, cly2 = line.middle, meta.res_y end l.text = string.format("{\fs%d\alpha&HFF&\t(0.5,\alpha&H00&)\clip(0,%d,%d,%d)\t(\clip(0,%d,%d,%d)\fs%d)\an5\move(%.2f,%.2f,%.2f,%.2f)\bord1\be1%s}%s",line.styleref.fontsize+4,cly1+movy,meta.res_x,cly2+movy,cly1,meta.res_x,cly2,line.styleref.fontsize,posx-movx,posy+movy,posx,posy,ccolor[ci],c) for s=1, wush do local aa, bb = (s-1)*wdur,s*wdur local frx = 70*row_test(s,2)*row_test(wi,2) if s == wush then frx = 0 end local wing = string.format("\t(%d,%d,2,\frx%d)}",aa,bb,frx) l.text = l.text:gsub("}",wing) end subs.append(l) end posxa = posxa + cwidth end --Ausblendung local posxa, ci, cn = line.left, 0, unicode.len(line.text_stripped) for c in unicode.chars(line.text_stripped) do local l = table.copy(line) ci = ci + 1 local cwidth,cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.middle l.layer = math.random(1,cn) local out_t = math.random (line.outfade+500,line.outfade+800) l.text = string.format("{\t(\fs%d\frx-80)\an5\t(2,\alpha&HFF&)\move(%.2f,%.2f,%.2f,%.2f)\bord1\be1%s}%s",line.styleref.fontsize-6,posx,posy,posx+math.random(line.width*2/3,line.width*1.33),posy+math.random(line.margin_v*2/3,line.margin_v+cheight),ccolor[ci],c) l.start_time = line.end_time l.end_time = l.start_time + out_t subs.append(l) posxa = posxa + cwidth end --Standard local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped) local cdur, tolerance = fdur * 50, 8 for c in unicode.chars(line.text_stripped) do ci = ci + 1 local l = table.copy(line) local cwidth, cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.bottom local posx1, posy1 = posx, posy local frames = math.ceil(line.duration/cdur) l.layer = cn-ci for fi=1, frames do local movx, movy, posx2, posy2 repeat movx, movy = math.random(-2,2), math.random(-2,2) posx2, posy2 = posx1+movx, posy1+movy until (posx2posx-cwidth/tolerance) and (posy2posy-cheight/tolerance) if fi == frames then posx2, posy2 = posx,posy end l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1,posy1,posx2,posy2,ccolor[ci],c) l.start_time = line.start_time + (fi-1) * cdur l.end_time = l.start_time + cdur if l.end_time > line.end_time then l.end_time = line.end_time end posx1, posy1 = posx2, posy2 subs.append(l) end posxa = posxa + cwidth end end function trans1(subs,line,meta) --Variablen vorbereiten local ccolor = color_distro(line) --Ein-/Ausblendung local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped) for c in unicode.chars(line.text_stripped) do ci = ci + 1 local l = table.copy(line) local cwidth, cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2, line.bottom local px1, py1, px2, py2, t1, t2 for fa=1, 2 do l.layer = cn-ci if fa==1 then l.start_time = line.start_time-line.infade-500 l.end_time = line.start_time px1, py1 = -math.random(line.width,line.width*1.2), math.random(line.margin_v*2/3,line.margin_v+cheight) px2, py2 = -15, 0 t1, t2 = 500, 0 else l.start_time = line.end_time l.end_time = l.start_time + line.outfade + 800 px1, py1 = 30, 0 px2, py2 = math.random(line.width,line.width*1.2), math.random(line.margin_v*2/3,line.margin_v+cheight) t1, t2 = 0, 800 end for i=1, 2 do local al = (i-1)*130 l.start_time = l.start_time + fdur*(i-1) l.end_time = l.end_time + fdur*(i-1) l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\alpha&H%x&\fad(%d,%d)}%s",posx+px1,posy+py1,posx+px2,posy+py2,ccolor[ci],al,t1,t2,c) subs.append(l) end end posxa = posxa + cwidth end --Standard local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped) local cdur, tolerance, way = fdur * 30, 6, 30 for c in unicode.chars(line.text_stripped) do ci = ci + 1 local l = table.copy(line) local cwidth, cheight = aegisub.text_extents(line.styleref, c) local posx, posy = posxa + cwidth/2 - way/2, line.bottom local posx1 = posx local frames = math.floor(line.duration/cdur) l.layer = cn-ci for fi=1, frames do local wstep1,wstep2 = math.ceil(way/frames)*(fi-1), math.ceil(way/frames)*fi local mini,maxi = posx-cwidth/tolerance, posx+cwidth/tolerance local movx, posx2 repeat movx = math.random(-3,3) posx2 = posx1+movx until (posx2mini) if fi == frames then posx2 = posx + way/2 - math.ceil(way/frames) end l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1+wstep1,posy,posx2+wstep2,posy,ccolor[ci],c) l.start_time = line.start_time + (fi-1) * cdur l.end_time = l.start_time + cdur if fi==frames then l.end_time = line.end_time end posx1 = posx2 subs.append(l) end posxa = posxa + cwidth end end --Testet, ob Zahl in Hit-Reihe ist; "Ja" = 1; "Nein" = -1 function row_test(int,hit) return -(math.ceil(math.ceil(int/hit)-int/hit)*2-1) end --Erstellt Farb-Table für Buchstaben function color_distro(line) local ccolor, ci, colortest = {}, 0, "" for c in unicode.chars(line.text_stripped) do ci = ci + 1 local color repeat color = pantsu_colors[math.random(1,table.maxn(pantsu_colors))] until color~=colortest if c~=" " then colortest = color end ccolor[ci] = color end return ccolor end --Zeit für Ein- und Ausblendung function in_and_outfade(subs,line,i) if i > 1 and ir>1 and it>1 then line.infade = subs[i].start_time - subs[i-1].end_time else line.infade = 800 end if i Comment if ctest~=1 then sub.effect = "fx" sub.comment = true else sub.effect = "basic" end end subs[si] = sub end --Aktualisiert Display; unterbricht bei "Cancel" den Durchgang der Lines aegisub.progress.set(si/subs.n*100) if aegisub.progress.is_cancelled() then break end end --FX abgeschlossen; Undo-Point erstellen aegisub.progress.task("FX abgeschlossen!") aegisub.progress.set(100) aegisub.set_undo_point(script_name) end --Makro erstellen aegisub.register_macro(script_name,script_description,load_progress)