Type | method of Display class | [gd] |
Overview | Raise movement of display object | [bgl |
Return value | self (display object itself) |
|
See also | Display class |
|
Overview
This method makes a Display class object to shift target point with time
from current location. The parameter of this method is a single table.
Syntax
In the calling function in Lua language, if it receives only a single table,
the parenthesis can be omitted.
Therefore, there is no need to write parentheses.
For the single shift
obj:shift{time=n, x=n, y=n, rot = n, scale = n, alpha = n, scaleX = n, scaleY = n} |
where n is a number.
For multiple and chained shifts,
obj:shift{ loops = n, --(optional) onEnd = function, --(optional) {time=n, x=n, y=n, rot = n, scale = n, alpha = n, scaleX = n, scaleY = n}, {time=n, x=n, y=n, rot = n, scale = n, alpha = n, scaleX = n, scaleY = n}, .... {time=n, x=n, y=n, rot = n, scale = n, alpha = n, scaleX = n, scaleY = n}, } |
• loops : number of repetition (INF for infinite repetition)
• onEnd: the function that is called when all the shifts are completed
Examples
(single shift)
local img = Image('moon.png') img:shift{time=500, x=0, y=0, scale = 2 } |
(multiple and chained shifts)
local img = Image('moon.png') img:shift { loops=3, onEnd = function() print('finished') end, {time = 1000, x=1080}, {time = 1000, y=1920}, {time = 1000, x=0, y=0, scale=0.5, alpha=0}, {time = 500, alpha=1}, } |
댓글 없음:
댓글 쓰기