<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.splashdamage.com/index.php?action=history&amp;feed=atom&amp;title=GUIs%3A_Transitions</id>
	<title>GUIs: Transitions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.splashdamage.com/index.php?action=history&amp;feed=atom&amp;title=GUIs%3A_Transitions"/>
	<link rel="alternate" type="text/html" href="https://wiki.splashdamage.com/index.php?title=GUIs:_Transitions&amp;action=history"/>
	<updated>2026-04-07T17:00:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.splashdamage.com/index.php?title=GUIs:_Transitions&amp;diff=1485&amp;oldid=prev</id>
		<title>192.168.0.142 at 10:33, 16 October 2007</title>
		<link rel="alternate" type="text/html" href="https://wiki.splashdamage.com/index.php?title=GUIs:_Transitions&amp;diff=1485&amp;oldid=prev"/>
		<updated>2007-10-16T10:33:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;noinclude&amp;gt;== Overview ==&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
Transitions are used for smooth window movement and all types of text/material fading, either linear or non-linear change can be used.&amp;lt;includeonly&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{main|GUIs: Transitions}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transitions are valid for float based properties like float/vec2/vec3/vec4. Here is the transition function for a vec4:&lt;br /&gt;
 vec4  transition( [start transition], [end transition], [time for transition] );&lt;br /&gt;
For an accelerating transition the function is:&lt;br /&gt;
 vec4  transition( [start transition], [end transition], [time for transition], [acceleration] );&lt;br /&gt;
&lt;br /&gt;
Here's an example where a transition is used to fade the &amp;quot;Flyer Drone deactivated&amp;quot; in and out. The text will be shown whenever the recharge bar has fully charged while flying to flyer drone:&lt;br /&gt;
 windowDef flyerhiveDeactivate {&lt;br /&gt;
 	_huge_text_props&lt;br /&gt;
 	properties {&lt;br /&gt;
 		handle localizedText= localize( &amp;quot;game/flyerhive/deactivated&amp;quot; );&lt;br /&gt;
 		rect rect 			= 0, -16, SCREEN_WIDTH, 16;&lt;br /&gt;
 		float timeExpired	= player.scoreboardActive == true || player.commandmapstate != 0&lt;br /&gt;
 					|| player.endGame == true || player.endGameCamera == true &lt;br /&gt;
 					|| gui.vehicleWeaponEMPInfo.visible == true&lt;br /&gt;
 					|| gui.time &amp;gt;= ( 1000 * globals.gameHud.flyerhiveEndTime );&lt;br /&gt;
 	}&lt;br /&gt;
 	events {&lt;br /&gt;
 		onCreate {&lt;br /&gt;
 			foreColor.a = 0;&lt;br /&gt;
 		}&lt;br /&gt;
 		onPropertyChanged &amp;quot;timeExpired&amp;quot; {&lt;br /&gt;
 			if( timeExpired ) {&lt;br /&gt;
 				// Time has expired, fade out the text by transitioning&lt;br /&gt;
 				// the alpha value to 0 over 300 milliseconds.&lt;br /&gt;
 				foreColor.a = transition( foreColor.a, 0, 300 );&lt;br /&gt;
 			} else {&lt;br /&gt;
 				// Pop in the text.&lt;br /&gt;
 				foreColor.a = 1;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Accelerating Transition ==&lt;br /&gt;
The most difficult part to understand in a transition is the optional acceleration parameter. The message box you see with a small yellow rectangle moving back and forth is a good example of an accelerating transition (in ''guis/mainmenu/components/progress.include''):&lt;br /&gt;
 // Moving the window towards the right&lt;br /&gt;
 gui.NameParm.offset = transition( 0, gui.NameParm.rect.w - ( gui.NameParm.progressRect.w + 4 ), 2500, &amp;quot;0.2, 0.8&amp;quot; );&lt;br /&gt;
and&lt;br /&gt;
 // Moving the window towards the left.&lt;br /&gt;
 gui.NameParm.offset = transition( gui.NameParm.offset, 0, 2500, &amp;quot;0.2, 0.8&amp;quot; );&lt;br /&gt;
The first acceleration parameter is the percentage of time spent accelerating, the second parameter is the percentage at which it should start decelerating. This means it will accelerate for 20% of the 2500 milliseconds and decelerate for 1 - 0.8 = 20% of the time. 60% ( 1 - ( 0.2 + ( 1 - 0.8 ) ) ) of the time is spent moving at constant speed.&lt;br /&gt;
&lt;br /&gt;
== List Transitions ==&lt;br /&gt;
Lists have some additional properties for each item in its list that can be used for making transitions to the forecolor/backcolor or up to 3 additional properties. These are often used for highlighting the text in an item or column header when the mouse moves over it.&lt;br /&gt;
&lt;br /&gt;
Example of transitioning the foreColor for an item on mouse over (in ''guis/common/stats/achievements.include''):&lt;br /&gt;
 onEnterItem {&lt;br /&gt;
 	item.x = gui.scriptGetFloatResult();&lt;br /&gt;
 	item.y = gui.scriptGetFloatResult();&lt;br /&gt;
 	scratchColor = getItemTransitionVec4Result( LTP_FORECOLOR, foreColor, item.x, item.y );&lt;br /&gt;
 	transitionItemVec4( LTP_FORECOLOR, scratchColor, &amp;quot;1,1,1,1&amp;quot;, ACTIVATE_TRANSITION_TIME, &amp;quot;&amp;quot;, item.x, item.y );&lt;br /&gt;
 	gui.playSound( &amp;quot;boop&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Transition related list functions:&lt;br /&gt;
* [[UIList:transitionItemVec4|transitionItemVec4]]&lt;br /&gt;
* [[UIList:getItemTransitionVec4Result|getItemTransitionVec4Result]]&lt;br /&gt;
* [[UIList:transitionColumnVec4|transitionColumnVec4]]&lt;br /&gt;
* [[UIList:getColumnTransitionVec4Result|getColumnTransitionVec4Result]]&lt;br /&gt;
* [[UIList:clearTransitions|clearTransitions]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:GUIs]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>192.168.0.142</name></author>
		
	</entry>
</feed>