开发者

iOS wiggle animation in Corona SDK?

开发者 https://www.devze.com 2023-03-02 10:00 出处:网络
I\'ve problem animating wiggle effect from iOS in Corona SDK. It\'s now vibrating but not quite similar.

I've problem animating wiggle effect from iOS in Corona SDK. It's now vibrating but not quite similar.

-- Animation.new(p1.img) // how to call from main.lua

module(..., package.seeall)

function new(obj)
    obj.x = 150
    obj.y = 150
    local ox = obj.x
    local oy = obj.y

    function obj:timer(e) ----- reset th开发者_Python百科e position of object back to it's original
        local function reset()
            obj.x = ox; obj.y = oy
            print("reset called...")
        end

        local t=25
        self:setReferencePoint(display.CenterReferencePoint)
        transition.to(self, { time=t, x=obj.x+4, rotation=5, transition=easing.outExpo, onComplete=listener2})
        transition.to(self, { time=t, delay=t, x=obj.x-8, rotation=-10, transition=easing.outExpo, onComplete=reset})
    end

    timer.performWithDelay(150, obj, 20)

end


Simply changing two transition.to lines to following will give similar effect.

transition.to(self, { time=t,  rotation=4, transition=easing.outExpo, onComplete=listener2})
transition.to(self, { time=t, delay=t, rotation=-3, transition=easing.inExpo, onComplete=reset})
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号