Update: Now this works for Löve 0.10.1, and I've updated the code so that having the gradient images is optional, not mandatory. If the gradients folder is not available, the program will now generate the images for you!
Just call require "gradient" and you're done!
How to use it:
Code: Select all
love.gradient.draw(function, mode, centerX, centerY, width, height, color1, color2[, angle, scaleX, scaleY])
Function: A drawing function (like with love stencils).
Mode: A gradient mode (linear, radial, angle, rhombus or square).
Center X: The X center of your shape.
Center Y: The Y center of your shape.
Width: The width of your shape (regardless of rotation).
Height: The height of your shape (regardless of rotation).
Color 1: The back color of your gradient.
Color 2: The front color of your gradient.
Angle: The rotation of your gradient image (default: 0).
Scale X: The scale factor for your gradient's width (default: 1, flip horizontally: -1).
Scale Y: The scale factor for your gradient's height (default: 1, flip vertically: -1).
Oh, here's an example (use the keys "WASD" to move the square, "TAB" to switch between gradients and "QE" to rotate it):
Aaaannd... A screenshot:
(I'm open to any tips on how to improve this)