fadeCamera
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
This function will fade a player's camera to a color or back to normal over a specified time period. This will also affect the sound volume for the player (50% faded = 50% volume, full fade = no sound). For clientside scripts you can perform 2 fade ins or fade outs in a row, but for serverside scripts you must use one then the other.
Note
The speed of the effect depends directly on the current gamespeed.
Syntax
fadeCamera ( )Code Examples
server
When a player gets damaged, place a quick fade-to-red effect on his screen.
function addRednessOnDamage ( ) fadeCamera ( source, false, 1.0, 255, 0, 0 ) -- fade the player's camera to red over a period of 1 second setTimer ( fadeCameraDelayed, 500, 1, source ) -- don't let it go to opaque red, interrupt it after half a second and fade back to normalendaddEventHandler ( "onPlayerDamage", root, addRednessOnDamage )
function fadeCameraDelayed(player) -- This function prevents debug warnings when the player disconnects while the timer is running. if (isElement(player)) then fadeCamera(player, true, 0.5) endend