Animation extension method and device, extended animation playing method and device, equipment and medium

By generating a unified configuration in protobuf format, the original animation file and mask resources are merged, enabling lightweight expansion of the animation file and dynamic mounting of the mask. This solves the problem that existing animation formats cannot dynamically insert custom content, improving resource reuse and management efficiency.

CN121767513APending Publication Date: 2026-03-31GUANGZHOU MIZAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-12
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing mainstream animation formats cannot dynamically insert custom content, resulting in low resource reuse, increased time costs, and greater difficulty in resource management. Furthermore, the VAP video format consumes too much memory and CPU resources, making it unsuitable for large-scale deployment scenarios.

Method used

By parsing the original animation file and the target mask resource, a unified configuration in protobuf format is generated and merged into the resource header of the original animation file to achieve dynamic mask mounting, supporting the dynamic insertion of static PNG images and text.

Benefits of technology

It achieves compatibility and resource efficiency for lightweight extended animation files, improves resource reuse rate, reduces development and management costs, and ensures the stability and smoothness of dynamic mounting effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121767513A_ABST
    Figure CN121767513A_ABST
Patent Text Reader

Abstract

The invention provides an animation extension method and device, an extended animation playing method and device, equipment and a medium, and relates to the technical field of animation processing. The animation extension method comprises the steps that an original animation file is analyzed, an original animation sequence frame and animation configuration in a protobuf format are obtained, the format of the original animation file is any one of APNG, WebP and GIF, and the animation configuration comprises the size and frame rate information of the original animation; a target mask sequence frame of the target mask resource is imported, effective information of the mask sequence frame is extracted, mask configuration in the protobuf format is generated, and the effective information comprises the position, the size and the scaling rate of a non-transparent area in the mask sequence frame; the animation configuration and the mask configuration are combined into the unified protobuf configuration file, the resource header of the original animation file is written, the extended animation file is exported, lightweight extension of the original animation format is achieved, mask resources can be mounted, the animation resource reuse rate is increased, and the development and management cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of animation processing technology, and in particular to an animation extension and a method, apparatus, device and medium for playing extended animation. Background Technology

[0002] APNG, WebP, and GIF are currently the mainstream animated image formats, widely used in mobile applications, web page interactions, and other scenarios. In existing technologies, these animated image formats all provide a fixed animation effect. "Fixed" here means that the effect is completely consistent regardless of the playback scenario; each resource is designed for a specific scenario. If animation resources need to make even minor differences in effect for different situations, each effect must be exported as a separate resource file. This makes it impossible to dynamically insert custom content (such as personalized images or text information), resulting in low resource reuse, increased time costs, and greater difficulty in resource management.

[0003] Currently, one resource format that allows for the dynamic insertion of custom images and text is VAP (VideoAnimationPlayer). However, VAP is based on MP4, meaning its playback consumes significantly more memory and CPU than typical animated image resources, making it unsuitable for large-scale deployments. Summary of the Invention

[0004] This invention provides an extension of animation and a method, apparatus, device, and medium for playing extended animations, in order to solve the defect in existing mainstream animation formats that cannot dynamically insert custom content, realize dynamic mask mounting, and balance compatibility and resource efficiency.

[0005] This invention provides a method for extending animation, comprising:

[0006] The original animation file is parsed to obtain the original animation sequence frames and the animation configuration in protobuf format. The original animation file is in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0007] Import the target mask sequence frame of the target mask resource, extract the effective information of the mask sequence frame, and generate a mask configuration in protobuf format. The effective information includes the position, size, and scaling of the non-transparent area in the mask sequence frame.

[0008] The animation configuration and the mask configuration are merged into a unified protobuf configuration file, the unified protobuf configuration file is written into the resource header of the original animation file, and the extended animation file is exported.

[0009] According to an animation extension method provided by the present invention, the step of importing a target mask sequence frame and extracting valid information from the mask sequence frame includes:

[0010] Import the target masking sequence frames;

[0011] The transparent and non-transparent areas in the masking sequence frames are identified based on transparency.

[0012] Extract the boundary coordinates, width and height dimensions, and scaling factor of the non-transparent area to determine the valid information.

[0013] According to an animation extension method provided by the present invention, after identifying the transparent and non-transparent regions in the mask sequence frames based on transparency, the method further includes:

[0014] Based on the boundary coordinates of the non-transparent area, determine whether the shape of the non-transparent area is rectangular or circular;

[0015] If yes, then the step of extracting the boundary coordinates, width and height dimensions, and scaling factor of the non-transparent area and determining them as valid information is performed; if no, then non-rectangular and non-circular non-transparent areas are filtered out.

[0016] According to an animation extension method provided by the present invention, the target mask sequence frame is named according to the sequence number drawn in the corresponding original animation sequence frame.

[0017] According to an animation extension method provided by the present invention, the target masking resource is a static PNG image or text.

[0018] The present invention also provides a method for playing extended animation, comprising:

[0019] Obtain the extended animation file as described in any of the above methods;

[0020] Parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resource through the interface;

[0021] Play the extended animation file, and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0022] The present invention also provides an animation extension device, comprising:

[0023] The first acquisition module is used to parse the original animation file and obtain the original animation sequence frames and the animation configuration in protobuf format. The original animation file is in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0024] The generation module is used to import the target mask sequence frame of the target mask resource, extract the effective information of the mask sequence frame, and generate a mask configuration in protobuf format. The effective information includes the position, size, and scaling rate of the non-transparent area in the mask sequence frame.

[0025] The export module is used to merge the animation configuration and the mask configuration into a unified protobuf configuration file, write the unified protobuf configuration file into the resource header of the original animation file, and export the extended animation file.

[0026] The present invention also provides an extended animation playback device, comprising:

[0027] The second acquisition module is used to acquire the extended animation file as described in any of the above methods;

[0028] The parsing module is used to parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resources through the interface;

[0029] The playback module is used to play the extended animation file and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0030] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the above-described methods for extending the animation or for playing the extended animation.

[0031] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for extending the animation as described above or the method for playing the extended animation.

[0032] The present invention provides an extension of animation and a method, apparatus, device, and medium for playing extended animation, which, compared with the prior art, have the following beneficial technical effects:

[0033] 1. Achieve lightweight extension of the original animation format without reconstructing the core data of the animation file: Generate and merge configurations through protobuf format, write unified configurations only in the resource header of the original animation file, do not destroy the main content of the original animation, ensure that the original player can play the original animation effect normally, be compatible with the existing animation resource ecosystem, and do not need to discard existing resources;

[0034] 2. Significantly improve the reuse rate of animation resources and reduce development and management costs: The extended animation files can dynamically mount mask resources through subsequent extended players. One set of resources can adapt to the effect differences of multiple scenes. There is no need to export multiple independent resources for minor differences, reducing resource redundancy and management difficulty.

[0035] 3. Small configuration size and high parsing efficiency: Relying on the serialization advantages of protobuf, the size increase of the merged configuration file is minimal, and the parsing speed is fast, which will not significantly increase the storage and transmission costs of animation files, while adapting to the fast parsing needs of multiple platforms.

[0036] 4. Unified extension logic and compatibility with multiple original animation formats: For mainstream animation formats such as APNG, WebP, and GIF, a consistent "parse-configure-merge" process is adopted, eliminating the need to design differentiated extension solutions for different formats and reducing cross-format development and adaptation costs;

[0037] 5. Lay a stable foundation for dynamic mounting functionality: By extracting effective information from the non-transparent areas of the mask sequence frames and standardizing the configuration, the core parameters of the mask are clarified, ensuring that subsequent extended players can accurately parse and efficiently draw the mask content, thus guaranteeing the stability and smoothness of the dynamic mounting effect. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 This is a flowchart illustrating an animation extension method provided by the present invention;

[0040] Figure 2 This is a flowchart illustrating an extended animation playback method provided by the present invention;

[0041] Figure 3 This is a schematic diagram of the structure of an animation extension device provided by the present invention;

[0042] Figure 4 This is a schematic diagram of the structure of an extended animation playback device provided by the present invention;

[0043] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0045] It should be noted that in the description of the embodiments of the present invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and do not limit the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0046] The following is combined Figures 1 to 5 This invention describes an extension of animation and a method, apparatus, device, and medium for playing extended animation.

[0047] like Figure 1 As shown, the present invention provides an extended method for animation, comprising:

[0048] Step 110: Parse the original animation file to obtain the original animation sequence frames and the animation configuration in protobuf format. The original animation file can be in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0049] Specifically, the original animation resources are completely parsed and broken down into a series of frame sequences using a tool. Starting from the first frame, PNG images with frame numbers are generated sequentially, such as naming the first frame 000.png, the second frame 001.png, and so on. The animation configuration is then parsed and obtained in protobuf format, containing all information about the original animation resources, such as size, frame rate, etc.

[0050] Step 120: Import the target mask sequence frame of the target mask resource, extract the valid information of the mask sequence frame, and generate a mask configuration in protobuf format. The valid information includes the position, size, and scaling of the non-transparent area in the mask sequence frame.

[0051] Specifically, the target mask resource is a new resource that will be displayed on top of the original animation resource. The target mask resource can be displayed as either a static PNG image or text. That is, static PNG images or text can be dynamically mounted on the original animation. The appearance frame (i.e., the frame in which the static PNG image or text appears), position, size, and color value of these static PNG images and text can be defined by the mask configuration. Users can specify in the mask configuration whether the mask is displayed as a static PNG image or text, and the text can further specify its size and color. Each target mask sequence frame is considered an independent layer with a unique mask name to distinguish different mask layers. In some embodiments, the target mask sequence frames are named according to the sequence number drawn on the corresponding original animation sequence frame. The target mask sequence frame image is named as a PNG image with the corresponding frame number, in the form of three digits followed by a .png suffix, such as 000.png, 999.png, etc.

[0052] In some embodiments, importing the target mask sequence frame and extracting valid information from the mask sequence frame includes:

[0053] Import the target masking sequence frames;

[0054] The transparent and non-transparent areas in the masking sequence frames are identified based on transparency.

[0055] Extract the boundary coordinates, width and height dimensions, and scaling factor of the non-transparent area to determine the valid information.

[0056] In this embodiment, non-transparent areas (areas with non-zero transparency) are filtered out by pixel transparency detection, and their boundary coordinates, width and height dimensions, and scaling factor are obtained. The purpose of importing the target mask sequence frame is to read its effective information, specifically the position and size of the non-transparent areas, scaling factor, etc., within the mask sequence frame. The essence of the mask sequence frame is to carry the effective display area, i.e., the mask area that the user can actually see. Therefore, only the effective information of the non-transparent areas is extracted, not the information of the entire canvas area of ​​the mask sequence frame. For example, if the canvas of the mask sequence frame is 500×500 pixels, but only the central 100×100 pixel area has non-zero transparency while the rest is completely transparent, then only the effective information of this 100×100 pixel area is extracted to generate a mask configuration in the same protobuf format, ensuring compatibility between the mask and the original animation.

[0057] In some embodiments, after identifying the transparent and non-transparent regions in the mask sequence frames based on transparency, the process includes:

[0058] Based on the boundary coordinates of the non-transparent area, determine whether the shape of the non-transparent area is rectangular or circular;

[0059] If yes, then the step of extracting the boundary coordinates, width and height dimensions, and scaling factor of the non-transparent area and determining them as valid information is performed; if no, then non-rectangular and non-circular non-transparent areas are filtered out.

[0060] To reduce configuration size and improve the efficiency of subsequent masking processing, this embodiment only supports rectangular and circular masks. The mask configuration limits the mask shape to rectangular or circular; other shapes will be filtered out. The coordinate calculation and scaling logic for rectangles and circles are simple, adaptable to multiple platforms for efficient rendering, reducing the computational complexity of mask drawing and ensuring smoothness when the extended player is dynamically mounted.

[0061] To further reduce the size of the configuration and improve the efficiency of subsequent masking processing, in some embodiments, it is also determined whether the size of the target masking sequence frame is not greater than the original animation size, and whether the number of target masking sequence frames does not exceed the number of original animation sequence frames. If the size of the target masking sequence frame is greater than the original animation size or the number of target masking sequence frames exceeds the number of original animation sequence frames, it is considered invalid input and is filtered out.

[0062] Once the valid information is confirmed, record the masking parameters in protobuf format and generate the masking configuration. The masking configuration can include the masking display type (static PNG image / text), masking size, text color, display frame range, and unique masking name (to distinguish multiple layers of masks).

[0063] Step 130: Merge the animation configuration and the mask configuration into a unified protobuf configuration file, write the unified protobuf configuration file into the resource header of the original animation file, and export the extended animation file.

[0064] Specifically, the animation configuration and masking configuration are combined into a final protobuf file. This file, as the playback configuration for the animation resource, is written into the resource header of the original animation file without damaging the core data of the original animation. This ensures that the original player can play the original animation effect normally. The modified animation resource is then exported as the extended animation file. The final exported animation format can be different from the original animation format, such as converting GIF to WebP, to maximize performance optimization on different platforms.

[0065] Correspondingly, such as Figure 2 As shown, the present invention also provides a method for playing extended animations, which can be applied to extended players, specifically including the following steps:

[0066] Step 210: Obtain the extended animation file.

[0067] Step 220: Parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resource through the interface.

[0068] Step 230: Play the extended animation file and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0069] Specifically, the extended player has a built-in protobuf parser that reads and parses the unified protobuf configuration in the extended animation file resource header to obtain the animation configuration and mask configuration. It then retrieves the corresponding target mask resource through an interface. During playback, the extended player matches the corresponding mask based on the frame number of the current original animation sequence frame. According to the position and size configured in the mask configuration, the target mask resource is drawn to the corresponding layer of the original animation frame, achieving the mask mounting effect. Specifically, the masks are drawn according to their priority order to ensure the correct display logic for multiple mask layers.

[0070] For example, if the text content "Limited-time offer" is obtained through the interface, the corresponding mask configuration includes: appearing frames 10 to 50, position coordinates (500, 300), text size 24, and text color red. Then, when the original animation plays to frame 10, the red 24-point text "Limited-time offer" will be drawn at the original animation coordinates (500, 300) and will continue until frame 50. When the animation plays to frame 51, "Limited-time offer" will no longer be displayed.

[0071] It's important to note that users can configure what custom resources are displayed under the overlay (the player obtains this information via a method interface before playback begins; it cannot be modified at the start of playback, and any modifications require replaying the resource). During image resource playback, the player renders the image based on the current frame and the configuration of the custom resource, ultimately producing a single resource that adapts to different scene variations. For example, if the same original animation resource needs to be used, and the text "New Product Launch" is attached to it, there's no need to recreate the animation resource. Simply modify the custom text content in the extended player via an interface, and the overlay text will dynamically replace the overlay text during playback, enabling the reuse of a single resource across multiple scenes.

[0072] The aforementioned extended player is a dedicated animation player customized and developed based on the technical solution of this invention. Its core positioning is to be compatible with the original animation playback and the ability to dynamically mount new masking. It retains playback support for standard formats such as APNG, WebP, and GIF, and can also parse the extended animation files of this invention (the resource header contains a unified protobuf configuration). Through the interface, it can obtain user-defined masking resources (static images / text) and dynamically draw the masking content frame by frame during playback, realizing the adaptation of one set of resources to multiple scenarios.

[0073] The above-described method for extending and playing extended animation has the following beneficial technical effects compared with existing technologies:

[0074] 1. Achieve lightweight extension of the original animation format without reconstructing the core data of the animation file: Generate and merge configurations through protobuf format, write unified configurations only in the resource header of the original animation file, do not destroy the main content of the original animation, ensure that the original player can play the original animation effect normally, be compatible with the existing animation resource ecosystem, and do not need to discard existing resources;

[0075] 2. Significantly improve the reuse rate of animation resources and reduce development and management costs: The extended animation files can dynamically mount mask resources through subsequent extended players. One set of resources can adapt to the effect differences of multiple scenes. There is no need to export multiple independent resources for minor differences, reducing resource redundancy and management difficulty.

[0076] 3. Small configuration size and high parsing efficiency: Relying on the serialization advantages of protobuf, the size increase of the merged configuration file is minimal, and the parsing speed is fast, which will not significantly increase the storage and transmission costs of animation files, while adapting to the fast parsing needs of multiple platforms.

[0077] 4. Unified extension logic and compatibility with multiple original animation formats: For mainstream animation formats such as APNG, WebP, and GIF, a consistent "parse-configure-merge" process is adopted, eliminating the need to design differentiated extension solutions for different formats and reducing cross-format development and adaptation costs;

[0078] 5. Lay a stable foundation for dynamic mounting functionality: By extracting effective information from the non-transparent areas of the mask sequence frames and standardizing the configuration, the core parameters of the mask are clarified, ensuring that subsequent extended players can accurately parse and efficiently draw the mask content, thus guaranteeing the stability and smoothness of the dynamic mounting effect.

[0079] The following describes the animation extension device and the extended animation playback device provided by the present invention. The animation extension device described below and the animation extension method described above can be referred to in correspondence with each other. The extended animation playback device described below and the extended animation playback method described above can be referred to in correspondence with each other.

[0080] like Figure 3 As shown, the present invention also provides an animation extension device, comprising:

[0081] The first acquisition module 310 is used to parse the original animation file and acquire the original animation sequence frames and the animation configuration in protobuf format. The original animation file is in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0082] The generation module 320 is used to import the target mask sequence frame of the target mask resource, extract the effective information of the mask sequence frame, and generate a mask configuration in protobuf format. The effective information includes the position, size, and scaling rate of the non-transparent area in the mask sequence frame.

[0083] The export module 330 is used to merge the animation configuration and the mask configuration into a unified protobuf configuration file, write the unified protobuf configuration file into the resource header of the original animation file, and export the extended animation file.

[0084] like Figure 4 As shown, the present invention also provides an extended animation playback device, comprising:

[0085] The second acquisition module 410 is used to acquire extended animation files;

[0086] Parsing module 420 is used to parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resource through the interface;

[0087] The playback module 430 is used to play the extended animation file and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0088] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute an extended method of animation, which includes:

[0089] The original animation file is parsed to obtain the original animation sequence frames and the animation configuration in protobuf format. The original animation file is in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0090] Import the target mask sequence frame of the target mask resource, extract the effective information of the mask sequence frame, and generate a mask configuration in protobuf format. The effective information includes the position, size, and scaling of the non-transparent area in the mask sequence frame.

[0091] The animation configuration and the mask configuration are merged into a unified protobuf configuration file, the unified protobuf configuration file is written into the resource header of the original animation file, and the extended animation file is exported.

[0092] Alternatively, execute the playback method for the extended animation, which includes:

[0093] Get the extended animation file;

[0094] Parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resource through the interface;

[0095] Play the extended animation file, and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0096] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0097] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute an extended method of animation provided by the above methods, the method comprising:

[0098] The original animation file is parsed to obtain the original animation sequence frames and the animation configuration in protobuf format. The original animation file is in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0099] Import the target mask sequence frame of the target mask resource, extract the effective information of the mask sequence frame, and generate a mask configuration in protobuf format. The effective information includes the position, size, and scaling of the non-transparent area in the mask sequence frame.

[0100] The animation configuration and the mask configuration are merged into a unified protobuf configuration file, the unified protobuf configuration file is written into the resource header of the original animation file, and the extended animation file is exported.

[0101] Alternatively, execute the playback method for the extended animation, which includes:

[0102] Get the extended animation file;

[0103] Parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resource through the interface;

[0104] Play the extended animation file, and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0105] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an extended method for performing the animations provided by the methods described above, the method comprising:

[0106] The original animation file is parsed to obtain the original animation sequence frames and the animation configuration in protobuf format. The original animation file is in any of the following formats: APNG, WebP, or GIF. The animation configuration includes the size and frame rate information of the original animation.

[0107] Import the target mask sequence frame of the target mask resource, extract the effective information of the mask sequence frame, and generate a mask configuration in protobuf format. The effective information includes the position, size, and scaling of the non-transparent area in the mask sequence frame.

[0108] The animation configuration and the mask configuration are merged into a unified protobuf configuration file, the unified protobuf configuration file is written into the resource header of the original animation file, and the extended animation file is exported.

[0109] Alternatively, execute the playback method for the extended animation, which includes:

[0110] Get the extended animation file;

[0111] Parse the unified protobuf configuration in the extended animation file and obtain the corresponding target mask resource through the interface;

[0112] Play the extended animation file, and dynamically draw the target mask resource to the corresponding position of the original animation sequence frame according to the unified protobuf configuration to achieve the mask mounting effect.

[0113] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0114] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An extension method of animation, characterized by, The method comprises the following steps: analyzing an original animation file to obtain original animation sequence frames and a protobuf format animation configuration, wherein the format of the original animation file is any one of the following: APNG, WebP, and GIF, and the animation configuration contains size and frame rate information of the original animation; importing target mask sequence frames of a target mask resource, extracting effective information of the mask sequence frames, and generating a protobuf format mask configuration, wherein the effective information includes the position, size, and scaling rate of a non-transparent region in the mask sequence frames; merging the animation configuration and the mask configuration into a unified protobuf configuration file, writing the unified protobuf configuration file into a resource header of the original animation file, and exporting an extended animation file.

2. The method of claim 1, wherein, The step of importing the target mask sequence frames and extracting the effective information of the mask sequence frames comprises the following steps: importing the target mask sequence frames; identifying transparent regions and non-transparent regions in the mask sequence frames according to transparency; extracting boundary coordinates, width and height dimensions, and scaling rates of the non-transparent regions to determine the effective information.

3. The method of claim 2, wherein, After identifying the transparent regions and the non-transparent regions in the mask sequence frames according to the transparency, the following steps are included: determining whether the shape of the non-transparent region is a rectangle or a circle according to the boundary coordinates of the non-transparent region; if yes, performing the step of extracting the boundary coordinates, the width and height dimensions, and the scaling rates of the non-transparent region to determine the effective information; and if no, filtering non-rectangular and non-circular non-transparent regions.

4. The method of claim 1, wherein, The target mask sequence frames are named according to the sequence numbers of corresponding original animation sequence frames.

5. The method of claim 1 to 4, wherein, The target mask resource is a static PNG picture or text.

6. An extension animation playback method characterized by, The method comprises the following steps: obtaining an extended animation file according to any one of claims 1 to 5; analyzing the unified protobuf configuration in the extended animation file, and obtaining a corresponding target mask resource through an interface; playing the extended animation file, dynamically drawing the target mask resource to a corresponding position of an original animation sequence frame according to the unified protobuf configuration, and realizing a mask mounting effect.

7. An extension device for animation, characterized by The method comprises the following steps: a first obtaining module is configured to analyze an original animation file to obtain original animation sequence frames and a protobuf format animation configuration, wherein the format of the original animation file is any one of the following: APNG, WebP, and GIF, and the animation configuration contains size and frame rate information of the original animation; a generating module is configured to import target mask sequence frames of a target mask resource, extract effective information of the mask sequence frames, and generate a protobuf format mask configuration, wherein the effective information includes the position, size, and scaling rate of a non-transparent region in the mask sequence frames; a exporting module is configured to merge the animation configuration and the mask configuration into a unified protobuf configuration file, write the unified protobuf configuration file into a resource header of the original animation file, and export an extended animation file.

8. A device for playing extended animation, characterized in that, The method comprises the following steps: a second obtaining module is configured to obtain an extended animation file according to any one of claims 1 to 5. The parsing module is configured to parse a uniform protobuf configuration in the extended animation file, and obtain a corresponding target mask resource through an interface. The playing module is configured to play the extended animation file, dynamically draw the target mask resource to a corresponding position of an original animation sequence frame according to the uniform protobuf configuration, and realize a mask mounting effect.

9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the animation extension method or the extended animation playing method according to any one of claims 1 to 6 when executing the program. 10.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the animation extension method or the extended animation playing method according to any one of claims 1 to 6 when executed by the processor.