/tg/ Station 13 - Modules - Types — Var Details - Proc Details

preview_animation_reading

Reads which pixels of an animated icon state change, and between which frames, a frame at a time: each frame is compared with the one before it, in every direction at once. A pixel that changes between any two frames is one that changes between two that follow each other, so their differences together give the box that changes.

BYOND's icon procs have no comparison, so it is made of them: each frame twice over, once as its colours and once as its alpha in grey, both opaque, subtracted from the other frame's both ways and added up, is black where the two frames are the same and not where they differ. Subtracting doesn't work on clear pixels, which only come out clear. Shrinking that averages it, so a shrunk difference is black only if the whole was.

Vars

changes"[dir]" -> whether each frame differs from the one before it, the first from the last.
delaysHow long each frame shows, in ms.
dirsThe directions the state draws: one, or the four the preview turns to.
frameThe frame read last; past the last frame, the comparison of the last with the first.
framesHow many frames the state has.
rewindWhether the state plays back and forth.
unionWhite wherever any frame differs from the one before it.

Procs

read_nextReads the next frame. TRUE once every frame has been read and compared.
resultWhat animating the state takes: list("delays" = ms each frame shows, "rewind" = whether it plays back and forth, "single" = whether it draws one direction for every facing, "dirs" = "[dir]" -> list("box" = the box that changes, as x1, y1, x2, y2 from the lower left, "changes" = whether each frame differs from the one before it, the first from the last)). A direction that changes nothing is left out. FALSE if none changes anything.

Var Details

changes

"[dir]" -> whether each frame differs from the one before it, the first from the last.

delays

How long each frame shows, in ms.

dirs

The directions the state draws: one, or the four the preview turns to.

frame

The frame read last; past the last frame, the comparison of the last with the first.

frames

How many frames the state has.

rewind

Whether the state plays back and forth.

union

White wherever any frame differs from the one before it.

Proc Details

read_next

Reads the next frame. TRUE once every frame has been read and compared.

result

What animating the state takes: list("delays" = ms each frame shows, "rewind" = whether it plays back and forth, "single" = whether it draws one direction for every facing, "dirs" = "[dir]" -> list("box" = the box that changes, as x1, y1, x2, y2 from the lower left, "changes" = whether each frame differs from the one before it, the first from the last)). A direction that changes nothing is left out. FALSE if none changes anything.