Lua API
  • 🔎Overview
  • Introduction
    • 🚀Creating scripts
      • 🧠First Steps
      • 🖥️Adding UI
      • 📚Creating Libraries
  • API
    • 🌐Global Functions
    • ⚙️Instances
      • 🔢Math
      • ☎️Events
        • event_t
      • 🎮Game
        • global_vars_t
        • cengine_client
          • cnet_chan
        • ccsgo_input
        • cinput_system
        • cgame_ui_funcs
        • ccvar
          • convar
      • 🕹️Mods
        • events_t
      • ✏️Draw
        • ⚙️Types
          • ⚙️rect
          • ⚙️vec2
          • ⚙️color
          • ⚙️accessor
        • 🖥️Adapter
        • ✏️Layer
          • outline_mode
          • rounding
          • glow_parts
          • text_params
            • text_alignment
          • shadow_dir
          • command
            • render_mode
        • 🖼️Managed
          • 🖼️texture
            • svg_texture
            • animated_texture
          • 🖼️shader
          • ™️font_base
            • font
            • font_gdi
            • glyph_t
            • font_flags
      • 🙋Entities
        • entity_list_t
          • entity_entry_t
        • base_entity
          • schema_accessor_t
          • cs2_weapon_base_gun
          • cs2_player_pawn
          • cs2_player_controller
          • cs2_weapon_base
          • cs2_grenade_projectile
        • ccsweapon_base_vdata
          • cfiring_mode
        • chandle
        • csweapon_mode
        • csweapon_type
        • weapon_id
        • csweapon_category
        • observer_mode_t
      • 🖥️Gui
        • ⚙️Types
          • ⚙️bits
          • ⚙️control_id
        • context
          • user_t
        • context_input
          • mouse_button
        • notification_system
          • notification
        • control
          • control_type
          • value_param
          • checkbox
          • slider
          • label
          • selectable
          • button
          • color_picker
          • spacer
          • text_input
          • combo_box
          • image
        • container
          • control_container
            • layout
            • group
      • ⚙️Utils
    • ⚙️Types
      • ⚙️ptr
      • ⚙️ref_holder_t
      • ⚙️vector
      • ⚙️vector4d
      • 🎮veccolor
      • 🎮color
      • 🎮cview_setup
      • 🎮cuser_cmd
      • 🎮game_event_t
    • 🟰Enums
      • 🟰client_frame_stage
      • 🟰input_bit_mask
Powered by GitBook

© 2025 - FATALITY

On this page
  • __call
  • should_loop
  • set_frame
  • get_frame_count
Export as PDF
  1. API
  2. Instances
  3. Draw
  4. Managed
  5. texture

animated_texture

Previoussvg_textureNextshader

Last updated 3 months ago

This type is an animated texture. This texture type only supports animated GIF types, and does not support APNG.

This type inherits type. All of its base methods and fields are also available in this type.

If you pass an unsupported type, it will instead work exactly like type, meaning controlling frames and looping will be meaningless.

Using this type for texture atlases is possible, although highly unrecommended. It will produce extra texture objects in memory, and overall will be much slower. Instead, it is advised to construct an actual texture atlas, use type, and use texture mapping.

__call

Constructs animated texture.

Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.

Arguments

1. From file.

Name

Type

Description

path

string

Path to the texture file.

2. From memory.

Name

Type

Description

data

Pointer to texture file data in memory.

sz

int

Size of the texture file data.

Returns

Type

Description

animated_texture

Animated texture instance.

Example

local gif = draw.animated_texture('funny_gif.gif');

should_loop

Type: bool

If set to false, will not loop the animation automatically. Defaults to true.


Reset loop to run from the first frame.

Arguments

None.

Returns

Nothing.

Example

gif:reset_loop();

set_frame

Set a specific frame on the animation. If looping is enabled, will continue the cycle from the passed frame. Otherwise, will display a specific frame of the animation.

Frame count starts from 0.

Arguments

Name

Type

Description

frame

int

Frame number. Invalid frame numbers will be clamped.

Returns

Nothing.

Example

gif:set_frame(5);

get_frame_count

Returns amount of frames in the animation.

Arguments

None.

Returns

Type

Description

int

Frame count.

Example

local frames = gif:get_frame_count();
gif:set_frame(frames - 2); -- set to the last frame

⚙️
✏️
🖼️
🖼️
texture
texture
texture
ptr