Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "gd"
- size = 400
- cenx = 125
- ceny = 275
- im = gd.createPalette(size, size)
- assert(im)
- black = im:colorAllocate(0, 0, 0)
- im:gifAnimBegin("out.gif", true, 0)
- r = 100
- astep = math.pi
- for i = 1, 15 do
- local tim = gd.createTrueColor(size, size)
- --tim:setAntiAliased(tim:colorAllocate(0, 0, 0))
- for c = 14, 0, -1 do
- local ccenx = cenx+16*c+i
- local cceny = ceny-16*c-i
- local angles = {}
- for angle = 0, 2*math.pi, astep*math.pow(0.98, 15*c) do
- table.insert(angles, angle)
- end
- local points = {}
- for a = 1, #angles do
- table.insert(points, {
- ccenx+r*math.cos(angles[a]),
- cceny+r*math.sin(angles[a])})
- end
- local w = (380-ccenx)%256
- tim:filledPolygon(points, tim:colorAllocate(w, w, w))
- tim:polygon(points, tim:colorAllocate(0, 0, 0))
- --[[
- for p = 1, #points-1 do
- tim:line(points[p][1], points[p][2], points[p+1][1], points[p+1][2], gd.ANTI_ALIASED)
- end
- tim:line(points[#points][1], points[#points][2], points[1][1], points[1][2], gd.ANTI_ALIASED)
- --]]
- end
- astep = astep*0.98
- local ti = tim:createPaletteFromTrueColor(true, 8)
- ti:gifAnimAdd("out.gif", true, 0, 0, 5, gd.DISPOSAL_NONE)
- io.write(i.." ")
- end
- gd.gifAnimEnd("out.gif")
Advertisement
Add Comment
Please, Sign In to add comment