Star Flow Effect
function Start()
stars = {}
end
function Update()
for i = 1, #stars do
stars[i] = nil
end
minx, miny, maxx, maxy = 10000, 10000, 0, 0
end
function UpdateS()
stars[#stars+1] = shape
local pos = shape.OriPos
minx = math.min(minx, pos.x)
miny = math.min(miny, pos.y)
maxx = math.max(maxx, pos.x)
maxy = math.max(maxy, pos.y)
end
function LateUpdate()
if #stars > 3 then
--local cx = (minx + maxx) / 2
--local cy = (miny + maxy) / 2
local delta = (maxx + maxy - minx - miny) / 3
--print(cx .. " - " .. minx .. " - " .. maxx)
for i = 1, #stars do
local shape = stars[i]
local ofs = shape.Offset
ofs.z = ofs.z - delta
end
end
end
function End()
stars = nil
end