LHAnimation Reference

LHAnimation.lua

Overview

This class is responsible for playing animations defined inside LevelHelper 2.

To receive animation notifications you have to add a listener to didFinishedRepetitionOnAnimation and/or didFinishedPlayingAnimation.

lhScene:addEventListener("didFinishedRepetitionOnAnimation", scene);--lhScene is your LHScene object
lhScene:addEventListener("didFinishedPlayingAnimation", scene);--lhScene is your LHScene object

function scene:didFinishedPlayingAnimation(event)
    
    local animationObject = event.object;
    
    print("didFinishedPlayingAnimation info......................................................");
    print("Animation name: " .. tostring(animationObject:getName()));
    print("Animation object: " .. tostring(animationObject:getNode():getUniqueName()));

end

function scene:didFinishedRepetitionOnAnimation(event)
    
    local animationObject = event.object;
    
    print("didFinishedRepetitionOnAnimation info......................................................");
    print("Animation name: " .. tostring(animationObject:getName()));
    print("Animation object: " .. tostring(animationObject:getNode():getUniqueName()));
    
end

Instance Methods

animating

local  animating()
Discussion

Returns whether or not the animation is currently playing. A boolean value.

Declared In
LHAnimation.lua

currentFrame

local  currentFrame()
Discussion

Current frame of the animation. As defines in LevelHelper 2 editor.

Declared In
LHAnimation.lua

getName

local  getName()
Discussion

Returns the name of the animation.

Declared In
LHAnimation.lua

getNode

local  getNode()
Discussion

The node this animation belongs to.

Declared In
LHAnimation.lua

isActive

local  isActive()
Discussion

Wheter or not this animation is active. The one that is currently played.

Declared In
LHAnimation.lua

repetitions

local  repetitions()
Discussion

The number of times this animation will loop. A 0 repetitions meens it will loop undefinately.

Declared In
LHAnimation.lua

restart

local  restart()
Discussion

Restarts the animation. Will set the time to 0 and reset all repetitions.

Declared In
LHAnimation.lua

setActive

local  setActive(active)
Parameters
active

A boolean value specifying the active state of the animation.

Discussion

Set this animation as the active one.

Declared In
LHAnimation.lua

setAnimating

local  setAnimating(animating)
Parameters
animating

A boolean value that will set the animation as playing or paused.

Discussion

Set the animations as playing or paused.

Declared In
LHAnimation.lua

setCurrentFrame

local  setCurrentFrame(value)
Parameters
value

The frame number where the animation should jump to.

Discussion

Move the animation to a frame.

Declared In
LHAnimation.lua

totalFrames

local  totalFrames()
Discussion

The total number of frames on the animation. A number value.

Declared In
LHAnimation.lua

totalTime

local  totalTime()
Discussion

The time it takes for the animation to finish a loop. A number value.

Declared In
LHAnimation.lua

updateTimeWithDelta

local  updateTimeWithDelta(delta)
Parameters
delta

A value that will be appended to the current animation time.

Discussion

Force the animation to go forward in time by adding the delta value to the current animation time.

Declared In
LHAnimation.lua
Last updated: 2015-3-15

Back to top

Copyright © VLADU BOGDAN DANIEL PFA.