Animation processing method, device and equipment
Patent Information
- Application Number
- CN201811248192.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-10-25
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2038-10-25
AI Technical Summary
目前,常采用辅助工具将待播放动画的动画源文件导出生成动画描述文件,比如Lottie(一种开源的动画库)方案、SVGA(一种开源的动画架构)方案,虽然能减小动画文件大小,但在播放端解析该动画描述文件时仍需占用较多系统资源(如内存空间、CPU时间)
[0033]本说明书实施例采用的上述至少一个技术方案能够达到以下有益效果:通过将待处理的动画源文件(即动画素材)生成动画描述数据,这样通过占体积很小的动画描述数据就能完整地保留了原动画素材中动画元素的动画效果,既有利于减小动画文件大小,又非常方便开发人员利用描述数据处理动画素材实现更复杂的动画效果;然后将动画描述数据序列化生成动画目标文件,既进一步降低动画文件的大小,又进一步方便播放端进行反序列化处理和绘制动画,以及支持跨平台的动画应用,可提高动画播放性能(如效率、资源占用)。
Smart Images

Figure CN109636884B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to an animation processing method, apparatus, and device. Background Technology
[0002] As users increasingly utilize mobile devices, application service providers often employ animations to enhance the user experience and display various information, such as app launch welcome pages, loading progress bars, live stream information displays, and game rendering. Animations created using existing technologies, such as traditional frame animations, attribute animations, GIF (Graphics Interchange Format) animations, or WebP (an image format designed to speed up image loading), require loading a series of resource images during playback. These resource images often contain many repetitive elements. Therefore, creating bitmaps during animation playback requires significant memory and CPU time slices for rendering calculations. Currently, auxiliary tools are commonly used to export the animation source files to generate animation description files, such as Lottie (an open-source animation library) and SVGA (an open-source animation architecture). While this reduces the animation file size, parsing the animation description file on the playback device still consumes considerable system resources (such as memory and CPU time).
[0003] Therefore, there is a need for animation processing solutions that can reduce the system resource consumption of animation playback. Summary of the Invention
[0004] In view of this, embodiments of this specification provide an animation processing method, apparatus, and device for reducing the resource occupancy rate, such as memory resources and CPU resources, during animation playback.
[0005] The embodiments in this specification adopt the following technical solutions:
[0006] This specification provides an animation processing method, including:
[0007] Animation description data is generated from the animation source file of the animation to be played according to a preset data description format. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0008] The animation description data is serialized according to a preset data protocol to generate an animation target file, which is then used as the loading file for the animation to be played.
[0009] This specification also provides an animation processing method, including:
[0010] Load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0011] The animation target file is deserialized according to the data protocol to generate animation rendering data;
[0012] The animation drawing data is drawn on a preset canvas to enable the playback of the animation to be played.
[0013] This specification also provides an animation processing apparatus, including a generation module and a serialization module;
[0014] The generation module is used to generate animation description data from the animation source file of the animation to be played according to a preset data description format. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0015] The serialization module is used to serialize the animation description data according to a preset data protocol to generate an animation target file.
[0016] This specification also provides an animation processing apparatus, including a loading module, a deserialization module, and a drawing module;
[0017] The loading module is used to load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0018] The deserialization module is used to deserialize the animation file according to the data protocol to generate animation drawing data;
[0019] The drawing module is used to draw the animation drawing data on a preset canvas to realize the playback of the animation to be played.
[0020] This specification also provides an electronic device for processing animation, comprising:
[0021] At least one processor; and,
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:
[0024] Animation description data is generated from the animation source file of the animation to be played according to a preset data description format. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0025] The animation description data is serialized according to a preset data protocol to generate an animation target file, which is then used as the loading file for the animation to be played.
[0026] This specification also provides an electronic device for processing animation, comprising:
[0027] At least one processor; and,
[0028] A memory communicatively connected to the at least one processor; wherein,
[0029] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:
[0030] Load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0031] The animation target file is deserialized according to the data protocol to generate animation rendering data;
[0032] The animation drawing data is drawn on a preset canvas to enable the playback of the animation to be played.
[0033] The above-mentioned at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects: by generating animation description data from the animation source file to be processed (i.e., animation material), the animation effects of the animation elements in the original animation material can be completely preserved with animation description data that occupies a very small volume. This not only helps to reduce the size of the animation file, but also makes it very convenient for developers to use the description data to process the animation material to achieve more complex animation effects. Then, the animation description data is serialized to generate the animation target file, which further reduces the size of the animation file, further facilitates the playback end to perform deserialization processing and animation drawing, and supports cross-platform animation applications, thereby improving animation playback performance (such as efficiency and resource consumption). Attached Figure Description
[0034] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a schematic diagram of the overall processing framework for animation processing in the embodiments of this specification.
[0036] Figure 2 This is a flowchart of the animation processing method of Embodiment 1 in this specification.
[0037] Figure 3 This is a schematic diagram of the structure of a JSON-formatted description data in the animation processing method of Embodiment 1 of this specification.
[0038] Figure 4 This is a schematic diagram of the structure of a custom-formatted description data in the animation processing method of Embodiment 1 of this specification.
[0039] Figure 5 This is a schematic diagram of the structure of an interface description data file in the animation processing method of Embodiment 1 of this specification.
[0040] Figure 6 This is a flowchart of the voice processing method in the animation processing method of Embodiment 2 of this specification.
[0041] Figure 7 This is a schematic diagram of the animation processing device in Embodiment 4 of this specification.
[0042] Figure 8 This is a flowchart of the animation processing method in Embodiment 5 of this specification.
[0043] Figure 9 This is a schematic diagram of the animation processing device in Embodiment 6 of this specification. Detailed Implementation
[0044] In the embodiments of this specification, animation refers to a dynamic image formed by breaking down a character's expressions, actions, and changes into many frames (i.e., instantaneous movements) using drawing techniques, and then playing these frames.
[0045] In the embodiments of this specification, the animation source file of the animation to be played can be an animation file created by an animation designer. In this case, the animation file can be one or more files of a certain file format, such as a complete frame animation, GIF animation, Flash animation, or attribute animation, or it can be several sequence frames (such as image frames) that constitute the animation to be played. Since the size of the animation source file is generally very large, it requires a lot of system resources in the animation application. For example, it requires storage space when storing, a large amount of bandwidth when transmitting, and even a lot of user data traffic. For example, it requires a lot of memory space when playing, and even a lot of processor resources (such as CPU time slices). On the other hand, each application platform (such as a mobile terminal, such as a mobile phone) needs to preset corresponding parsing tools (such as a parser, a player) to load and play the animation source file. Otherwise, the platform may not be able to play the animation because it cannot recognize the animation source file.
[0046] To reduce the resource consumption of animations, animation application developers typically use auxiliary tools to first export the animation source files created by the animator as animation description files. For example, the Lottie (an open-source animation library) solution uses the Bodymovin plugin in AE (Adobe After Effects, a graphics and video processing software) to export the animation source files created by the animator as JSON (JavaScript Object Notation, a lightweight data exchange format) description files containing animation information as target files. Similarly, the SVGA (an open-source animation architecture) solution uses conversion tools (such as AE or Flash) to directly encapsulate the animation source files created by the animator into SVGA format description files as target files. Then, on the playback end (such as a mobile terminal), a preset parsing tool is used accordingly—for example, the preset parsing tool in the Lottie solution is the Lottie animation library, and the preset parsing tool in the SVGA solution is the SVGA player—to parse the target file and achieve animation playback. While using description files instead of animation source files can reduce the resource consumption of animations, there are still areas for improvement. For example, the Lottie solution is not user-friendly in exporting bitmap animations and does not support certain animation effects, resulting in insufficient support for bitmap animations. Furthermore, it requires packaging, compressing, and then decompressing the target file locally, which makes application development less convenient. Additionally, the Lottie animation library is needed to parse the target file on the playback side. In contrast, the SVGA solution uses conversion tools to encapsulate the animation source file into a target file, and an SVGA player is required on the playback side. This means that it does not support the insertion and playback of other file formats (such as audio), nor does it support the introduction of external triggers to control and influence the form of animation objects during playback to achieve interactivity.
[0047] This specification provides an animation processing method, apparatus, and device. It generates animation description data from the animation source file of the animation to be played, and serializes this data into a binary animation target file according to a preset data protocol. This target file serves as the loading file for the animation during playback. At the playback end, the animation target file can be loaded, deserialized, and used to generate drawing data. This allows for data drawing using the canvas at the playback end to achieve animation playback. This is highly beneficial for animation application developers to develop cross-platform applications for the animation to be played, and deserialization further reduces resource consumption, thus improving animation playback performance. Figure 1As shown in the diagram, the overall framework of the animation processing provided in this embodiment can be divided into the following steps: generating animation description data from the animation source file according to a preset data description format; then parsing (i.e., serializing) the animation description data into a binary data animation target file using an IDL compiler based on an interface description file (IDL file, where IDL stands for Interactive Data Language, also known as a schema file) to adapt to cross-platform loading and playback of the animation; finally, deserializing the animation target file based on the IDL file at the playback end to generate animation drawing data that can be directly drawn on the canvas at the playback end, thereby realizing animation playback by drawing the animation drawing data on the canvas.
[0048] In practice, on the one hand, generating animation description data from animation source files and serializing the animation description data to generate animation target files can be used as a preprocessing method for animation. This allows animation application developers to use this preprocessing method to load and preprocess the animation source files created by animation designers, thereby forming animation target files that can be used in different application scenarios, i.e., cross-platform loading and playback. On the other hand, deserializing the animation target files and drawing the animation drawing data on the canvas can be used as a playback processing method for animation. This allows animation application developers to use this playback processing method to develop applications that allow cross-platform playback of animation target files.
[0049] In practice, a preset data description format can be used to generate the animation description data by describing the animation effects of each animation element in the animation source file. This allows for the omission of repetitive elements in the animation and accurately captures the necessary information (i.e., animation effects) for drawing on the canvas using a small amount of animation description data. This preserves the animation information while effectively reducing the resource consumption of the animation source file. Furthermore, when playing the animation, only information drawing on the canvas is required, eliminating the need for various players for different animation source file formats. On the other hand, using animation description data makes it much easier for animation application developers to read and understand the data, thereby understanding the animation source file. This facilitates application development, debugging, testing, and acceptance. Moreover, animation application developers can easily modify the animation effects by editing (e.g., modifying, adding, or deleting) the animation description data as needed, without requiring animation designers to redesign the animation source file. This approach effectively reduces communication barriers between animation application developers and animators, and avoids communication obstacles between them. By adopting a more resource-efficient data protocol to serialize animation description data into binary animation target files based on preset IDL files, it further saves resource consumption and improves animation playback performance. For example, animation target files generated using a unified data protocol can adapt to different platforms, thus enabling cross-platform animation applications. It also allows for more efficient data storage and transmission, and saves resources such as memory and processor resources during subsequent data parsing. By deserializing animation target files to generate animation rendering data, animation application developers can easily generate animation rendering data for various application platforms based on preset IDL files. This data can then be directly drawn on the canvas to achieve animation playback, facilitating cross-platform application development and saving resources for animation playback.
[0050] It's important to note that animation source files typically consist of several frames, each containing animation information for several animated objects. Each frame can be composed of information about the movement or changes of these animated objects. These animated objects can include those used to convey movement or change information, such as characters (human or animal), objects (graphics or text), and events (sound or scene). Each animated object can be composed of several animated elements. For example, a human character might consist of a head, torso, hands, and feet; these parts are the animated elements of that character. The information about the movement or changes of these animated elements constitutes their corresponding animation effects. Thus, the animation source file can be described using the animation effects of these elements. The animation effects of these elements can be considered as the state data of the animated element at a given point in the animation playback stream.
[0051] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.
[0052] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0053] Example 1
[0054] This specification provides an animation processing method in its embodiments, used to generate animation target files from the source files of an animation to be played, which consumes fewer system resources, thus facilitating animation application development. Specifically, from a device perspective, the executing entity can be a terminal, such as a server, computer, mobile phone, tablet computer, smartwatch, or smart bracelet, which allows animation application developers to generate animation target files from the source files of the animation to be played. This application does not specifically limit this to any particular device.
[0055] In addition, from a programming perspective, the animation processing method provided in the embodiments of this specification can be executed by a program installed on the terminal. This program can be a processing program for animation application developers to process the animation file to be played. This processing program can be a standalone application or an auxiliary program (such as a plug-in program) for other applications. The form of the program can be an application or a web page, etc., without specific limitations here.
[0056] like Figure 2As shown in the embodiments of this specification, an animation processing method includes the following steps:
[0057] Step S102: Generate animation description data from the animation source file of the animation to be played according to the preset data description format. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0058] In practice, the source file of the animation to be played can include animation files created by the animator. This source file can be a complete file of the animation to be played, already created by the animator, or it can consist of several materials (such as image materials) created by the animator to construct the animation. Typically, for ease of subsequent processing, a complete file of the animation to be played can be broken down into several materials needed to construct the animation using auxiliary tools. The specific format of the source file (whether it's a complete file or several materials) can be determined according to the needs of the animation application development. For example, the animation to be played can be a frame animation, property animation, GIF animation, WebP animation, or Flash animation, etc.
[0059] It should be noted that these animation source files can be stored locally or on a server (such as a server or cloud platform); no specific limitation is made here. Furthermore, depending on the needs of animation application development, the corresponding API (Application Programming Interface) can be used to obtain the animation source files, which will not be elaborated upon here.
[0060] Furthermore, to reduce resource consumption in animation development, processing, and application scenarios, there are usually many restrictions on the size of animation files. For example, bandwidth and data usage need to be conserved during transmission, and the client installation package containing the animation application cannot be too large. In this case, the animation source file can be compressed while ensuring animation quality. Specifically, before generating animation description data from the animation source file, the animation processing method may further include: determining whether the file size of the animation source file exceeds a preset file size threshold; if so, compressing the animation source file.
[0061] In practice, the appropriate compression tool can be selected based on the animation quality requirements of the application scenario. Taking the animation application on the Android system as an example, given Android's good support for bitmaps, and the preferred image format for bitmaps is usually PNG (Portable Network Graphics), pngquant (an open-source PNG compression tool) can be used to compress the animation source file. This significantly compresses the image, effectively reducing its size, and consequently, the size of the animation description data. Ultimately, the APK (Android installation package) of the animation application is also effectively reduced. Alternatively, when the animation source file consists of non-PNG format images, auxiliary tools such as Photoshop, After Effects, and Flash can be used to export the animation source file as several PNG images, which can then be compressed using pngquant to further reduce the size of the animation source file.
[0062] The animation source file is parsed using a preset data description format to generate the animation description data. This way, when processing animation source files of different formats, the same data description format can still be used to parse the animation source file.
[0063] In practice, auxiliary tools (such as Photoshop, After Effects, Flash, etc.) can be used to convert animation source files into animation description data. The data description format is usually preset in the auxiliary tool. These tools can include general auxiliary tools provided by third parties, as well as application-specific tools. The preset data description format can be a general format or an application-specific format. This allows for the accurate extraction and retention of data related to animation effects through the animation description data. On one hand, this effectively reduces the resource consumption (such as storage space, memory space, CPU time slices, etc.) of the animation source file during storage, transmission, and playback. On the other hand, it facilitates animation application developers in developing and processing the animation. For example, they can use the animation description data for animation application development, debugging, testing, and acceptance. They can also modify the animation effects by modifying (e.g., adding or deleting) the data in the animation description data. This eliminates the need for animation designers to redesign the animation when changes are needed.
[0064] To facilitate animation application developers in using the animation description data, the preset data description format can adopt a common interface description language format, such as JSON (JavaScript Object Notation, a lightweight data exchange format) or XML (Extensible Markup Language). This allows animation application developers to directly export and generate the animation description data using third-party auxiliary tools that support this common data description format.
[0065] In one alternative implementation, JSON format is preferred, and the animation description data corresponding to the animation source file in JSON format is obtained through the following operations: For example, when the animation source file is an animation file created using After Effects (i.e., the file extension of the animation source file is ".aep"), the Bodymovin plugin in After Effects can be used as an auxiliary tool to export the JSON format file corresponding to the animation source file as the animation description data. As another example, when the animation source file is a Flash animation file, a Flash editor (such as Photoshop CS6) can be used to export a JSON format file as the animation description data.
[0066] It should be noted that, for ease of understanding, a JSON format example describing layers is provided here. Since animations (such as bitmap animations and vector animations) consist of several frames, each frame is composed of several layers, and each layer includes several animation elements, and typically only a few layers in adjacent frames show changes in their animation elements, while most layers show very little or no change in their animation elements—for example, in an animation of a bird gliding through a blue sky with white clouds—the bird is typically one layer, the blue sky another, and the clouds another. The bird's head, body, and wings can be animation elements, as can the changing clouds. In this case, the blue sky layer remains largely the same across frames, the changing clouds change in a few frames, and the bird's layer changes in most frames. Therefore, the frame containing the layer with the changing animation elements (i.e., animation effects) can be defined as a keyframe. By specifying the start and end keyframes, the animation effects of the animation elements in these layers can be described. In other words, several arrays are used to describe the layer information in the keyframes to parse and generate the animation description data.
[0067] like Figure 3As shown, a data description format using JSON typically includes one or more of the following data: a collection description of referenced resources (i.e., resources that make up the animation source file, such as images / pre-compositing layers), where the description data of the referenced resource names is usually stored in the assets array, with multiple resources separated by commas; layer data description, which describes the data of each layer in the frame through layers, where the frame is a specified keyframe, i.e., a specified start keyframe and end keyframe, so the keyframes corresponding to each layer may be exactly the same, partially the same, or even completely different; frame rate parameters, i.e., the number of frames played per second (numerical type); and canvas parameters, used to describe the width (numerical type) and height (numerical type) of the canvas.
[0068] Layer data typically includes: the name of the referenced resource (string type), layer name (string type), parent layer number (i.e., the corresponding layer number of the parent layer it depends on; the first layer may not have parent layer information), layer number (numeric type), layer type (i.e., type value, which can be string or numeric type), starting keyframe in the layer (numeric type), ending keyframe in the layer (numeric type), layer appearance parameters (such as transparency properties, rotation properties, position properties, anchor point parameters, scaling parameters, etc.), layer drawing parameters (such as the width, height, and color of a bitmap layer, or the shape data of a vector layer (which can be described by the path attribute)), and other data.
[0069] In one alternative implementation, given that the common data description format uses keyframes to describe layers, there is often a lot of redundant data. For example, in the aforementioned common JSON format, although describing the data can reduce the size of the animation source file, the animation description data is generated by specifying keyframes (i.e., start and end keyframes) for each layer. This results in repeated descriptions of the same keyframes when describing different layers, leading to duplicate descriptions of animation elements within these keyframes in the generated animation description data. This results in the animation description data consuming significant space resources (such as storage and processing resources). To more effectively describe the animation source file and minimize the resource consumption of the generated animation description data during animation application development, the format of the animation description data can be defined according to the animation application scenario.
[0070] Specifically, when generating animation description data from the animation source file, the animation elements of each frame in the animation source file are parsed according to a preset data description format and generated as a time sequence. By describing each frame of the animation in the source file and forming description data for the animation effects of each animation element in the animation according to a time sequence, this ensures that each frame of the animation has corresponding description data, effectively reduces repetitive description data in animation elements, and facilitates animation application developers to develop applications for each animation element based on the animation description data. This allows for various data insertion methods, editing animation description data to modify the animation effects of animation elements, adding or deleting animation elements, and indexing animation elements to develop new applications.
[0071] For ease of understanding, a custom data description format for the animation description data is given here, such as... Figure 4 As shown, in this data description format, frames are used to describe the animation effects of each animation element in each frame. Here, a key-value structure is used, where the key is a string used as a unique identifier for the animation element (such as ID (Identity)), that is, a bitmap character or vector symbol. The value is a string (i.e., a byte stream) used to describe the animation effect of the animation element corresponding to the key in the time sequence. In this way, through several sets of key-value description data, each element in the animation and its animation effect are described as character data. That is, the animation description data is composed of character data. layout is used to describe the starting position information of the animation element, that is, the x and y coordinate information of the starting position, such as x=14, y=14. sprites are used to describe the appearance parameters of the animation element in each frame, where index is the frame number, such as index=0. trans is used for the bitmap position description or vector description of the frame number index. That is, trans describes the appearance parameters of the animation element, such as position parameters, anchor point parameters, scaling parameters, rotation parameters, etc.
[0072] It should be noted that, in Figure 4The description format shown may also include one or more of the following description parameters: version parameter, such as ver used to identify the version, which is a string (e.g., 1.0.0); count used to describe the total number of frames, which is a numeric type, such as 109 frames; fps used to describe the frame rate, which is a numeric type, such as a frame rate of 30; and ViewBox used to describe the size of the canvas, such as the width and height of the canvas, where width and height are numeric types, such as width = 190 and height = 144. Additionally, depending on the specific needs of the animation application development, parameters such as animation playback time and frame rate can be configured in the custom plugin to achieve configurable animation parameters, which will not be elaborated further here.
[0073] Step S104: Serialize the animation description data according to the preset data protocol to generate an animation target file as the loading file for the animation to be played.
[0074] The data protocol may include a data protocol that can effectively reduce the resource consumption of the animation target file in the application scenario of animation. For example, it can save storage space in the storage stage, or save transmission bandwidth and traffic in the transmission stage, or save memory space or even CPU resources required for playback in the playback stage. For example, in Android, the display system works at a frequency of 60 frames per second, which requires the animation playback scheme to have a processing capability of 60 frames per second, that is, each frame can only take 16 milliseconds to complete the animation drawing. If the drawing process exceeds 16 milliseconds, the animation will have a sense of stagnation. At this time, in order to obtain a silky smooth animation, it is necessary to reduce the requirements for memory and CPU consumption. At this point, the data protocol can be a data protocol defined according to the application scenario, or it can be a general data protocol, such as flatbuffers (an open-source, cross-platform, and efficient serialization protocol), protobuf (Protocol Buffers, an open-source, efficient, and fast serialization protocol), protostuff (an open-source serialization protocol developed based on protobuf, which does not require pre-compilation based on .proto files for serialization like protobuf), etc., which are protocols for serializing data into binary data.
[0075] After the animation target file is generated by serialization using the aforementioned data protocol, not only is the resource usage of the file saved, but it also facilitates animation application developers to develop applications for different platforms using the binary data stream animation target file. This supports cross-platform application development, and the playback end can deserialize it based on the IDL file, effectively reducing the system resource (such as memory and CPU resources) usage of deserialization. It can meet the 16-millisecond refresh requirement in animation playback, thereby improving playback performance. Furthermore, since binary data streams are used for transmission and processing, without a deserialization interface description file (i.e., IDL file), even if data packets are intercepted, deserialization cannot be performed, which helps protect animation copyright.
[0076] In one optional implementation, to effectively reduce the resource consumption (such as serialization time, deserialization time, memory consumption, CPU consumption, etc.) of animation playback in animation applications, the data protocol preferred when generating the animation target file from the animation description data is flatbuffers. The animation description data can then be serialized according to the flatbuffers IDL file (i.e., interface description file), specifically the IDL file defined for the animation description data, to produce a series of object data. This object data is then stored in a flat binary cache (i.e., a one-dimensional array) according to a data hierarchy structure, thus forming the animation target file. This approach ensures backward compatibility with data structure changes, effectively allocates and manages object data, and allows for direct reading of serialized data from memory during animation playback (i.e., deserialization). Loading the "parsed" data only requires loading the stored byte array into memory, eliminating the need to generate intermediate variables, thereby saving on deserialization resources such as time, memory, and CPU consumption.
[0077] For ease of understanding, here is an example of an IDL file (i.e., schema file, usually called a .fbs file) required by flatbuffers to serialize the aforementioned custom animation description data. Figure 5As shown in the IDL file, tables are used to define the aforementioned custom animation description data flatbuffers objects and the list of fields in the objects. The Venus object is used to specify the root of the serialized data. The root table is used to retrieve serialized data from the Venus object during deserialization. This Venus object forms a flattened binary cache (i.e., a one-dimensional array) stored according to a data hierarchy. Specifically, the Venus object includes fields such as ver (describing the version number, a string), count (describing the total number of frames, an integer), viewBox (describing the viewbox object), fps (describing the frame rate, an integer), and frames (describing the frames object). The ViewBox object further includes fields for width and height (float32 values). The Frames object includes fields for the animation element (a string) and sprites (describing the appearance parameters of the animation element in the time series, such as rotation, position, anchor points, etc.). The Sprites object contains several parameters, including scaling, layout, and y. The Sprites object has fields for index (frame number, a long integer), alpha (opacity, a float32 integer), and trans (trans object). The Trans object has fields for a (rotation parameter), b (anchor point parameter), c (position parameter), d (scaling parameter), tx (offset along the x-axis), and ty (offset along the y-axis). These appearance parameters are all float32 integers. The Layout object has fields for x (starting position, x-coordinate) and y (starting position, y-coordinate).
[0078] Therefore, during serialization, flatc (an IDL compiler) can be used to serialize the animation description data based on the .fbs file (the IDL file corresponding to flatbuffers), thereby generating a series of object data. At this time, the animation target file is composed of these binary object data that have been stored hierarchically.
[0079] It should be noted that those skilled in the art should understand that in animation application development, the corresponding Schema (architecture, i.e., .fbs file) of flatbuffers can be written according to the description format of the animation description data, which will not be listed here.
[0080] In one optional implementation, to effectively reduce the resource consumption (such as serialization / deserialization time, memory, CPU, etc.) of animation playback in animation applications, when generating the animation target file from the animation description data, the data protocol is preferably protobuf or protostuff. The serialization process of protobuf is similar to the aforementioned flatbuffers serialization process, requiring pre-compilation based on the protobuf IDL file (i.e., the .proto file) to achieve serialization. Protostuff does not require pre-compilation, i.e., it does not require a .proto file, and serialization is achieved during code execution. The serialization process of protobuf or protostuff will not be elaborated here.
[0081] Through the above steps S102 to S106, the animation source file, which requires a lot of resources in the animation application development process, is first parsed to generate animation description data, which can effectively reduce the resource consumption rate of the animation application development process and facilitate the modification of animation data by animation application developers. Then, the animation description data is serialized to generate animation target file, which not only further reduces the resource consumption of the animation application development process, but also does not require any dependent libraries. Access to the serialized data does not require packaging and unpacking, which facilitates cross-platform application development of the animation target file of the binary data stream by animation application developers. The animation to be played can be applied to multiple playback scenarios (such as web, Android system, and iOS system).
[0082] It should be noted that those skilled in the art should understand that, in specific implementations, the aforementioned steps S102-106 can be formed into an auxiliary tool for animation applications or an auxiliary tool (such as a plugin) in animation processing tools. That is, the data description format of the animation description data, the data protocol required for serialization, and the IDL file, etc., can be extended to form a plugin similar to Bodymovin in After Effects, so that animation application developers can use the extended plugin to quickly export the animation source file to generate the animation target file.
[0083] Example 2
[0084] The animation processing method provided in this specification embodiment is based on embodiment 1. It realizes animation support for speech by generating corresponding speech description data on the time series through speech parsing, that is, realizing speech animation, and the speech animation can support speech.
[0085] Specifically, such as Figure 6 As shown, the animation processing method further includes:
[0086] Step S202: Generate audio description data for the audio corresponding to the animation to be played according to the data description format.
[0087] The audio corresponding to the animation to be played is audio data that needs to be added (i.e., inserted) to the animation to enhance its effects (i.e., sound effects). In this case, the audio can be described as an object according to the data description format, thereby generating the corresponding string, i.e., the audio description data. This audio can originate from the local machine or from the server (e.g., a server), without specific limitations. Alternatively, the audio can be obtained using a corresponding API, which will not be elaborated further here.
[0088] It should be noted that when the animation to be played has already been synthesized with audio, the audio has become part of the animation source file. For example, in Flash animations with sound, the audio (such as streaming audio or event audio) is usually already a layer in the animation. In this case, when the animation source file is used to generate the animation description data, the audio is also used to generate the corresponding animation description data. Therefore, this situation will not be explained here.
[0089] In practice, since audio is time-series data, audio in different formats can be parsed according to the time series, and then a series of strings (i.e. audio description data) are generated on the time series according to the data description format, thus avoiding the need for different parsers to parse audio in different formats.
[0090] It should be noted that step S202 can be performed before step S102, after step S102, or simultaneously with step S102; no specific limitation is set here.
[0091] At this point, step S204 can be used, which involves merging the audio description data into the animation description data, so that the generated animation target file contains audio data.
[0092] By parsing audio in a time sequence to generate audio description data, different formats of audio inserted into the animation to be played can be uniformly described as audio description data, which facilitates animation application developers in developing applications for voice data in subsequent processing. Since audio is described as an object, it can be easily inserted into the animation to be played. In this way, animation application developers can still develop cross-platform applications for animations that support audio addition, i.e., the animation target file. Moreover, when playing voice animations, it is not necessary to use different audio players for different audio formats. Instead, the same audio player can be used to play the deserialized audio.
[0093] Example 3
[0094] The animation processing method provided in this specification is based on Embodiment 1. By establishing an index between animation elements and external triggering events, interactive animations, such as interactive animated games, can be realized, further expanding the application of animation and improving the user experience.
[0095] Specifically, the animation processing method further includes: establishing an index relationship based on preset trigger events, wherein the index relationship is a mapping relationship between the trigger events and the animation effects of the animation elements, so that users can interact with the animation through trigger events, and the animation can have different animation performances in different situations through interaction, making the interaction more interesting and allowing users to have fun in the interaction.
[0096] Among them, the triggering event may include the interactive command issued by the user obtained by the terminal, such as the user operation data obtained by the terminal through sensors (such as touch sensors, gravity sensors, acceleration sensors, etc.). For example, the operation data of the user clicking the screen can be obtained through the screen sensor, and the operation data of the user tilting the screen can be obtained through the gravity sensor. These will not be listed one by one here.
[0097] By establishing an index between triggering events and animated elements, the behavior of animated elements can be controlled by controlling the triggering events. For example, by combining hardware elements such as screen touch and gravity sensing, animated games, such as racing games, can be created. In this case, without using buttons, simply placing the phone flat and swaying it left and right can replace the left and right movement of the direction in the simulator game, further expanding the application of animation, allowing users to have fun in animated interactions, and improving the user experience.
[0098] It should be noted that when establishing an index relationship based on a preset trigger event, the trigger event can be used as a data item in a preset data description format, thereby generating animation description data containing the index when describing the animation source file. Alternatively, the index can be established in the animation description data after the animation description data is generated, thus forming animation description data containing the index.
[0099] Example 4
[0100] Based on the same idea, an animation processing device is provided in the embodiments of this specification.
[0101] It should be noted that, given that the animation processing method has been described in detail in the foregoing embodiments, the corresponding content related to the animation processing device will not be repeated in this embodiment.
[0102] like Figure 7 As shown, where the dashed boxes represent optional modules, the animation processing device 1 includes a generation module 11 and a serialization module 12. The generation module 11 generates animation description data from the animation source file according to a preset data description format. This animation description data describes the animation effects of the animation elements in the animation to be played. The serialization module 12 serializes the animation description data according to a preset data protocol to generate an animation target file, which serves as the loading file for the animation to be played during playback.
[0103] Optionally, the generation module 11 is used to generate the animation description data by taking the animation elements of each frame of the animation in the animation source file according to a time sequence based on a preset data description format.
[0104] Optionally, the generation module 11 is further configured to generate audio description data for the audio corresponding to the animation to be played according to the data description format, and merge the audio description data into the animation description data.
[0105] Optionally, the animation processing device 1 further includes an index module 13, which is used to establish an index relationship based on a preset trigger event. The index relationship is a mapping relationship between the trigger event and the animation effect of the animation element.
[0106] Optionally, the generation module 11 is used to parse the animation source file by layer according to a preset data description format to generate the animation description data.
[0107] Optionally, the animation processing device 1 further includes a compression module 14, which is used to determine whether the file size of the animation source file exceeds a preset file size threshold before calling the generation module 11, and if so, to compress the animation source file.
[0108] Based on the same idea, this specification provides an electronic device for animation processing corresponding to Embodiment 1. The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform the following steps:
[0109] Animation description data is generated from the animation source file according to a preset data description format. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0110] The animation description data is serialized according to a preset data protocol to generate an animation target file, which is then used as the loading file for the animation to be played.
[0111] Based on the same idea, this specification provides a non-volatile computer storage medium corresponding to Embodiment 1, storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0112] Animation description data is generated from the animation source file according to a preset data description format. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0113] The animation description data is serialized according to a preset data protocol to generate an animation target file, which is then used as the loading file for the animation to be played.
[0114] Example 5
[0115] Based on the same idea, the embodiments of this specification provide an animation processing method for processing the animation target file in any one of the aforementioned embodiments 1 to 3, generating animation drawing data by processing the animation target file, so as to draw the animation drawing data on the canvas to realize the playback of the animation to be played.
[0116] In specific implementation, from the perspective of equipment, the executing entity can be a terminal, which can be a server, computer, mobile phone, tablet computer, smartwatch, smart bracelet, or other device that facilitates animation application developers to generate animation drawing data from the animation target file of the animation to be played. This application does not make any specific limitations on this.
[0117] In addition, from a programming perspective, the animation processing method provided in the embodiments of this specification can be executed by a program installed on the terminal. This program can be a processing program for animation target files of animation files to be played by animation application developers. This processing program can be a standalone application or a plug-in program for other applications. The form of the program can be an application client or a web client, etc., without specific limitations here.
[0118] like Figure 8 As shown in the embodiments of this specification, an animation processing method includes the following steps:
[0119] Step S302: Load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0120] It should be noted that the animation target file in the embodiments of this specification is the animation target file in any of the foregoing embodiments 1 to 3. In this case, the animation target file can be stored locally or on a server (such as a server or the cloud), and no specific limitation is made here. Furthermore, when obtaining the animation target file, the corresponding API (Application Programming Interface) can be used according to the needs of animation application development, which will not be elaborated further here.
[0121] Step S304: Deserialize the animation target file to generate animation drawing data according to the data protocol.
[0122] The animation effects of each animation element are obtained from the animation target file through deserialization, and this data is used as the drawing data required for canvas drawing, that is, as the animation drawing data.
[0123] It should be noted that if the animation target file in this embodiment is the animation target file in the aforementioned embodiment 2, that is, the animation target file in this embodiment is the animation description data including the audio description data in embodiment 2 serialized according to a preset data protocol, then in step S304, the animation target file is deserialized according to the data protocol to generate animation drawing data. Thus, the animation drawing data also includes the audio data corresponding to the audio description data and the drawing parameters of the animation effect of the animation element. The audio data is used to realize sound playback in the audio player, and the drawing parameters are used to realize the animation effect of the animation element on the canvas. If the animation target file in this embodiment is the animation target file in the aforementioned embodiment 3, that is, the animation target file in this embodiment is the animation description data including the index in embodiment 3 serialized according to a preset data protocol, then the animation drawing data includes the acquisition parameters of the trigger event corresponding to the index and the drawing parameters of the animation effect of the animation element. The acquisition parameters are used to acquire the trigger signal that triggers the trigger event, and the drawing parameters are used to realize the animation effect of the animation element on the canvas.
[0124] Furthermore, to reduce the performance requirements (such as deserialization time, memory, and CPU) on the terminal playing the animation during deserialization, specifically, the animation target file is deserialized asynchronously according to the data protocol to generate animation drawing data. For example, the deserialization operation is performed on another terminal, so that the terminal playing the animation only needs to draw the animation based on the animation drawing data. Alternatively, the deserialization operation can be completed in advance, so that only the animation drawing data needs to be loaded when playing the animation.
[0125] Step 306: Draw the animation drawing data on a preset canvas to realize the playback of the animation to be played.
[0126] In specific implementation, the animation drawing data is some object data. In this case, the drawing mechanism of the application platform itself can be used. For example, in the Android platform, the drawing mechanism of the View class can be used. The animation playback can be implemented through Drawable (a common graphic object drawing method under the Android platform). That is, the animation drawing data is drawn on a preset canvas through Drawable to realize the playback of the animation to be played. This will not be explained in detail here.
[0127] Furthermore, when the animation drawing data is a bitmap object, a carousel method can also be used, that is, the animation is played by carouseling the bitmap object. This allows the animation to be extended to application scenarios of terminals that only support bitmap playback, further expanding the application scenarios of the animation and allowing users of different terminals to experience the animation. Specifically, drawing the animation drawing data on a preset canvas includes: carouseling the bitmap object on the preset canvas.
[0128] It should be noted that if the animation drawing data in this embodiment includes the audio data in the aforementioned step S304, then audio playback can be implemented using, for example, VideoView (a common video playback method under the Android platform) in the Android platform, or other audio playback methods can be used to play the audio data. No specific limitation is made here.
[0129] Through the steps S302-306 described above, the data corresponding to the animation effects of each animation element, i.e., the animation drawing data, can be easily and quickly obtained from the animation target file. Since animations of different formats are described, serialized, and deserialized, they are ultimately converted into the same format of animation drawing data. At this point, playing the animation only requires drawing (i.e., playing) the animation drawing data directly on the preset canvas (i.e., the player). There is no need to use multiple players in the application platform to play the animations of different formats. This solves the problem of animation application platforms supporting different formats, supports cross-platform application of animation, and effectively reduces the resource consumption of animation playback.
[0130] Furthermore, when the animation drawing data includes the index mentioned in step S304, the animation processing method further includes: acquiring a trigger signal, wherein the trigger signal is used to trigger a preset trigger event so as to index the animation description data according to the trigger event; the trigger signal includes a trigger signal generated when the user operates the terminal; the trigger signal generated when the user operates the terminal includes a trigger signal generated by a corresponding sensor when the user operates the terminal; the sensor may include several types of sensors in the terminal such as a screen sensor, gravity sensor, gyroscope sensor, and accelerometer sensor; then step S306, i.e., drawing the animation drawing data on a preset canvas, includes: drawing the animation drawing data on the canvas according to the trigger signal. In this way, by adding external factors, i.e., the index, an animation can have different performances in different situations, making the interaction more interesting; and by interacting with the user of the terminal, i.e., combining the trigger elements of the terminal's screen touch, gravity sensing, and other sensors, simple mini-games can be created.
[0131] Example 6
[0132] Based on the same idea, an animation processing device is provided in the embodiments of this specification.
[0133] It should be noted that, given that the animation processing method has been described in detail in the aforementioned Embodiment 5, the corresponding content related to the animation processing device will not be repeated in this embodiment.
[0134] like Figure 9 As shown, where the dashed boxes represent optional modules, the animation processing device 2 includes: a loading module 21, a deserialization module 22, and a drawing module 23. The loading module 21 loads the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data describes the animation effects of the animation elements in the animation to be played. The deserialization module 22 deserializes the animation file according to the data protocol to generate animation drawing data. The drawing module 23 draws the animation drawing data on a preset canvas to realize the playback of the animation to be played.
[0135] Optionally, the animation processing device 2 further includes an acquisition module 24, which is used to acquire a trigger signal, the trigger signal being used to trigger a preset trigger event so as to index the animation description data according to the trigger event; thus, the drawing module 23 is used to draw the animation drawing data on the canvas according to the trigger signal.
[0136] Further, optionally, the acquisition module 24 includes a sensor signal acquisition module, which acquires the signal generated by the sensor as the trigger signal.
[0137] Optionally, the deserialization module 22 is used to asynchronously deserialize the animation target file to generate animation drawing data according to the data protocol.
[0138] Optionally, when the animation drawing data is a bitmap object, the drawing module 23 is used to rotate the bitmap object on a preset canvas to realize the playback of the animation to be played.
[0139] Based on the same idea, this specification provides an electronic device for animation processing corresponding to Embodiment 5. The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform the following steps:
[0140] Load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0141] The animation target file is deserialized according to the data protocol to generate animation rendering data;
[0142] The animation drawing data is drawn on a preset canvas to enable the playback of the animation to be played.
[0143] Based on the same idea, this specification provides a non-volatile computer storage medium corresponding to Embodiment 5, storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0144] Load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. The animation description data is used to describe the animation effects of the animation elements in the animation to be played.
[0145] The animation target file is deserialized according to the data protocol to generate animation rendering data;
[0146] The animation drawing data is drawn on a preset canvas to enable the playback of the animation to be played.
[0147] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0148] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant details can be found in the descriptions of the method embodiments.
[0149] The apparatus, device, non-volatile computer storage medium and method provided in the embodiments of this specification are corresponding. Therefore, the apparatus, device and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, device and non-volatile computer storage medium will not be repeated here.
[0150] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0151] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0152] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0153] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0154] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0155] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0156] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0157] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0159] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0160] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0161] It should also be noted that 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 limitation, 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.
[0162] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0163] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0164] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An animation processing method, comprising: The method generates animation description data from the animation source file of the animation to be played according to a preset data description format. This includes parsing the animation elements of each frame of the animation source file according to a time sequence to generate the animation description data. The animation description data describes the animation effects of the animation elements in the animation to be played. The animation effects represent the changes of the animation elements in the animation to be played over time. Before generating the animation description data from the animation source file, the animation processing method further includes: determining whether the file size of the animation source file exceeds a preset file size threshold, and if so, compressing the animation source file. The preset data description format includes an animation description data format defined according to the animation application scenario. Audio description data is generated from the audio corresponding to the animation to be played according to the preset data description format. The audio description data is merged into the animation description data, and the animation description data indexes each animation element by its identifier, corresponding to its animation effect over time. According to a preset data protocol, the animation description data is serialized to generate an animation target file, which serves as the loading file for the animation to be played during playback. This includes using an interface description file compiler to parse the animation description data into binary data for the animation target file based on the interface description file. This allows the animation target file to be loaded and deserialized at the playback end to generate drawing data, which can then be drawn using the canvas at the playback end before the animation is played. The preset data protocol includes a data protocol that can reduce the resource consumption of the animation target file in the application scenario of the animation.
2. The animation processing method as described in claim 1, wherein generating animation description data from the animation source file of the animation to be played according to a preset data description format includes: According to the preset data description format, the animation elements of each frame of the animation source file are used to generate the animation description data in a time sequence.
3. The animation processing method as described in claim 1, further comprising: Based on the data description format, generate audio description data for the audio corresponding to the animation to be played. The audio description data is merged into the animation description data.
4. The animation processing method as described in claim 1, further comprising: An index relationship is established based on preset trigger events, wherein the index relationship is a mapping relationship between the trigger events and the animation effects of the animation elements.
5. The animation processing method as described in claim 1, wherein generating animation description data from the animation source file of the animation to be played according to a preset data description format includes: The animation source file is parsed layer by layer according to a preset data description format to generate the animation description data.
6. The animation processing method as described in claim 1, further comprising, before generating animation description data from the animation source file: Determine whether the file size of the animation source file exceeds a preset file size threshold; if so, compress the animation source file.
7. An animation processing method, comprising: The animation target file of the animation to be played is loaded. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. It includes an animation target file where the animation description data is parsed into binary data using an interface description file compiler based on an interface description file. This allows the animation target file to be loaded and deserialized at the playback end to generate drawing data, which can then be drawn using the canvas at the playback end for animation playback. The animation description data includes the animation elements of each frame of the animation source file of the animation to be played, parsed according to a preset data description format and generated in time sequence. The animation description data is used to describe the animation in the animation to be played. The animation effect represents the change of the animated element in the animation to be played over time. Before generating animation description data from the animation source file, the animation processing method further includes: determining whether the file size of the animation source file exceeds a preset file size threshold; if so, compressing the animation source file; the preset data description format includes an animation description data format defined according to the animation application scenario; generating audio description data from the audio corresponding to the animation to be played according to the preset data description format; merging the audio description data into the animation description data, wherein the animation description data indexes the animation element's identifier to determine the animation effect corresponding to each animation element in the time sequence. The animation target file is deserialized to generate animation rendering data according to the data protocol; the preset data protocol includes a data protocol that can reduce the resource consumption of the animation target file in the application scenario of the animation. The animation drawing data is drawn on a preset canvas to enable the playback of the animation to be played.
8. The animation processing method as described in claim 7, further comprising: Acquire a trigger signal, which is used to trigger a preset trigger event so as to index the animation description data according to the trigger event; Drawing the animation drawing data on a preset canvas includes: drawing the animation drawing data on the canvas according to the trigger signal.
9. The animation processing method as described in claim 8, wherein the trigger signal includes a signal generated by a sensor.
10. The animation processing method as described in claim 7, wherein deserializing the animation target file to generate animation rendering data according to the data protocol comprises: The animation target file is asynchronously deserialized according to the data protocol to generate animation drawing data.
11. The animation processing method as described in claim 7, wherein the animation drawing data is a bitmap object; Drawing the animation drawing data on a preset canvas includes: The bitmap objects are rotated on a preset canvas.
12. An animation processing apparatus, comprising a generation module and a serialization module; The generation module is used to generate animation description data from the animation source file of the animation to be played according to a preset data description format. This includes parsing the animation elements of each frame in the animation source file of the animation to be played according to a time sequence to generate the animation description data. The animation description data is used to describe the animation effects of the animation elements in the animation to be played. The animation effects represent the changes of the animation elements in the animation to be played over time. Before generating animation description data from the animation source file, the generation module is further configured to: determine whether the file size of the animation source file exceeds a preset file size threshold, and if so, compress the animation source file; the preset data description format includes an animation description data format defined according to the animation application scenario; and generate audio description data from the audio corresponding to the animation to be played according to the preset data description format. The audio description data is merged into the animation description data, and the animation description data indexes each animation element by its identifier to correspond to its animation effect in the time series; The serialization module is used to serialize the animation description data according to a preset data protocol to generate an animation target file as the loading file for the animation to be played. This includes using an interface description file compiler to parse the animation description data into binary data for the animation target file according to the interface description file. This allows the animation target file to be loaded and deserialized at the playback end to generate drawing data, which can then be drawn using the canvas at the playback end before the animation is played. The preset data protocol includes a data protocol that can reduce the resource consumption of the animation target file in the application scenario of the animation.
13. The animation processing apparatus as described in claim 12, wherein the generation module is used to generate the animation description data by generating the animation elements of each frame of the animation source file in a time sequence according to a preset data description format.
14. The animation processing apparatus of claim 12, wherein the generation module is further configured to generate audio description data for the audio corresponding to the animation to be played according to the data description format, and to merge the audio description data into the animation description data.
15. The animation processing apparatus of claim 12, further comprising an index module, the index module being configured to establish an index relationship based on a preset trigger event, the index relationship being a mapping relationship between the trigger event and the animation effect of the animation element.
16. The animation processing apparatus as described in claim 12, wherein the generation module is used to parse the animation source file by layer and generate the animation description data according to a preset data description format.
17. The animation processing apparatus of claim 12, further comprising a compression module, wherein the compression module is configured to determine, before calling the generation module, whether the file size of the animation source file exceeds a preset file size threshold, and if so, compress the animation source file.
18. An animation processing apparatus, comprising a loading module, a deserialization module, and a drawing module; The loading module is used to load the animation target file of the animation to be played. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. It includes an animation target file where the animation description data is parsed into binary data using an interface description file compiler based on an interface description file. This allows the animation target file to be loaded and deserialized at the playback end to generate drawing data, which can then be drawn using the canvas at the playback end for animation playback. The animation description data includes the animation elements of each frame in the animation source file of the animation to be played, parsed according to a preset data description format and generated in a time sequence. The animation description data describes the animation effects of the animation elements in the animation to be played; the animation effects represent the changes of the animation elements in the animation to be played over time. Before generating animation description data from the animation source file, the loading module is further configured to: determine whether the file size of the animation source file exceeds a preset file size threshold, and if so, compress the animation source file; the preset data description format includes an animation description data format defined according to the animation application scenario; and generate audio description data from the audio corresponding to the animation to be played according to the preset data description format. The audio description data is merged into the animation description data, and the animation description data indexes each animation element by its identifier to correspond to its animation effect in the time series; The deserialization module is used to deserialize the animation target file according to the data protocol to generate animation rendering data; the preset data protocol includes a data protocol that can reduce the resource consumption of the animation target file in the application scenario of the animation. The drawing module is used to draw the animation drawing data on a preset canvas to realize the playback of the animation to be played.
19. The animation processing apparatus of claim 18, further comprising an acquisition module, the acquisition module being configured to acquire a trigger signal, the trigger signal being configured to trigger a preset trigger event so as to index the animation description data according to the trigger event; The drawing module is used to draw the animation drawing data on the canvas according to the trigger signal.
20. The animation processing apparatus of claim 19, wherein the acquisition module includes a sensor signal acquisition module, the sensor signal acquisition module being used to acquire a signal generated by a sensor as the trigger signal.
21. The animation processing apparatus of claim 18, wherein the deserialization module is configured to asynchronously deserialize the animation target file to generate animation drawing data according to the data protocol.
22. The animation processing apparatus as described in claim 18, wherein the animation drawing data is a bitmap object; the drawing module is used to rotate the bitmap object on a preset canvas.
23. An electronic device for processing animation, comprising: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: The process involves generating animation description data from the animation source file of the animation to be played according to a preset data description format. This includes parsing the animation elements of each frame in the animation source file of the animation to be played according to a time sequence to generate the animation description data. The animation description data describes the animation effects of the animation elements in the animation to be played. The animation effects represent the changes of the animation elements in the animation to be played over time. Before generating the animation description data from the animation source file, it is determined whether the file size of the animation source file exceeds a preset file size threshold. If so, the animation source file is compressed. The preset data description format includes an animation description data format defined according to the animation application scenario. Audio description data is generated from the audio corresponding to the animation to be played according to the preset data description format. The audio description data is then merged into the animation description data, where the animation description data indexes each animation element by its identifier, corresponding to its animation effect over time. According to a preset data protocol, the animation description data is serialized to generate an animation target file, which serves as the loading file for the animation to be played during playback. This includes using an interface description file compiler to parse the animation description data into binary data for the animation target file based on the interface description file. This allows the animation target file to be loaded and deserialized at the playback end to generate drawing data, which can then be drawn using the canvas at the playback end before the animation is played. The preset data protocol includes a data protocol that can reduce the resource consumption of the animation target file in the application scenario of the animation.
24. An electronic device for processing animation, comprising: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: The animation target file of the animation to be played is loaded. The animation target file is a data file generated by serializing the animation description data of the animation to be played according to a preset data protocol. It includes an animation target file where the animation description data is parsed into binary data using an interface description file compiler. This allows the animation target file to be loaded and deserialized at the playback end to generate drawing data, which can then be drawn using the canvas at the playback end for animation playback. The animation description data includes the animation elements of each frame in the animation source file of the animation to be played, parsed according to a preset data description format and generated in time sequence. The animation description data is used to describe the animation to be played. The animation effects of animated elements in the animation are displayed; the animation effects represent the changes of animated elements in the animation to be played over time; wherein, before generating animation description data from the animation source file, it is determined whether the file size of the animation source file exceeds a preset file size threshold, and if so, the animation source file is compressed; the preset data description format includes an animation description data format defined according to the animation application scenario; audio description data is generated from the audio corresponding to the animation to be played according to the preset data description format; the audio description data is merged into the animation description data, and the animation description data indexes each animated element with its corresponding animation effect over time using the identifier of the animated element; The animation target file is deserialized to generate animation rendering data according to the data protocol; the preset data protocol includes a data protocol that can reduce the resource consumption of the animation target file in the application scenario of the animation. The animation drawing data is drawn on a preset canvas to enable the playback of the animation to be played.
Citation Information
Patent Citations
Theme generation method, apparatus and device
CN106097417A
Serialization method and apparatus, deserialization method and apparatus, serialization and deserialization system, and electronic device
CN106570018A
Animation processing method and device
CN106611435A
