Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cube = dofile("include/cube.lua")
- local d=0
- return function (page, offset, screen_width, screen_height)
- local percent = math.abs(offset/page.width)
- if percent < 0.02 then
- d = math.random(1, 4)
- end
- local sign = 0
- if offset > 0 then sign=1 end
- if offset <=0 then sign=-1 end
- offset = math.abs(offset)
- offset = (offset - (0.02 * page.width)) * 100/98
- if offset <0 then offset=0 end
- offset = sign * offset
- local x, z, angle = cube(page, offset, false, d)
- local threshold = math.abs(math.atan((PERSPECTIVE_DISTANCE - z)/x))
- angle = math.abs(angle)
- if angle > threshold then
- page.alpha = 1 - (angle - threshold)/(math.pi/2 - threshold)
- else
- page.alpha = 1
- end
- if percent > 0.98 then
- page.alpha = 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment