Advertisement
teplofizik

vsfilter_lua_test.lua

Aug 8th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. --[[
  2.     Sample extended ass script
  3.  
  4. ]]
  5.  
  6. require("karalib_color")
  7.  
  8. function init()
  9.  
  10. end
  11.  
  12. function animate(line,radius)
  13.     local r = {}
  14.     r.style = {}
  15.     -- Жирный
  16.     r.style.bold = true
  17.  
  18.     -- Процент отображения строки
  19.     local perc = line.time / line.length
  20.  
  21.     -- Размытие растёт от 0 до 5: \t(\blur5)
  22.     r.style.blur = 5 * perc
  23.  
  24.     -- Размер шрифта 40, без тени и окаёмки
  25.     r.style.fs = 40
  26.     r.style.bordx = 0
  27.     r.style.bordy = 0
  28.     r.style.shadx = 0
  29.     r.style.shady = 0
  30.  
  31.     -- Покачивание в пределах -10..10 граусов, 5 раз
  32.     r.style.frz = 10*math.sin(5*math.pi*perc)
  33.  
  34.     -- Уменьшение: \t(\fsc40)
  35.     r.style.fsx = 100 - 60*perc
  36.     r.style.fsy = 100 - 60*perc
  37.  
  38.     -- Цвет по радуге (функция из самопальной библиотеки)
  39.     local col = color.create_hsv(perc, 1, 0.5)
  40.     r.style.c1 = col:get_color()
  41.  
  42.     -- Вращние по спирали, начальный радиус задаётся параметром из файла субтитров
  43.     r.pos = {}
  44.     r.pos.x = 300 + radius*math.cos(2*math.pi*perc)*(1+3*perc)
  45.     r.pos.y = 300 + radius*math.sin(2*math.pi*perc)*(1+3*perc)
  46.  
  47.     return r
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement