Difference between revisions of "StartCameraFade"

From Onset Developer Wiki
 
Line 1: Line 1:
 
{{Info|Function|Client|1.0}}
 
{{Info|Function|Client|1.0}}
  
{{FuncDescription|Smoothly fade in or out, Setting CameraFade will overwrite any other started camera fades which were called before}}
+
{{FuncDescription|Smoothly fade in or out, setting CameraFade will overwrite any other started camera fades which were called before. The fading will no persist after the fade duration.}}
  
 
{{FuncSyntax|StartCameraFade(FromAlpha, ToAlpha, Duration [, HexColor])}}
 
{{FuncSyntax|StartCameraFade(FromAlpha, ToAlpha, Duration [, HexColor])}}
Line 15: Line 15:
 
== Example ==
 
== Example ==
 
<syntaxhighlight lang="Lua">
 
<syntaxhighlight lang="Lua">
StartCameraFade(1.0, 0.0, 4.0, RGB(0, 0, 0))
+
    StartCameraFade(0.0, 1.0, 2.0, RGB(0, 0, 0))
 +
    -- The fading to black from above will not persist. So start a timer that does a full black background later.
 +
    Delay(1900, function()
 +
        StartCameraFade(1.0, 1.0, 10000.0, RGB(0, 0, 0))
 +
    end)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
{{RelatedFunctions}}
 
{{RelatedFunctions}}
 
__EDIT_ME__
 
__EDIT_ME__

Latest revision as of 22:29, 20 March 2020

StartCameraFade

Type: Function
Context: Client
Introduced: v1.0

Description

Smoothly fade in or out, setting CameraFade will overwrite any other started camera fades which were called before. The fading will no persist after the fade duration.

Syntax

StartCameraFade(FromAlpha, ToAlpha, Duration [, HexColor])

Parameters

  • FromAlpha
    Starting alpha (0-1)
  • ToAlpha
    Alpha you want to fade to (0-1)
  • Duration
    Duration of the fade in seconds
  • HexColor (optional)
    Hex color of the fade

Return Value

  • __EDIT_ME__

Example

    StartCameraFade(0.0, 1.0, 2.0, RGB(0, 0, 0))
    -- The fading to black from above will not persist. So start a timer that does a full black background later.
    Delay(1900, function()
        StartCameraFade(1.0, 1.0, 10000.0, RGB(0, 0, 0))
    end)

See also

__EDIT_ME__