Hi,
I am wondering if there is any way to create a fade effect in Nifty-GUI. Can the fade go from black to an image? How would you implement this into XML?
Thanks
Hi,
I am wondering if there is any way to create a fade effect in Nifty-GUI. Can the fade go from black to an image? How would you implement this into XML?
Thanks
put a black panel on top and fade that from 1 to 0 alpha. Or have a black background, and do it vice versa
I don’t think I am doing it correctly as it is not working for me. The fade effect does not occur at the start. It only fades out to black after 5 seconds. Here is XML file:
start.xml:
[java]<?xml version=“1.0” encoding=“UTF-8”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<screen id=“start” controller=“mygame.Main”>
<layer id=“layer” backgroundColor="#000f" childLayout=“center”>
<panel id="panel" align="center" backgroundColor="#000f" >
<effect>
<onStartScreen name="fade" startDelay="2000" start="#f" end="#0" length="3000" />
</effect>
</panel>
<panel id="panel" align="center" valign="center" backgroundImage="Interface/image.JPG">
<effect>
<onStartScreen name="fade" startDelay="10000" start="#f" end="#0" length="3000" neverStopRendering="true"/>
</effect>
</panel>
</layer>
</screen>
</nifty>[/java]
Can you explain to me what I am doing wrong? Thanks
I am an idiot. I got it. I had to move the first panel under the second panel. This is my code:
[java]<?xml version=“1.0” encoding=“UTF-8”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<screen id=“start” controller=“mygame.Main”>
<layer id=“layer” backgroundColor="#000f" childLayout=“center”>
<panel id="panel" align="center" valign="center" backgroundImage="Interface/image.JPG">
<effect>
<onStartScreen name="fade" startDelay="8000" start="#f" end="#0" length="3000" neverStopRendering="true"/>
</effect>
</panel>
<panel id="panel" align="center" backgroundColor="#000f" >
<effect>
<onStartScreen name="fade" startDelay="3000" start="#f" end="#0" length="3000" neverStopRendering="true"/>
</effect>
</panel>
</layer>
</screen>
</nifty>[/java]
try this.
[java]<?xml version=“1.0” encoding=“UTF-8”?>
<nifty>
<screen id=“start” controller=“mygame.Main”>
<layer id=“layer” backgroundColor="#000f" childLayout=“center”>
<panel id=“panel” align=“center” valign=“center” backgroundImage=“Interface/Leaf.png” >
<effect>
<onStartScreen name="fade" start="#0" end="#f" length="5000" />
</effect>
</panel>
</layer>
</screen>
</nifty>[/java]
Ops, I didn’t see your second post yes you could do it also that way!