-
Notifications
You must be signed in to change notification settings - Fork 2
Spray and Emoticon Animations
Both sprays and emoticons have animated images and will be extracted as apng. The original texture sheets are extracted as well if wanting to create a custom animation.
Spray and emoticon data both have the following available properties: texture, frames, and duration.
Emoticons also have width, rows, and columns.
animation.texture - the original texture sheet in .png format
animation.frames - the total number of frames on the texture sheet
animation.duration - how long each frame will last before changing to the next frame
animation.width - width of each frame
animation.rows - the number of rows in the texture
animation.columns - the number of columns in the texture
Pseudocode to get the frames from the texture sheet.
// load up the texture sheet file
Set original_texture_sheet = animation.texture
// get frame (max) width; it is not the same as animation.width
Set frame_width = original_texture_sheet.width / animation.columns
// get frame height
Set frame_height = original_texture_sheet.height / animation.rows
For i = 0 to animation.frames
// calculate the x and y position (0,0 is top left) to find the location of the frame on original_texture_sheet
Set x_position = (i mod (original_texture_sheet.width / frame_width)) * frame_width
Set y_position = floor(i / (original_texture_sheet.width / frame_width)) * frame_height
// to get the frame from the texture sheet use the x_position and y_position along with the original_texture_sheet width and height
Set image_frame = GetRectangle(Point(x_position, y_position), Size(original_texture_sheet.width, original_texture_sheet.height))
// the time duration of the frame
image_frame.duration = animation.duration
End For
Pseudocode to get the frames from the texture sheet. The same algorithm used for emoticons applies here; only the frame (max) width calculation differs.
// calculate the frame (max) width
Set frame_width = original_texture_sheet.width
if (animation.frames > 0)
frame_width = original_texture_sheet.width / animation.frames
Note
The animation.duration value may need to be tweaked so the animation appears visually correct.