With gifboy you can create tiny GIF animations by writing Lua code. The link to a GIF is at the same time its code. Animations are created on-the-fly and can be easily shared. Try it out.
Example: gifboy.io/text("hello world").html
A gifboy app has a very simple structure, there are basically two parts:
Alternatively, depending on your coding style, you can get rid of the draw function block completely and use the render() function instead. This function will draw a new frame based on the current draw state. This can be useful and more economical, if you want to manually control the timings of your animation and don't need a recurring draw call as provided by the draw function block.
Here is a simple example how a gifboy app looks like. We are going to build the animation below.
1-- Declare variables2local angle=03local color=745-- This function gets called every frame6function draw()78 angle=angle+4 -- increase angle by 4 each frame9 clear(12) -- clear the screen (to blue)10 translate(80,80) rotate(angle) -- rotate the screen around the center (position 80, 80)11 icon("B",-10,-10,8) -- draw a red heart12 rotate(-angle) translate(-80,-80) -- undo the rotation13 text("this rocks!",48,120,color) -- draw a text (with color) at 48, 12014 if angle>180 then color=0 end -- change text color to black, if angle is >18015 if angle>360 then stop() end -- stop the animation after a full rotation1617end
gifboy follows the design philosphy of creativity by limitation. There are some very focussed features:
|Number of Colors||16 interchangeable colors at a time. See the Color Palette.|
|Animation Length||Default is 3 seconds, maximum is 20 seconds (can be stopped earlier, depending on desired looping behaviour or frames can be shown for a longer time).|
|Animation Speed (Frames Per Second)||60 frames per second as default (but can be changed).|
|Resolution||160x160 pixels. Perfect for retro graphics afficionados.|
|Language||Lua with ca. 40 dedicated commands. See the Documentation.|
|Interface||Code can be entered directly into the URL bar.|
The name of a GIF file is also its code. #gifception
Your work can be shared instantly.
|Code Size||There is no explicit code size limit enforced by the editor. However, since gifboy animations are represented as URLs, there is a 'natural' restriction how long your code can get, i.e. around 2k characters can be considered as upper limit.|
gifboy can be used to
On the homepage there is a code editor that can be used to write gifboy apps. The editor will transform the code into gifboy-friendly URLs and has auto-completion for all available commands.
Wanna go beyond drawing blue backgrounds and some blinking text?
View the Examples page to get some inspiration.
Or check out the Documentation which lists all available commands.