The system selects a boot animation zipfile from the following locations, in order:
/system/media/bootanimation-encrypted.zip (if getprop("vold.decrypt") = '1') /system/media/bootanimation.zip /oem/media/bootanimation.zip
The bootanimation.zip
archive file includes:
desc.txt - a text file part0 \ part1 \ directories full of PNG frames ... / partN /
The first line defines the general parameters of the animation:
WIDTH HEIGHT FPS
It is followed by a number of rows of the form:
TYPE COUNT PAUSE PATH [#RGBHEX [CLOCK1 [CLOCK2]]]
p
-- this part will play unless interrupted by the end of the bootc
-- this part will play to completion, no matter whatpart0
)#RRGGBB
CLOCK1
is provided it is the y-coordinate of the clock and the x-coordinate defaults to c
CLOCK1
and CLOCK2
are provided then CLOCK1
is the x-coordinate and CLOCK2
is the y-coodinatec
c
-- will centre the textn
-- will position the text n pixels from the start; left edge for x-axis, bottom edge for y-axis-n
-- will position the text n pixels from the end; right edge for x-axis, top edge for y-axis-24
or c -24
will position the text 24 pixels from the top of the screen, centred horizontally16 c
will position the text 16 pixels from the left of the screen, centred vertically-32 32
will position the text such that the bottom right corner is 32 pixels above and 32 pixels left of the edges of the screenThere is also a special TYPE, $SYSTEM
, that loads /system/media/bootanimation.zip
and plays that.
The file used to draw the time on top of the boot animation. The font format is as follows:
Each part is scanned and loaded directly from the zip archive. Within a part directory, every file (except trim.txt
and audio.wav
; see next sections) is expected to be a PNG file that represents one frame in that part (at the specified resolution). For this reason it is important that frames be named sequentially (e.g. part000.png
, part001.png
, ...) and added to the zip archive in that order.
To save on memory, textures may be trimmed by their background color. trim.txt sequentially lists the trim output for each frame in its directory, so the frames may be properly positioned. Output should be of the form: WxH+X+Y
. Example:
713x165+388+914 708x152+388+912 707x139+388+911 649x92+388+910
If the file is not present, each frame is assumed to be the same size as the animation.
Each part may optionally play a wav
sample when it starts. To enable this, add a file with the name audio.wav
in the part directory.
The system will end the boot animation (first completing any incomplete or even entirely unplayed parts that are of type c
) when the system is finished booting. (This is accomplished by setting the system property service.bootanim.exit
to a nonzero string.)
Use zopflipng
if you have it, otherwise pngcrush
will do. e.g.:
for fn in *.png ; do zopflipng -m ${fn}s ${fn}s.new && mv -f ${fn}s.new ${fn} # or: pngcrush -q .... done
Some animations benefit from being reduced to 256 colors:
pngquant --force --ext .png *.png # alternatively: mogrify -colors 256 anim-tmp/*/*.png
cd <path-to-pieces> zip -0qry -i \*.txt \*.png \*.wav @ ../bootanimation.zip *.txt part*
Note that the ZIP archive is not actually compressed! The PNG files are already as compressed as they can reasonably get, and there is unlikely to be any redundancy between files.