So i have been searching through the java doc of Nifty Gui and found
EffectBuilder (Nifty Core 1.3.1 API)
i havent found any documentation about what effects are beeing acceptet by the Constuctor?
to the Problem:
I want the intro screen to fade in and fade out.
i achieved this by this screen:
[java] nifty.addScreen("intro", new ScreenBuilder("intro") {{
controller(new Intro_Controller());
layer(new LayerBuilder("background") {{
onStartScreenEffect(new EffectBuilder("fade"){{
length(1000);
startDelay(0);
inherit(true);
post(false);
}});
onEndScreenEffect(new EffectBuilder("fade"){{
length(-500); //Here is something wrong
startDelay(0);
inherit(true);
post(false);
}});
childLayoutCenter();
width("100%");
height("100%");
backgroundColor("#000000");
panel(new PanelBuilder() {{
childLayoutCenter();
height("100%");
panel(new PanelBuilder() {{
childLayoutCenter();
width("100%");
image(new ImageBuilder() {{
filename("Res/intro.png");
alignCenter();
interactOnClick("next()");
}});
}});
}});
}});
}}.build(nifty));[/java]
if i put this to 500 it fades in again at the end of the screen
if i put this to -500 it fades OUT as it is supposed to be ,
then the game keeps hanging by repeating this effect all day long.(Party Screen xD 8))
is this a bug or am i using this wrong or should i use a completly different method?
I cant find a documentation that explains this o.O
You need to set the duration to 500 and then set the start and end transparencies to the way around you want - read the nifty manual under effects it has the exact example of fading things in and out.
1 Like
thanks, i already knew this pdf but it isnt described how to DO in java
this does the trick :
[java]
this.effectParameter("start", "#f");
this.effectParameter("end", "#0");[/java] to fade out and the other way around for fade in