{"id":"miniyear/camerashaker","name":"camerashaker","scope":"miniyear","platform":"roblox","description":"Camera shake effects for Roblox games","version":"1.0.2","latest":"1.0.2","versions":["1.0.2"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"e6fa292d5592421a1ffc926f08f8315b963dfc1f94faf378d19718dbe99b8783","likes":0,"downloads":0,"install":"forest install miniyear/camerashaker","url":"https://forest.dev/p/roblox/miniyear/camerashaker","files":"https://api.forest.dev/ai/package/roblox/miniyear/camerashaker/files","readme":"# RbxCameraShaker\n\nRbxCameraShaker is a port of the free Unity3D [EZ Camera Shake](https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148) asset. The Unity3D asset had no licensing information, so I received written permission from the original authors of EZ Camera Shake to port their asset to Roblox.\n\nThis module is available from the [Roblox library](https://www.roblox.com/library/1461025953/Camera-Shaker).\n\n## Purpose\n\nRbxCameraShaker is a module that lets developers easily add realistic camera shake effects to Roblox games. The module is easy to use and performs well.\n\n## Basic Use\n\nSimple example:\n```lua\nlocal function ShakeCamera(shakeCf)\n\t-- shakeCf: CFrame value that represents the offset to apply for shake effect.\n\t-- Apply the effect:\n\tcamera.CFrame = camera.CFrame * shakeCf\nend\n\n-- Create CameraShaker instance:\nlocal renderPriority = Enum.RenderPriority.Camera.Value + 1\nlocal camShake = CameraShaker.new(renderPriority, ShakeCamera)\n\n-- Start the instance:\ncamShake:Start()\n\n-- Apply explosion shakes every 5 seconds:\nwhile (true) do\n\twait(5)\n\tcamShake:Shake(CameraShaker.Presets.Explosion)\nend\n```\n\n## API\n\n### CameraShaker\n\n**Static Fields:**\n```lua\nCameraShaker.CameraShakeInstance\nCameraShaker.Presets\n```\n\n**Constructor:**\n```lua\ncamShaker = CameraShaker.new(renderPriority, bindFunction)\n```\n\n**Object Methods:**\n\n| Method | Description |\n| ------ | ----------- |\n| `camShaker:Start()` | Start the camera shaker |\n| `camShaker:Stop()` | Stop the camera shaker |\n| `camShaker:StopSustained([fadeOutTime])` | Stop all sustained shakes |\n| `camShaker:Shake(shakeInstance)` | Apply the shake effect once |\n| `camShaker:ShakeSustain(shakeInstance)` | Apply the shake effect coninuously |\n| `camShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])` | Apply the custom shake effect once |\n| `camShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])` | Apply the custom shake effect continuously |\n\n### CameraShakeInstance\nThis is mostly used internally, but is still exposed for use.\n\n**Static Fields:**\n```lua\nCameraShakeInstance.CameraShakeState\n  - FadingIn\n  - FadingOut\n  - Sustained\n  - Inactive\n```\n\n**Constructor:**\n```lua\ninstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)\n```\n\n**Object Methods:**\n\n| Method | Description |\n| ------ | ----------- |\n| `instance:UpdateShake(deltaTime)` | Update the shake |\n| `instance:StartFadeOut(fadeOutTime)` | Fade out effect |\n| `instance:StartFadeIn(fadeInTime)` | Fade in effect |\n| `instance:IsShaking() ` | Returns `true` if shaking |\n| `instance:IsFadingOut()` | Returns `true` if fading out |\n| `instance:IsFadingIn()` | Returns `true` if fading in |\n| `instance:GetState()` | Returns the current CameraShakeState |\n\n### CameraShakePresets\n\n| Preset | Description | Ideal Type |\n| ------ | ----------- | ---------- |\n| Bump | A high-magnitude, short, yet smooth shake | Once |\n| Explosion | An intense & rough shake | Once |\n| Earthquake | Continuous, rough shake | Sustained |\n| BadTrip | Bizarre shake with high magnitude & low roughness | Sustained |\n| HandheldCamera | A subtle, slow shake | Sustained |\n| Vibration | Rough but low magnitude | Sustained |\n| RoughDriving | Slightly rough and medium magnitude | Sustained |\n\nThese presets are easy to modify and use. For an example of using one of the presets, look at the Basic Use section.","readmeTruncated":false}