Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ulydev/shack
Screen effects made simple
https://github.com/Ulydev/shack
Last synced: 3 days ago
JSON representation
Screen effects made simple
- Host: GitHub
- URL: https://github.com/Ulydev/shack
- Owner: Ulydev
- License: mit
- Created: 2016-04-30T17:00:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-30T19:41:00.000Z (over 8 years ago)
- Last Synced: 2024-08-02T06:17:40.618Z (3 months ago)
- Language: Lua
- Size: 17.6 KB
- Stars: 59
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-love2d - shack - Shack is a LÖVE library that lets you easily add screen effects such as shake and rotation. (Helpers)
README
shack
==============shack is a LÖVE library that lets you easily add screen effects such as shake and rotation.
![demo][demo]
Setup
----------------Require the library
```lua
local screen = require "shack"
```Set game dimensions
```lua
screen:setDimensions(width, height) --love.graphics.getDimensions() by default
```For [push](https://github.com/Ulydev/push) users:
```lua
screen:setDimensions(push:getDimensions())
```Usage
----------------Update shack
```lua
function love.update(dt)
screen:update(dt)
end
```Apply effects
```lua
function love.draw()
screen:apply()
--draw after applying
end
```Shake screen
```lua
screen:setShake(20)
```Methods and aliases
----------------Set dimensions
```lua
screen:setDimensions(width, height)
```Update shack
```lua
screen:update(dt)
```Apply shack
```lua
screen:apply()
```Set/get shake intensity
```lua
screen:setShake(shake)
//-> screen:shakescreen:getShake()
```Set/get rotation
```lua
screen:setRotation(rotation)
//-> screen:rotatescreen:getRotation()
```Set/get scale intensity
```lua
screen:setScale(x, y)
//-> screen:zoomscreen:getScale()
```Set/get shear intensity
```lua
screen:setShear(x, y)
//-> screen:tiltscreen:getShear()
```Set/get shake target
```lua
screen:setShakeTarget(shakeTarget) --defaults to 0screen:getShakeTarget()
```Set/get rotation target
```lua
screen:setRotationTarget(rotationTarget) --defaults to 0screen:getRotationTarget()
```Set/get scale target
```lua
screen:setScaleTarget(x, y) --defaults to 1, 1screen:getScaleTarget()
```Set/get shear target
```lua
screen:setShearTarget(x, y) --defaults to 0, 0screen:getShearTarget()
```[demo]: https://media.giphy.com/media/l0K4hgmCL9PLzYYTe/giphy.gif