Animation generation method, device and storage medium
By obtaining and setting configurable parameters in the animation template file, the target animation file is generated, which solves the problem of low animation generation efficiency in the existing technology, realizes rapid modification and generation of animation, and reduces the workload of designers and developers. Improved animation generation efficiency and dynamics of Lottie animation.
Patent Information
- Application Number
- CN201910678754.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2039-07-25
AI Technical Summary
Existing animation generation technology does not support dynamic configuration of codes, resulting in designers needing to design complete animation resources for each country's flag, resulting in low generation efficiency. Especially when multiple countries' flag animations need to be generated, designers need to design multiple animations. Set animation resources, resulting in low efficiency.
By obtaining the animation template file, obtain the configurable animation parameters based on the animation element setting interface, set the configurable animation element parameters in the animation template file, generate the target animation file, and generate the target animation according to the target animation file, realizing rapid modification and generation of animations .
It improves the efficiency of animation generation. You only need to modify some parameters in the animation template file to generate the target animation, which reduces the workload of designers and developers, reduces the number of animation designs that are generally similar but have different elements, and saves money. Storage space and improved dynamics of Lottie animations.
Smart Images

Figure CN112308947B
Abstract
Description
Technical Field
[0001] The present application relates to the field of animation processing technology, and in particular to an animation generation method, device and storage medium. Background Art
[0002] In order to realize animation effects in terminal applications (Application, APP), animation generation technology can be applied, such as applying Lottie animation generation technology to apply Lottie animation in APP, but the existing animation generation technology does not support dynamic configuration of code, and the resources are determined when the designer outputs the animation resource draft.
[0003] For example, when using existing animation generation technology to realize an animation of a country's national flag fluttering in the wind, the designed animation effect is fixed. In some business scenarios, only the national flag in the animation needs to be changed, but at this time, the designer is still required to design a complete set of animation resources corresponding to the national flag based on the business scenario. If the national flags of multiple countries need to be generated separately, then the designer is required to design multiple sets of animation resources separately, resulting in low animation generation efficiency. Summary of the invention
[0004] The embodiments of the present application provide a method, device and storage medium for generating an animation, which can improve the efficiency of generating an animation.
[0005] The present application provides a method for generating an animation, including:
[0006] Obtain an animation template file, wherein the animation template file includes animation parameters corresponding to configurable animation elements;
[0007] Acquire configuration animation parameters for the configurable animation element based on an animation element setting interface;
[0008] According to the configured animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file;
[0009] Generate a target animation according to the target animation file.
[0010] Accordingly, the embodiment of the present application further provides an animation generation device, including:
[0011] A first acquisition unit, configured to acquire an animation template file, wherein the animation template file includes animation parameters corresponding to configurable animation elements;
[0012] A second acquisition unit, configured to acquire configuration animation parameters for the configurable animation element based on an animation element setting interface;
[0013] A setting unit, configured to set the animation parameters corresponding to the configurable animation elements in the animation template file according to the configured animation parameters, to obtain a target animation file;
[0014] A generating unit is used to generate a target animation according to the target animation file.
[0015] In some embodiments, the generating unit is specifically used for:
[0016] When the target animation file meets the preset animation rule, the target animation file is compiled and processed by compiling and executing to obtain a first compiled file;
[0017] The first compiled file is rendered to obtain the target animation.
[0018] In some embodiments, the generating unit is further specifically configured to:
[0019] When the target animation file does not conform to the preset animation rule, compiling the target animation file in an interpreted execution manner to obtain a second compiled file;
[0020] The second compiled file is rendered to obtain the target animation.
[0021] In some embodiments, the setting unit includes:
[0022] An adding subunit, used for adding the configured animation parameter to the position corresponding to the configurable animation element in the animation template file to obtain the target animation file when the animation parameter corresponding to the configurable animation element is zero;
[0023] The replacement subunit is used to replace the animation parameters corresponding to the configurable animation elements in the animation template file with the configured animation parameters when the animation parameters corresponding to the configurable animation elements are not zero, so as to obtain the target animation file.
[0024] In some embodiments, the second acquiring unit includes:
[0025] A first receiving subunit, configured to receive a configuration animation instruction corresponding to the configurable animation element;
[0026] An activation subunit, used to activate the animation element setting interface in the resource extension library according to the configuration animation instruction;
[0027] The acquisition subunit is used to acquire the configuration animation parameters based on the animation element setting interface.
[0028] In some embodiments, the first acquisition subunit is specifically used for:
[0029] Receiving the configuration animation parameters set by the developer through the animation element setting interface; or,
[0030] The configuration animation parameters are obtained from a database through the animation element setting interface.
[0031] In some embodiments, the animation configuration instruction includes a configurable animation element identifier, and the first acquisition subunit is further specifically configured to:
[0032] According to the configurable animation element identifier, downloading the configuration animation parameter corresponding to the configurable animation element identifier from a server database through the animation element setting interface; or,
[0033] According to the configurable animation element identifier, the configuration animation parameter corresponding to the configurable animation element identifier is acquired from a local database through the animation element setting interface.
[0034] In some embodiments, the second acquiring unit is specifically configured to:
[0035] Receive a configuration animation instruction corresponding to the configurable animation sub-element;
[0036] Acquiring the configuration animation parameters according to the configuration animation instruction based on the animation element setting interface;
[0037] At this time, the setting unit is specifically used for:
[0038] According to the configured animation parameters, the animation parameters corresponding to the configurable animation sub-elements in the animation template file are set to obtain the target animation file.
[0039] In some embodiments, the first acquiring unit includes:
[0040] A second receiving subunit, used for receiving a template selection instruction;
[0041] The selection subunit is used to select the animation template file from a plurality of preset candidate animation templates according to the template selection instruction.
[0042] An embodiment of the present application further provides a storage medium, wherein the storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute the steps in any one of the animation generation methods provided in the embodiment of the present application.
[0043] The embodiment of the present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the steps in any one of the animation generation methods provided in the embodiment of the present application.
[0044] In the embodiment of the present application, the animation generation device obtains an animation template file, the animation template file includes animation parameters corresponding to configurable animation elements; and obtains configuration animation parameters for the configurable animation elements based on the animation element setting interface; then, according to the configuration animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file; finally, a target animation is generated according to the target animation file. This solution only needs to modify some parameters in the animation template file to obtain the target animation, which can improve the generation efficiency of the animation. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 This is a schematic diagram of an application scenario of the animation generation method provided in an embodiment of the present application;
[0047] Figure 2 It is a flowchart of the method for generating an animation provided in an embodiment of the present application;
[0048] Figure 3 is another flowchart of the method for generating an animation provided in an embodiment of the present application;
[0049] Figure 4 It is a structural schematic diagram of an animation generation device provided in an embodiment of the present application;
[0050] Figure 5 is another structural schematic diagram of the animation generation device provided in an embodiment of the present application;
[0051] Figure 6 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0053] The embodiments of the present application provide an animation generation method, device and storage medium. The animation generation device can be integrated in a network device, and the network device can be a terminal or other device, wherein the terminal can include a mobile phone, a tablet computer, a laptop computer, and a personal computer (PC) and other devices.
[0054] The animation generation method provided in the embodiment of the present application can be used to generate a target animation. For example, a target animation of the same series as the animation template file can be generated through the embodiment of the present application.
[0055] In some embodiments, the animation generation device includes a resource extension library, a resource dynamic interpreter, and an animation instant renderer, wherein the resource extension library provides an animation element setting interface for obtaining configuration animation parameters. The resource dynamic interpreter reads the animation template file from a server or a local database of the animation generation device, obtains the configuration animation parameters from the resource extension library, and sets the animation parameters corresponding to the configurable animation elements in the animation template file according to the configuration animation parameters to obtain a target animation file, and finally renders the target animation file through the animation instant renderer to obtain a target animation.
[0056] In some embodiments, see Figure 1 , Figure 1 An application scenario embodiment is provided for the embodiments of the present application. In this embodiment, the animation corresponding to the animation template file is designed by a designer, wherein the animation template file includes configurable animation elements and non-configurable animation elements. Then, the animation template file is generated by AE software (After Effects). The developer can directly set the configuration animation parameters corresponding to the configurable animation elements that need to be set in the animation template file in the resource extension library through the animation element setting interface provided by the resource extension library in the application. Then, the animation generation device connects the animation template file and the configuration animation parameters in the resource extension library through a resource dynamic interpreter, and sets the animation parameters corresponding to the configurable animation elements in the animation template file according to the configuration animation parameters to obtain the target animation file. Finally, the target animation file is rendered according to the animation real-time renderer to obtain the target animation.
[0057] It should be noted that the serial numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0058] In the embodiment of the present application, the description will be made from the perspective of an animation generation device. In one embodiment, a method for generating an animation is provided. The method can be executed by a processor of the animation generation device, such as Figure 2 As shown, the specific process of the animation generation method can be as follows:
[0059] 201. Obtain an animation template file, where the animation template file includes animation parameters corresponding to configurable animation elements.
[0060] It should be noted that, in addition to the animation parameters corresponding to the configurable animation elements, the animation template file also includes animation parameters corresponding to the non-configurable animation elements, wherein the configurable animation elements are the items that can be modified in the animation template file, and the non-configurable animation elements are the items that cannot be modified in the animation template file.
[0061] In some embodiments, the animation parameter corresponding to the configurable animation element may be zero or non-zero; when it is zero, it may indicate that the position corresponding to the configurable animation element is left blank; when it is non-zero, it may indicate that the animation parameter of the position corresponding to the configurable animation element is an animation parameter that can be modified.
[0062] In some embodiments, obtaining the animation template file specifically includes: receiving a template selection instruction; and then selecting the animation template file from a plurality of preset candidate animation templates according to the template selection instruction.
[0063] For example, when a user needs to select an animation template file, a template selection interface in the animation generation device will be called up, on which multiple alternative animation templates are provided. The user then selects the required animation template file on the template selection interface, and the animation generation device generates a corresponding template selection instruction and determines the animation template file selected by the user based on the template selection instruction.
[0064] In some embodiments, the animation generating device may also receive a template preview instruction from a user, and display a corresponding animation to the user according to the template preview instruction.
[0065] The animation template file in this embodiment can be obtained from a local database of the animation generation device, or downloaded from a server, and the details are not limited here. The animation corresponding to the animation template file is designed by a designer, and the animation template file is generated by After Effects, wherein the animation template file can be a JSON file, and the animation can be a Lottie animation.
[0066] 202. Obtain configuration animation parameters for the configurable animation element based on the animation element setting interface.
[0067] In some embodiments, the animation element setting interface is provided by a resource dynamic interpreter, and the developer can set the configuration animation parameters of the corresponding animation through the animation element setting interface. The resource extension library receives the configuration animation parameters set by the developer, such as pictures, text, and parameter values of some animation processes. In addition, the developer can also dynamically change the animation process through the animation element setting interface, for example, inserting an Android native animation when a certain special effect appears.
[0068] Among them, before the developer sets the configuration animation parameters of the corresponding animation through the animation element setting interface, it is first necessary to obtain the configurable animation element identification (Identity document, ID) of the configurable animation element in the corresponding animation template file from the designer, and then transmit the ID to the application. Finally, the developer sets the configuration animation parameters of the corresponding animation through the animation element setting interface in the application.
[0069] At this time, in some embodiments, obtaining the configuration animation parameters for the configurable animation element based on the animation element setting interface may include:
[0070] Receive the configuration animation instruction corresponding to the configurable animation element; then activate the animation element setting interface in the resource extension library according to the configuration animation instruction; and then obtain the configuration animation parameters based on the animation element setting interface. The configuration animation instruction is generated by the animation generation device according to the actual animation generation requirements of the user.
[0071] In some embodiments, the configuration animation parameters are obtained based on the animation element setting interface, including: receiving the configuration animation parameters set by the developer through the animation element setting interface, at which time the configuration animation parameters set by the developer can be directly obtained; or, obtaining the configuration animation parameters from a database through the animation element setting interface.
[0072] Among them, the configuration animation instruction includes a configurable animation element identifier. At this time, obtaining the configuration animation parameters from the database through the animation element setting interface includes: according to the configurable animation element identifier, downloading the configuration animation parameters corresponding to the configurable animation element identifier from the server database through the animation element setting interface; or, according to the configurable animation element identifier, obtaining the configuration animation parameters corresponding to the configurable animation element identifier from the local database through the animation element setting interface, wherein the local database is a database corresponding to the animation generation device.
[0073] Among them, the animation element setting interface in the embodiment of the present application can be activated all the time, or it can be activated only after receiving the configuration animation instruction, which is not limited here.
[0074] In some embodiments, after the animation generating device obtains the required configuration animation parameters, it will first save them in the resource extension library, wherein the configuration animation parameters in the resource extension library are the ongoing configuration animation parameters.
[0075] Specifically, in some embodiments, the configuration animation instruction includes a configurable animation element ID, and then obtains the configuration animation parameters corresponding to the ID from the database of the server or the animation generation device, wherein, when there are multiple configuration animation parameters corresponding to the ID, it is also necessary to obtain the user's parameter selection instruction, and select the required configuration animation parameters from the multiple parameters according to the user's parameter selection instruction.
[0076] Among them, a configurable animation element may include multiple configurable animation sub-elements, that is, an animation template file may include multiple configurable animation sub-elements. At this time, when it is necessary to set one of the configurable animation sub-elements, the configuration animation parameters for the configurable animation element based on the animation element setting interface include: receiving a configuration animation instruction corresponding to the configurable animation sub-element; then obtaining the configuration animation parameters according to the configuration animation instruction based on the animation element setting interface, wherein the configuration animation instruction includes the ID corresponding to the configurable animation sub-element that needs to be reset, and then obtaining the configuration animation parameters corresponding to the configurable animation sub-element from the database according to the ID.
[0077] The configuration animation parameter may be an animation parameter corresponding to a Lottie element.
[0078] 203. According to the configured animation parameters, animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file.
[0079] In this embodiment, the resource dynamic interpreter in the animation generation device links the acquired animation template file and the configured animation parameters in the resource dynamic interpreter, and sets the animation parameters corresponding to the configurable animation elements in the animation template file according to the configured animation parameters in the resource dynamic interpreter.
[0080] In some embodiments, according to the configured animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file, specifically including:
[0081] When the animation parameter corresponding to the configurable animation element is zero, the configured animation parameter is added to the position corresponding to the configurable animation element in the animation template file to obtain the target animation file; for example, when the parameter position corresponding to the configurable animation element is left blank, the configured animation parameter selected by the user is added to the position corresponding to the configurable animation element in the animation template file.
[0082] When the animation parameter corresponding to the configurable animation element is not zero, the animation parameter corresponding to the configurable animation element in the animation template file is replaced with the configured animation parameter to obtain the target animation file. For example, when the animation parameter corresponding to the configurable animation element is a modifiable animation parameter, the animation parameter corresponding to the configurable animation element in the animation template file is replaced with the configured animation parameter.
[0083] At this time, the target animation file includes animation parameters corresponding to the non-configurable animation elements and configuration animation parameters.
[0084] 204. Generate a target animation according to the target animation file.
[0085] In some embodiments, the target animation file may be rendered by an animation real-time renderer in an animation generation device to generate a target animation.
[0086] In some embodiments, before rendering the target animation, the target animation file needs to be compiled in the resource dynamic interpreter, and then the compiled target animation file is rendered by the animation real-time renderer to generate the target animation.
[0087] In some embodiments, generating a target animation according to the target animation file includes:
[0088] When the target animation file meets the preset animation rules, the target animation file is compiled and processed by compiling and executing to obtain a first compiled file; the first compiled file is rendered to obtain the target animation. For example, when the animation corresponding to the target animation file is a hotspot animation, and the animation effect has been stabilized in the animation generation device, it means that the target animation file meets the preset animation rules; specifically, when the number of executions of the target animation file in the animation generation device exceeds a threshold, it means that the animation corresponding to the target animation file is a hotspot animation, wherein the threshold can be 3 times or other times, which is not limited here; when the animation parameters corresponding to the configurable animation elements in the target animation file have not changed compared to the previous run, it means that the animation corresponding to the target animation file has stabilized the animation effect in the animation generation device.
[0089] When the target animation file does not conform to the preset animation rules, the target animation file is compiled by interpreting and executing to obtain a second compiled file; the second compiled file is rendered to obtain the target animation. For example, when the animation corresponding to the target animation file is not a hotspot animation, or is not a stable animation effect in the animation generation device, it means that the target animation file does not conform to the preset animation rules.
[0090] In this embodiment, the target animation file is compiled and processed by a compile execution method, and the compilation speed is relatively fast. The target animation file is compiled and processed by an interpret execution method, and the compilation accuracy is relatively high.
[0091] In some embodiments, when hardware acceleration exists in the animation generation device, hardware acceleration can also be enabled to perform accelerated rendering to improve the animation display effect.
[0092] In the embodiment of the present application, the animation generation device obtains an animation template file, which includes animation parameters corresponding to configurable animation elements; and obtains configuration animation parameters for the configurable animation elements based on the animation element setting interface; then, according to the configuration animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file; finally, a target animation is generated according to the target animation file. This solution only needs to modify some parameters in the animation template file to obtain the target animation, which can improve the animation generation efficiency, reduce the workload of designers and developers, and reduce some animation designs that are generally similar but only have certain elements that are different.
[0093] In addition, when an animation generation device needs to generate multiple animations of the same series (i.e., generate multiple animations that share the same animation file template but have only some different elements), its memory only needs to store one animation file template and the configuration animation parameters that need to be modified corresponding to different animations, which can reduce the package size and save storage space. The package size has a great impact on the user conversion rate of mobile applications, so reducing the package size can improve the market competitiveness of mobile applications.
[0094] In addition, when the animation is a Lottie animation, the dynamics of the Lottie animation can be improved. For a fixed animation, the elements and the animation process can be changed through code to expand the polymorphism of the animation.
[0095] According to the method described in the previous embodiment, the following will give an example to further illustrate.
[0096] In this embodiment, the slave terminal is used as the execution subject and the target animation is Lottie animation. Figure 3 Another method for generating an animation provided by this application has the following specific process:
[0097] 301. The terminal obtains a Lottie animation template file, where the Lottie animation template file includes animation parameters corresponding to configurable Lottie animation elements.
[0098] In this embodiment, the Lottie animation template file includes not only animation parameters corresponding to configurable Lottie animation elements, but also animation parameters corresponding to non-configurable Lottie animation elements.
[0099] Among them, the animation parameter corresponding to the configurable Lottie animation element can be zero or non-zero; when it is zero, it can indicate that the position corresponding to the configurable Lottie animation element is left blank, and when it is non-zero, it can indicate that the animation parameter of the position corresponding to the configurable Lottie animation element is an animation parameter that can be modified.
[0100] In some embodiments, the terminal receives a template selection instruction, and then selects a required Lottie animation template file from a plurality of preset candidate Lottie animation templates through the template selection instruction.
[0101] In some embodiments, the Lottie animation template file can be obtained from a local database of the terminal or downloaded from a server, which is not limited here. The animation corresponding to the Lottie animation template file is designed by a designer, and the Lottie animation template file is generated by After Effects, wherein the Lottie animation template file is a JSON file.
[0102] 302. The terminal obtains configuration animation parameters corresponding to the configurable Lottie animation element based on the animation element setting interface.
[0103] In this embodiment, the resource extension library of the terminal provides an animation element setting interface, and the terminal can obtain the configuration animation parameters corresponding to the configurable Lottie animation element through this interface.
[0104] Specifically, in some embodiments, the developer can set the configuration animation parameters of the corresponding Lottie animation through the animation element setting interface, and the resource extension library can receive and save the configuration animation parameters set by the developer, wherein the configuration animation parameters in the resource extension library are the animation parameters to be configured in progress.
[0105] The developer may set the configuration animation parameters of the corresponding Lottie animation through the animation element setting interface, which may specifically include:
[0106] The developer obtains the configurable animation element ID corresponding to the configurable Lottie animation element in the Lottie animation template, and then the developer sets the configuration animation parameters of the corresponding Lottie animation according to the configurable animation element ID.
[0107] After the designer has set the animation configuration parameters, the animation configuration parameters may be uploaded to a related server for storage, or may be stored in a local database in the animation generation device.
[0108] At this time, in some embodiments, obtaining the configuration animation parameters corresponding to the configurable Lottie animation element based on the animation element setting interface may include:
[0109] Receive the configuration animation instruction corresponding to the configurable Lottie animation element; then activate the animation element setting interface in the resource extension library according to the configuration animation instruction; receive the configuration animation parameters set by the developer through the animation element setting interface, and at this time, directly obtain the configuration animation parameters set by the developer, wherein the configuration animation instruction is generated by the animation generation device according to the user's actual animation generation requirements.
[0110] In some other embodiments, obtaining the configuration animation parameters corresponding to the configurable Lottie animation element based on the animation element setting interface includes:
[0111] Receive a configuration animation instruction corresponding to the configurable Lottie animation element; activate an animation element setting interface in a resource extension library according to the configuration animation instruction; obtain the configuration animation parameters from a database through the animation element setting interface, wherein the database may be a local database of the terminal or a database in a server. If it is a server in a server, the terminal also needs to download the configuration animation parameters from the server and receive the configuration animation parameters through the animation element setting interface.
[0112] Among them, the animation element setting interface in the embodiment of the present application can be activated all the time, or it can be activated only after receiving the configuration animation instruction, which is not limited here.
[0113] 303. The terminal determines whether the animation parameter corresponding to the configurable Lottie animation element is zero. If it is zero, step 304 is executed; if it is not zero, step 305 is executed.
[0114] Before setting the animation parameters corresponding to the configurable Lottie animation elements in the Lottie animation template file, it is first necessary to determine whether the animation parameters corresponding to the configurable Lottie animation elements are zero, so as to determine the setting method of the configurable animation parameters in the Lottie animation template file.
[0115] 304. The terminal adds the configuration animation parameter to the position corresponding to the configurable Lottie animation element in the Lottie animation template file to obtain the target Lottie animation file.
[0116] When the animation parameter corresponding to the configurable Lottie animation element is zero, it means that the position corresponding to the configurable Lottie animation element is left blank. At this time, the terminal can add or fill the configuration animation parameter into the position corresponding to the configurable Lottie animation element in the Lottie animation template file through the resource dynamic interpreter to obtain the target Lottie animation file.
[0117] 305. The terminal replaces the animation parameters corresponding to the configurable Lottie animation elements in the Lottie animation template file with the configured animation parameters to obtain the target Lottie animation file.
[0118] When the animation parameters corresponding to the configurable Lottie animation elements are not zero, it means that the parameters corresponding to the configurable Lottie animation elements are animation parameters that can be modified. At this time, the terminal can directly replace the animation parameters corresponding to the configurable Lottie animation elements in the Lottie animation template file with the configured animation parameters through the resource dynamic interpreter to obtain the target Lottie animation file.
[0119] 306. The terminal determines whether the target Lottie animation file complies with a preset animation rule. If so, steps 307-308 are executed; if not, steps 309-310 are executed.
[0120] When the terminal sets the animation parameters corresponding to the configurable Lottie animation elements in the Lottie animation template file through the resource dynamic interpreter and obtains the target Lottie animation file, it will determine whether the target Lottie animation file complies with the preset animation rules.
[0121] Specifically, when the animation corresponding to the target Lottie animation file is a hotspot animation and the animation effect has been stabilized in the animation generation device, it means that the target Lottie animation file complies with the preset animation rules; when the animation corresponding to the target Lottie animation file is not a hotspot animation, or it is not a stable animation effect in the animation generation device, it means that the target Lottie animation file does not comply with the preset animation rules.
[0122] 307. The terminal compiles the target Lottie animation file in a compile and execute manner to obtain a first compiled file.
[0123] When the target Lottie animation file meets the preset animation rules, in order to improve the compilation speed, the terminal can compile and process the target Lottie animation file through the resource dynamic interpreter in a compilation and execution manner to obtain a first compiled file, wherein the first compiled file can be in the form of a Json data stream.
[0124] 308. The terminal renders the first compiled file to obtain the target Lottie animation.
[0125] When the first compiled file is obtained through the compiling process, at this time, the terminal can render the first compiled file through the animation real-time renderer to obtain the target Lottie animation, and display the target Lottie animation in the terminal.
[0126] 309. The terminal compiles the target Lottie animation file in an interpreted execution manner to obtain a second compiled file.
[0127] When the target Lottie animation file does not conform to the preset animation rules, in order to improve the accuracy of compilation, the terminal can compile and process the target Lottie animation file through the resource dynamic interpreter in an interpreted execution manner to obtain a second compiled file, wherein the first compiled file can be in the form of a Json data stream.
[0128] 310. The terminal renders the second compiled file to obtain a Lottie target animation.
[0129] When the second compiled file is obtained through the compiling process, at this time, the terminal can render the second compiled file through the animation real-time renderer to obtain the target Lottie animation, and display the target Lottie animation in the terminal.
[0130] In the embodiment of the present application, the terminal obtains an animation template file, which includes animation parameters corresponding to configurable animation elements; and obtains configuration animation parameters for the configurable animation elements based on the animation element setting interface; then, according to the configuration animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file; finally, a target animation is generated according to the target animation file. This solution only needs to modify some parameters in the animation template file to obtain the target animation, which can improve the animation generation efficiency, reduce the workload of designers and developers, and reduce some animation designs that are generally similar but only have certain elements that are different.
[0131] In addition, when a terminal needs to generate multiple animations of the same series, its memory only needs to save one animation file template and the configuration animation parameters that need to be modified corresponding to different animations, which can reduce the package size and save the terminal's storage space.
[0132] In order to better implement the above method, accordingly, the embodiment of the present application also provides an information sending device, which can be integrated in a network device, and the network device can be a server or other device.
[0133] For example, Figure 4 As shown, the animation generation device may include a first acquisition unit 401, a second acquisition unit 402, a setting unit 403 and a generation unit 404, as follows:
[0134] A first acquisition unit 401 is used to acquire an animation template file, where the animation template file includes animation parameters corresponding to configurable animation elements;
[0135] A second acquisition unit 402 is used to acquire configuration animation parameters for the configurable animation element based on an animation element setting interface;
[0136] A setting unit 403, configured to set the animation parameters corresponding to the configurable animation elements in the animation template file according to the configured animation parameters, to obtain a target animation file;
[0137] The generating unit 404 is configured to generate a target animation according to the target animation file.
[0138] In some embodiments, the generating unit 404 is specifically used for:
[0139] When the target animation file meets the preset animation rule, the target animation file is compiled and processed by compiling and executing to obtain a first compiled file;
[0140] The first compiled file is rendered to obtain the target animation.
[0141] In some embodiments, the generating unit 404 is further specifically configured to:
[0142] When the target animation file does not conform to the preset animation rule, compiling the target animation file in an interpreted execution manner to obtain a second compiled file;
[0143] The second compiled file is rendered to obtain the target animation.
[0144] See also Figure 5 In some embodiments, the setting unit 403 includes:
[0145] An adding subunit 4031 is used for adding the configured animation parameter to the position corresponding to the configurable animation element in the animation template file to obtain the target animation file when the animation parameter corresponding to the configurable animation element is zero;
[0146] The replacement subunit 4032 is used to replace the animation parameters corresponding to the configurable animation elements in the animation template file with the configured animation parameters to obtain the target animation file when the animation parameters corresponding to the configurable animation elements are not zero.
[0147] In some embodiments, the second obtaining unit 402 includes:
[0148] The first receiving subunit 4021 is used to receive a configuration animation instruction corresponding to the configurable animation element;
[0149] An activation subunit 4022 is used to activate the animation element setting interface in the resource extension library according to the configuration animation instruction;
[0150] The acquisition subunit 4023 is used to acquire the configuration animation parameters based on the animation element setting interface.
[0151] In some embodiments, the first acquisition subunit 4023 is specifically used to:
[0152] Receiving the configuration animation parameters set by the developer through the animation element setting interface; or,
[0153] The configuration animation parameters are obtained from a database through the animation element setting interface.
[0154] In some embodiments, the configuration animation instruction includes a configurable animation element identifier, and the first acquisition subunit 4023 is further specifically used to:
[0155] According to the configurable animation element identifier, downloading the configuration animation parameter corresponding to the configurable animation element identifier from a server database through the animation element setting interface; or,
[0156] According to the configurable animation element identifier, the configuration animation parameter corresponding to the configurable animation element identifier is acquired from a local database through the animation element setting interface.
[0157] In some embodiments, the second acquiring unit 402 is specifically configured to:
[0158] Receive a configuration animation instruction corresponding to the configurable animation sub-element;
[0159] Acquiring the configuration animation parameters according to the configuration animation instruction based on the animation element setting interface;
[0160] At this time, the setting unit 403 is specifically used to:
[0161] According to the configured animation parameters, the animation parameters corresponding to the configurable animation sub-elements in the animation template file are set to obtain the target animation file.
[0162] In some embodiments, the first acquiring unit 401 includes:
[0163] The second receiving subunit 4011 is used to receive a template selection instruction;
[0164] The selection subunit 4012 is used to select the animation template file from a plurality of preset candidate animation templates according to the template selection instruction.
[0165] In the embodiment of the present application, the first acquisition unit 401 acquires an animation template file, which includes animation parameters corresponding to configurable animation elements; the second acquisition unit 402 acquires configuration animation parameters for the configurable animation element based on the animation element setting interface; then the setting unit 403 sets the animation parameters corresponding to the configurable animation element in the animation template file according to the configuration animation parameters to obtain a target animation file; and finally the generation unit 404 generates a target animation according to the target animation file. This solution only needs to modify some parameters in the animation template file to obtain the target animation, which can improve the animation generation efficiency, reduce the workload of designers and developers, and reduce some animation designs that are generally similar but only have certain elements that are different.
[0166] Figure 6 The specific structural block diagram of the terminal provided in the embodiment of the present application is shown, and the terminal can be used to implement the animation generation method provided in the above embodiment. The terminal 600 can be a smart phone or a tablet computer.
[0167] like Figure 6 As shown, the terminal 600 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more (only one is shown in the figure) computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more (only one is shown in the figure) processing cores, and a power supply 190. Those skilled in the art will understand that Figure 6 The structure of the terminal 600 shown in the figure does not constitute a limitation on the terminal 600, and the terminal 600 may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0168] The RF circuit 110 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices. The RF circuit 110 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity module (SIM) cards, memories, etc. The RF circuit 110 can communicate with various networks such as the Internet, corporate intranets, wireless networks, or communicate with other devices through wireless networks. The above-mentioned wireless networks may include cellular telephone networks, wireless local area networks, or metropolitan area networks. The above-mentioned wireless networks can use various communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wi-Fi) (such as Institute of Electrical and Electronics Engineers standards IEEE 802.11a, IEEE 802.11b, IEEE802.11g and / or IEEE802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access (Wi-Max), other protocols for email, instant messaging and short messages, and any other suitable communication protocols, even those that have not yet been developed.
[0169] The memory 120 can be used to store software programs and modules, such as the program instructions / modules of the animation generation method in the above-mentioned embodiment. The processor 180 executes various functional applications and data processing by running the software programs and modules stored in the memory 120, that is, realizes the function of generating animation. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 120 may further include a memory remotely arranged relative to the processor 180, and these remote memories may be connected to the terminal 600 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0170] The input unit 130 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 130 may include a touch-sensitive surface 131 and other input devices 132. The touch-sensitive surface 131, also known as a touch display screen or a touch pad, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch-sensitive surface 131), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface 131 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 131, the input unit 130 may further include other input devices 132. Specifically, other input devices 132 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
[0171] The display unit 140 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal 600, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 140 may include a display panel 141. Optionally, the display panel 141 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 131 may cover the display panel 141. When the touch-sensitive surface 131 detects a touch operation on or near it, it is transmitted to the processor 180 to determine the type of touch event. Subsequently, the processor 180 provides a corresponding visual output on the display panel 141 according to the type of touch event. Although in Figure 6 In the embodiment, the touch-sensitive surface 131 and the display panel 141 are implemented as two independent components to realize the input and output functions. However, in some embodiments, the touch-sensitive surface 131 and the display panel 141 can be integrated to realize the input and output functions.
[0172] The terminal 600 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 141 and / or the backlight when the terminal 600 is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can also be configured in the terminal 600, they will not be repeated here.
[0173] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal 600. The audio circuit 160 can transmit the received audio data to the speaker 161 after converting the received audio data into an electrical signal, which is converted into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, and then the audio data is output to the processor 180 for processing, and then sent to another terminal through the RF circuit 110, or the audio data is output to the memory 120 for further processing. The audio circuit 160 may also include an earplug jack to provide communication between an external headset and the terminal 600.
[0174] The terminal 600 can help users send and receive emails, browse web pages, and access streaming media through the transmission module 170 (such as a Wi-Fi module), which provides users with wireless broadband Internet access. Figure 6 The transmission module 170 is shown, but it is understandable that it is not an essential component of the terminal 600 and can be omitted as required without changing the essence of the invention.
[0175] The processor 180 is the control center of the terminal 600. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, it executes various functions of the terminal 600 and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 180.
[0176] The terminal 600 also includes a power supply 190 (such as a battery) for supplying power to various components. In some embodiments, the power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 190 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0177] Although not shown, the terminal 600 may also include a camera (such as a front camera, a rear camera), a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the display unit 140 of the terminal 600 is a touch screen display, and the terminal 600 also includes a memory 120 and one or more programs, wherein the one or more programs are stored in the memory 120 and are configured to be executed by one or more processors 180. The one or more programs include instructions for performing the following operations:
[0178] Obtain an animation template file, the animation template file including animation parameters corresponding to configurable animation elements;
[0179] Obtaining configuration animation parameters for the configurable animation element based on the animation element setting interface;
[0180] According to the configured animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file;
[0181] Generate a target animation according to the target animation file.
[0182] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0183] To this end, an embodiment of the present application provides a storage medium in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any animation generation method provided in the embodiment of the present application. For example, the instructions can execute the following steps:
[0184] Obtain an animation template file, the animation template file including animation parameters corresponding to configurable animation elements;
[0185] Obtaining configuration animation parameters for the configurable animation element based on the animation element setting interface;
[0186] According to the configured animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file;
[0187] Generate a target animation according to the target animation file.
[0188] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0189] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0190] Since the instructions stored in the storage medium can execute the steps in any animation generation method provided in the embodiments of the present application, the beneficial effects that can be achieved by any animation generation method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0191] The above is a detailed introduction to an animation generation method, device and storage medium provided in an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating an animation, characterized in that: include: Obtain an animation template file, wherein the animation template file includes animation parameters corresponding to configurable animation elements; Acquire configuration animation parameters for the configurable animation element based on an animation element setting interface; According to the configured animation parameters, the animation parameters corresponding to the configurable animation elements in the animation template file are set to obtain a target animation file; Generate a target animation according to the target animation file; The animation is a Lottie animation, the animation template file is a Json file, and the generating of the target animation according to the target animation file includes: When the target animation file is executed more than a threshold number of times in the generating device, and the animation parameters corresponding to the configurable animation elements in the target animation file have not changed compared with the last execution, the target animation file is compiled and processed by the resource dynamic interpreter in a compilation and execution manner to obtain a first compiled file, wherein the first compiled file is in the form of a Json data stream; When the number of executions of the target animation file in the generating device does not exceed a threshold, or the animation parameters corresponding to the configurable animation elements in the target animation file change relative to the last execution, the target animation file is compiled and processed by a resource dynamic interpreter in an interpretive execution manner to obtain a second compiled file; Rendering is performed on the first compiled file and the second compiled file to obtain a target Lottie animation.
2. The method according to claim 1, characterized in that The step of setting the animation parameters corresponding to the configurable animation elements in the animation template file according to the configured animation parameters to obtain the target animation file comprises: When the animation parameter corresponding to the configurable animation element is zero, the configured animation parameter is added to the position corresponding to the configurable animation element in the animation template file to obtain the target animation file; When the animation parameter corresponding to the configurable animation element is not zero, the animation parameter corresponding to the configurable animation element in the animation template file is replaced with the configured animation parameter to obtain the target animation file.
3. The method according to claim 1, characterized in that The step of acquiring the configuration animation parameters for the configurable animation element based on the animation element setting interface includes: Receive a configuration animation instruction corresponding to the configurable animation element; Activate the animation element setting interface in the resource extension library according to the animation configuration instruction; The configuration animation parameters are obtained based on the animation element setting interface.
4. The method according to claim 3, characterized in that The acquiring the configuration animation parameters based on the animation element setting interface includes: Receiving the configuration animation parameters set by the developer through the animation element setting interface; or, The configuration animation parameters are obtained from a database through the animation element setting interface.
5. The method according to claim 4, characterized in that The configuration animation instruction includes a configurable animation element identifier, and the obtaining the configuration animation parameter from the database through the animation element setting interface includes: According to the configurable animation element identifier, downloading the configuration animation parameter corresponding to the configurable animation element identifier from a server database through the animation element setting interface; or, According to the configurable animation element identifier, the configuration animation parameter corresponding to the configurable animation element identifier is acquired from a local database through the animation element setting interface.
6. The method according to any one of claims 1 to 5, characterized in that The step of obtaining the animation template file includes: Receive template selection instructions; According to the template selection instruction, the animation template file is selected from a plurality of preset candidate animation templates.
7. An animation generating device, characterized in that: include: A first acquisition unit, configured to acquire an animation template file, wherein the animation template file includes animation parameters corresponding to configurable animation elements; A second acquisition unit, configured to acquire configuration animation parameters for the configurable animation element based on an animation element setting interface; A setting unit, configured to set the animation parameters corresponding to the configurable animation elements in the animation template file according to the configured animation parameters, to obtain a target animation file; A generating unit, configured to generate a target animation according to the target animation file; The animation is a Lottie animation, the animation template file is a Json file, and the generating of the target animation according to the target animation file includes: When the target animation file is executed more than a threshold number of times in the generating device, and the animation parameters corresponding to the configurable animation elements in the target animation file have not changed compared with the last execution, the target animation file is compiled and processed by the resource dynamic interpreter in a compilation and execution manner to obtain a first compiled file, wherein the first compiled file is in the form of a Json data stream; When the number of executions of the target animation file in the generating device does not exceed a threshold, or the animation parameters corresponding to the configurable animation elements in the target animation file change relative to the last execution, the target animation file is compiled and processed by a resource dynamic interpreter in an interpretive execution manner to obtain a second compiled file; Rendering is performed on the first compiled file and the second compiled file to obtain a target Lottie animation.
8. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the animation generation method according to any one of claims 1 to 6.
