Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- local easing functions
- local pow = math.pow
- local sin = math.sin
- local pi = math.pi
- local rand = math.random
- local abs = math.abs
- function easeTrow(t, tMax, start, delta, high)
- local x = (t / tMax) - 0.5
- return start + high * 4 * x * x - high + delta * (t / tMax)
- end
- local square = display.newRect( 0, 0, 50, 50 )
- square:setFillColor( 255,255,255 )
- local _W, _H = display.contentWidth, display.contentHeight
- local _CX, _CY = _W * 0.5, _H * 0.5
- square.x = 0
- square.y = _H * 0.8
- local howHighToTrow = _H * 0.5
- local trowDuration = 700
- transition.to( square, { time = trowDuration, x = _W} )
- -- try also
- -- transition.to( square, { time = trowDuration, x = _W, transition = easing.inQuad} )
- transition.to( square, { time = trowDuration, y = _CY, transition = function (a, b, c, d) return easeTrow (a, b, c, d, howHighToTrow) end } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement