Env fade: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Reverted to previous version)
(-commands moved to the bottom and added some info, concise page)
Line 6: Line 6:
{{clr}}
{{clr}}


==ConVars/Commands==
==Keyvalues==
{{varcom|start}}
{{KV|Duration (seconds) |intn=duration|string|The time that it will take to fade the screen in or out.}}
{{varcom|fadein|float int int int 0|Time (seconds), Red, Green, Blue, {{todo}}|Makes the screen black (or the specified color), then fades to the normal view. {{todo|Why is the last number required?}}}}
{{KV|Hold Fade (seconds) |intn=holdtime|string|The time to hold the faded in/out state.}}
{{varcom|fadeout|float int int int 0|Time (seconds), Red, Green, Blue, {{todo}}|Fades the screen to black (or the specified color). {{todo|Why is the last number required?}}}}
{{KV|Fade Alpha |intn=renderamt|integer|Alpha of the fade, where 0 {{=}} fully transparent and 255 {{=}} fully opaque.}}
{{varcom|end}}
{{KV|Fade Color (R G B) |intn=rendercolor|color255|Fade color.}}
{{KV|Reverse Fade Duration (seconds) |intn=ReverseFadeDuration|float|The duration of the reverse fade.|since=P2}}


==Flags==  
==Flags==  
*1: Fade From - Screen fades ''from'' the specified color instead of ''to'' it.
{{fl|1|Fade From|Screen fades ''from'' the specified color instead of ''to'' it.}}
*2: Modulate - Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of <code>0 255 0</code> would mute the red and blue channels and create a green nightvision-type effect.
{{fl|2|Modulate|Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of <code>0 255 0</code> would mute the red and blue channels and create a green nightvision-type effect.}}
*4: Triggering player only {{not in FGD}} - Only affects the screen of the {{ent|!activator}}. <code>!activator</code> is probably the easiest to reach through a [[trigger]] entity. If not checked, the fade will apply to all players.
{{fl|4|Triggering player only {{not in FGD}}| Only affects the screen of the {{ent|!activator}}. <code>!activator</code> is probably the easiest to reach through a [[trigger]] entity. If not checked, the fade will apply to all players.}}
*8: Stay Out - Fade remains indefinitely until another fade deactivates it.
{{fl|8|Stay Out|Fade remains indefinitely until another fade deactivates it.}}
 
==Keyvalues==
{{KV|Duration (seconds) (duration)|string|The time that it will take to fade the screen in or out.}}
{{KV|Hold Fade (seconds) (holdtime)|string|The time to hold the faded in/out state.}}
{{KV|Fade Alpha (renderamt)|integer|Alpha of the fade, where 0 {{=}} fully transparent and 255 {{=}} fully opaque.}}
{{KV|Fade Color (R G B) (rendercolor)|color255|Fade color.}}
{{KV|Reverse Fade Duration (seconds) (ReverseFadeDuration)|float|The duration of the reverse fade.|since=P2}}
{{KV BaseEntity|css=1}}


==Inputs==
==Inputs==
Line 31: Line 24:
{{IO|Alpha|nofgd=1|Changes '''Fade Alpha'''.}}
{{IO|Alpha|nofgd=1|Changes '''Fade Alpha'''.}}
{{IO|Color|nofgd=1|Changes '''Fade Color'''.}}
{{IO|Color|nofgd=1|Changes '''Fade Color'''.}}
{{I BaseEntity|prel4d=1}}


==Outputs==
== Outputs ==
{{IO|OnBeginFade|Fired when the fade has begun.}}
{{IO|OnBeginFade|Fired when the fade has begun.}}
{{O BaseEntity|l4d=1}}
 
 
== ConCommands ==
{{varcom|start}}
{{varcom|fadein|float int int int int|Time (seconds), Red, Green, Blue, Alpha|Makes the screen black (or the specified color), then fades to the normal view.}}
{{varcom|fadeout|float int int int int|Time (seconds), Red, Green, Blue, Alpha|Fades the screen to black (or the specified color).}}
{{varcom|end}}
{{bug|Due to mistake in code alpha value isn't read properly from these commands but if you specify rgb it also has to be specified for the fade to work.}}


[[Category:GUI Entities]]
[[Category:GUI Entities]]

Revision as of 13:51, 29 October 2022

English (en)Русский (ru)中文 (zh)Translate (Translate)
Env fade.png

Template:Base point It controls screen fades to or from a solid color. Add Duration and Hold Time together for the total time this entity will be in effect.

C++ In code, it is represented by theCEnvFadeclass, defined in theEnvFade.cppfile.

Keyvalues

Duration (seconds) (duration) <string>
The time that it will take to fade the screen in or out.
Hold Fade (seconds) (holdtime) <string>
The time to hold the faded in/out state.
Fade Alpha (renderamt) <integer>
Alpha of the fade, where 0 = fully transparent and 255 = fully opaque.
Fade Color (R G B) (rendercolor) <color255>
Fade color.
Reverse Fade Duration (seconds) (ReverseFadeDuration) <float> (in all games since Portal 2)
The duration of the reverse fade.

Flags

Fade From : [1]
Screen fades from the specified color instead of to it.
Modulate : [2]
Uses attenuation blending to achieve the fade. The normal fade does a straight weighted blend between the screen and the fading color. Modulate actually attenuates the RGB channels. For example, a color of 0 255 0 would mute the red and blue channels and create a green nightvision-type effect.
Triggering player only !FGD : [4]
Only affects the screen of the !activator. !activator is probably the easiest to reach through a trigger entity. If not checked, the fade will apply to all players.
Stay Out : [8]
Fade remains indefinitely until another fade deactivates it.

Inputs

Fade
Start the screen fade.
FadeReverse  (in all games since Portal 2)
Begin doing the reverse of the current fade.
Alpha  !FGD
Changes Fade Alpha.
Color  !FGD
Changes Fade Color.

Outputs

OnBeginFade
Fired when the fade has begun.


ConCommands

Cvar/Command Parameters or default value Descriptor Effect
fadein float int int int int Time (seconds), Red, Green, Blue, Alpha Makes the screen black (or the specified color), then fades to the normal view.
fadeout float int int int int Time (seconds), Red, Green, Blue, Alpha Fades the screen to black (or the specified color).
Icon-Bug.pngBug:Due to mistake in code alpha value isn't read properly from these commands but if you specify rgb it also has to be specified for the fade to work.  [todo tested in ?]