Home

Awesome

shack

shack is a LÖVE library that lets you easily add screen effects such as shake and rotation.

demo

Setup

Require the library

local screen = require "shack"

Set game dimensions

screen:setDimensions(width, height) --love.graphics.getDimensions() by default

For push users:

screen:setDimensions(push:getDimensions())

Usage

Update shack

function love.update(dt)
  screen:update(dt)
end

Apply effects

function love.draw()
  screen:apply()
  
  --draw after applying
end

Shake screen

screen:setShake(20)

Methods and aliases

Set dimensions

screen:setDimensions(width, height)

Update shack

screen:update(dt)

Apply shack

screen:apply()

Set/get shake intensity

screen:setShake(shake)
//-> screen:shake

screen:getShake()

Set/get rotation

screen:setRotation(rotation)
//-> screen:rotate

screen:getRotation()

Set/get scale intensity

screen:setScale(x, y)
//-> screen:zoom

screen:getScale()

Set/get shear intensity

screen:setShear(x, y)
//-> screen:tilt

screen:getShear()

Set/get shake target

screen:setShakeTarget(shakeTarget) --defaults to 0

screen:getShakeTarget()

Set/get rotation target

screen:setRotationTarget(rotationTarget) --defaults to 0

screen:getRotationTarget()

Set/get scale target

screen:setScaleTarget(x, y) --defaults to 1, 1

screen:getScaleTarget()

Set/get shear target

screen:setShearTarget(x, y) --defaults to 0, 0

screen:getShearTarget()