PlayCameraShake: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Client|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|PlayCameraShake(Duration [, BlendInTime, BlendOutTime, Scale])}} {{FuncParameters}} {{FuncParam|Du..." |
No edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Client|1.0}} | {{Info|Function|Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Make the player's camera shake using [[StopCameraShake]].}} | ||
{{FuncSyntax|PlayCameraShake(Duration [, BlendInTime, BlendOutTime, Scale])}} | {{FuncSyntax|PlayCameraShake(Duration [, BlendInTime, BlendOutTime, Scale])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|Duration | | {{FuncParam|Duration |The duration in milliseconds.}} | ||
{{FuncParam|BlendInTime| | {{FuncParam|BlendInTime|The blend-in time.}} | ||
{{FuncParam|BlendOutTime| | {{FuncParam|BlendOutTime|The blen-out time.}} | ||
{{FuncParamOptional|Scale| | {{FuncParamOptional|Scale|The shake scale in floating point.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|This function returns nothing.}} | ||
== Example == | == Example == | ||
Example taken from https://github.com/BlueMountainsIO/OnsetLuaScripts/blob/6ef0c5406e84a434ca2d497c470404802f05e0d6/horizon/client/world.lua | |||
<syntaxhighlight lang="Lua> | |||
function ToggleDrunkEffect() | |||
if (not DrunkOn) then | |||
DrunkOn = true | |||
SetPostEffect("ImageEffects", "VignetteIntensity", 1.0) | |||
SetPostEffect("Chromatic", "Intensity", 5.0) | |||
SetPostEffect("Chromatic", "StartOffset", 0.1) | |||
SetPostEffect("MotionBlur", "Amount", 0.05) | |||
SetPostEffect("MotionWhiteBalanceBlur", "Temp", 7000) | |||
SetCameraShakeRotation(0.0, 0.0, 1.0, 10.0, 0.0, 0.0) | |||
SetCameraShakeFOV(5.0, 5.0) | |||
PlayCameraShake(100000.0, 2.0, 1.0, 1.1) | |||
else | |||
DrunkOn = false | |||
SetPostEffect("ImageEffects", "VignetteIntensity", 0.25) | |||
SetPostEffect("Chromatic", "Intensity", 0.0) | |||
SetPostEffect("Chromatic", "StartOffset", 0.0) | |||
SetPostEffect("MotionBlur", "Amount", 0.0) | |||
SetPostEffect("MotionWhiteBalanceBlur", "Temp", 6500) | |||
StopCameraShake(false) | |||
end | |||
end | |||
AddRemoteEvent("ToggleDrunkEffect", ToggleDrunkEffect) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Template:CameraShakeFunctions}} |
Latest revision as of 14:52, 23 December 2020
Description
Make the player's camera shake using StopCameraShake.
Syntax
PlayCameraShake(Duration [, BlendInTime, BlendOutTime, Scale])
Parameters
- Duration
The duration in milliseconds. - BlendInTime
The blend-in time. - BlendOutTime
The blen-out time. - Scale (optional)
The shake scale in floating point.
Return Value
- This function returns nothing.
Example
Example taken from https://github.com/BlueMountainsIO/OnsetLuaScripts/blob/6ef0c5406e84a434ca2d497c470404802f05e0d6/horizon/client/world.lua
function ToggleDrunkEffect()
if (not DrunkOn) then
DrunkOn = true
SetPostEffect("ImageEffects", "VignetteIntensity", 1.0)
SetPostEffect("Chromatic", "Intensity", 5.0)
SetPostEffect("Chromatic", "StartOffset", 0.1)
SetPostEffect("MotionBlur", "Amount", 0.05)
SetPostEffect("MotionWhiteBalanceBlur", "Temp", 7000)
SetCameraShakeRotation(0.0, 0.0, 1.0, 10.0, 0.0, 0.0)
SetCameraShakeFOV(5.0, 5.0)
PlayCameraShake(100000.0, 2.0, 1.0, 1.1)
else
DrunkOn = false
SetPostEffect("ImageEffects", "VignetteIntensity", 0.25)
SetPostEffect("Chromatic", "Intensity", 0.0)
SetPostEffect("Chromatic", "StartOffset", 0.0)
SetPostEffect("MotionBlur", "Amount", 0.0)
SetPostEffect("MotionWhiteBalanceBlur", "Temp", 6500)
StopCameraShake(false)
end
end
AddRemoteEvent("ToggleDrunkEffect", ToggleDrunkEffect)