-- Transforms a sign back and forth between two states in specified intervals, -- for example making the sign grow larger and smaller repeatedly each 600ms. script_name = "Back and Forth Transform" script_description = "Transforms between two sets of tags in specified intervals" script_author = "unanimated" script_version = "1.0" include("karaskel.lua") function tra(subs, sel) local meta,styles=karaskel.collect_head(subs,false) for z, i in ipairs(sel) do local line = subs[i] local text = subs[i].text karaskel.preproc_line(sub,meta,styles,line) int=results["int"] -- get results from user input tags1=results["intag"] tags2=results["outag"] dur=line.duration count=math.ceil(dur/int) t=1 tin=0 tout=tin+int if text:match("^{")==nil then text="{\\}"..text end -- add {\} if line has no tags text=text:gsub("^({\\[^}]*)}","%1"..tags1.."}") -- write initial tags -- main function while t<=math.ceil(count/2) do text=text:gsub("^({\\[^}]*)}","%1\\t("..tin..","..tout..","..tags2..")}") if tin+int