Nifty move animation

Hi everybody,

i have benn struggling with a problem for hourse now: i’ve got a menu in which a text should move from left to right and when it has finished it should start again; sounds pretty easy…

Here’s the important part of the layout:

[xml]<panel id=“textPanelTop” height=“20%” width=“100%” childLayout=“absolute”>


<onStartScreen name=“fade” start="#00" end="#ff"

length=“12000” startDelay=“4000” oneShot=“true”/>


<image id=“textTop” width=“100%” height=“100%” filename=“Images/text_1.png”

x="${CALL.getOffsetLeft()}" y=“0”>


<onCustom customKey=“moveIn” name=“move” mode=“toOffset” offsetX="${CALL.getOffsetRight()}"

length=“32000” startDelay=“7000”/>




And the code:


public int getOffsetLeft(){

return (-1) * textTop.getWidth();

public int getOffsetRight(){

return nifty.getRenderEngine().getWidth();


In the bind-method i initialize the nifty-variable and call this:


private void moveElements(){

textTop.startEffect(EffectEventId.onCustom, new MoveInEnd(), “moveIn”);


Now the problem seems to be very noobish but it is like that: the nifty is initialized in the bind-method but the layout calls getOffsetLeft() and getOffsetRight() before that, so i get no values for the offset…

I tried it first to move it in from left and move it out right (without any offset) but i wasnt able to reset it and do it in a loop.

I hope someone could help me

Thank you