Animation processing method and device, terminal and computer readable storage medium
Patent Information
- Application Number
- CN202011149248.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-23
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2040-10-23
Smart Images

Figure CN114510280B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of mobile terminals, specifically to an animation processing method, apparatus, terminal, and computer-readable storage medium. Background Technology
[0002] Mini-programs, as applications that can be used directly without installation, are increasingly favored by users for their convenience, speed, and powerful functions. Many interfaces within mini-programs require image display, and animation is more vivid and engaging than static image files. Lottie is an animation effects solution that is compatible with multiple operating systems and has a very simple creation process. For example, it's an open-source, cross-platform animation effects solution from Airbnb, with animation files in JSON format. It also has excellent compatibility with mini-programs, enabling increasingly richer animated content within them.
[0003] However, as the animations change continuously during the use of the mini-program, the memory occupied by the mini-program will increase, causing other business content to be affected due to the reduction of available memory.
[0004] Application content This application provides an animation processing method, apparatus, terminal, and computer-readable storage medium to at least alleviate the problem of increased inventory usage in mini-programs due to animation playback during current mini-program usage.
[0005] To address the aforementioned technical problems, this application provides the following technical solutions: The first aspect of this application provides an animation processing method, the method comprising: Displays the application's session pages, which include pages for interacting with virtual objects; When dialogue content is detected being sent to the virtual object, the target animation to be executed when the virtual object responds to the dialogue content is determined; Detect the canvas used to implement the animation in the current application file; When a target canvas is detected, the animation file of the target animation is checked in the cache; When the presence of the target animation file in the cache is detected, the target animation file is retrieved from the cache; When the virtual object is detected to provide content feedback in response to the dialogue, the animation file of the target animation is loaded into the target canvas, and the target animation is played on the conversation page according to the loaded target canvas.
[0006] Accordingly, a second aspect of the present application provides an animation processing apparatus, comprising: A display unit is used to display the application's session page, which includes a page for interacting with virtual objects; The determining unit is configured to determine the target animation to be executed when the virtual object responds to the dialogue content after detecting that dialogue content has been sent to the virtual object. The first detection unit is used to detect the canvas used to implement the animation in the current application file; the second detection unit is used to detect the animation file of the target animation in the cache when the existence of the target canvas is detected. An extraction unit is configured to extract the animation file of the target animation from the cache when the existence of the animation file of the target animation is detected in the cache; The playback unit is used to load the animation file of the target animation into the target canvas when the virtual object provides content feedback in response to the dialogue content, and to play the target animation in the conversation page according to the loaded target canvas.
[0007] A third aspect of this application provides a terminal including a processor and a memory, the memory storing multiple instructions adapted for loading by the processor to execute the steps in the above-described method.
[0008] A fourth aspect of this application provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to perform the steps in the above-described method.
[0009] A fifth aspect of this application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the above-described method.
[0010] This application provides an animation processing method. The method involves displaying an application's session page, which includes a page for interacting with virtual objects. When dialogue content is detected being sent to the virtual object, the method determines the target animation to be executed when the virtual object responds to the dialogue content. The method detects the canvas used to implement the animation in the current application file. When a target canvas is detected, the method checks the cache for the target animation file. If the target animation file is found in the cache, it is retrieved from the cache. When the virtual object responds to the dialogue content, the target animation file is loaded onto the target canvas, and the target animation is played on the session page based on the loaded target canvas. In this way, when the application needs to play an animation, it first checks if a canvas exists in the program. If a canvas exists, there is no need to download the canvas node and rebuild the canvas, saving memory space and mitigating the impact of increased memory usage during image switching on other applications. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of the session page of the application provided in the embodiments of this application; Figure 2 This is a flowchart illustrating the animation processing method provided in an embodiment of this application; Figure 3 This is another flowchart illustrating the animation processing method provided in the embodiments of this application; Figure 4 This is a simplified flowchart of a part of the animation processing method provided in the embodiments of this application; Figure 5 This is a simplified flowchart of another part of the animation processing method provided in the embodiments of this application; Figure 6 This is a simplified flowchart of another part of the animation processing method provided in the embodiments of this application; Figure 7 This is a schematic diagram of the structure of the animation processing apparatus provided in the embodiments of this application; Figure 8 This is another schematic diagram of the animation processing apparatus provided in the embodiments of this application; Figure 9 Another schematic diagram of the animation processing apparatus provided in the embodiments of this application; Figure 10Another schematic diagram of the animation processing apparatus provided in the embodiments of this application; Figure 11 Another schematic diagram of the animation processing apparatus provided in the embodiments of this application; Figure 12 A schematic diagram of the terminal provided in this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application 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 application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] This application provides an animation processing method applied to a terminal application. The application can be an application that downloads a corresponding installation package to the terminal and installs itself on the terminal based on the downloaded package before use. Alternatively, the application can be a mini-program, which is an application that can be used without downloading and installation; for example, WeChat mini-programs are currently very common. Mini-programs can be opened directly in the basic application by clicking a link, searching for a mini-program, or scanning a QR code, without needing to download the corresponding installation package, thus saving terminal memory space. Furthermore, users can exit directly after using a mini-program without uninstalling it, and users don't need to worry about having too many applications installed on their terminal. On the other hand, from an application development perspective, mini-program development has a relatively low barrier to entry and is less difficult than developing ordinary applications; its functionality can also meet some simple basic application needs. Therefore, mini-programs can also save development and promotion costs. Due to these advantages, the application of mini-programs has become increasingly widespread in recent years.
[0015] Application interfaces typically include interactive interfaces, or conversational pages, for user interaction. Users can input commands on these pages, and the application responds by outputting feedback results corresponding to the user's input. In this case, the application can be viewed as a virtual object engaging in a conversation with the user. In some applications, after the user inputs a command, the application not only provides text or voice feedback data but also displays images or animations of the virtual object on the conversational page. Animations make the interaction with the virtual object more vivid, enhancing the user experience. Animations can include GIF (Graphics Interchange Format), JPEG (Joint Photographic Experts Group), or LOTIE animations.
[0016] like Figure 1 The diagram shows a schematic of the session page of an application provided in this embodiment. As shown, the session page 10 of the application includes a feedback content display area 11, a virtual object animation display area 12, a dialogue content display area 13, a dialogue content input area 14, and a dialogue content sending control 15. The dialogue content display area 13 may also include a user logo (identifier) 131 and a dialogue text display area 132. The user enters dialogue content in the dialogue content input area 14 and then sends the dialogue content to the virtual object by clicking the dialogue content sending control 15. The terminal displays the dialogue content sent to the virtual object in the dialogue content display area 13. The virtual object provides feedback to the user's input dialogue content, displaying the feedback content corresponding to the user's input dialogue content in the feedback content display area 11, and simultaneously playing the animation corresponding to the feedback content in the virtual object animation display area.
[0017] In actual use, the inventors of this application discovered that the memory occupied by the application gradually increases with the switching of animations during interactive operations. For example, when the application was first launched, the inventors found that the application occupied 478M of memory when checking the performance data. After interacting with the virtual object a preset number of times, the inventors found that the application occupied 748M of memory when checking the performance data again.
[0018] To alleviate the problem of increased memory consumption by applications after running for a period of time, which could affect other applications, this application provides an animation processing method. This method can be applied to an animation processing device, which can be integrated into a terminal. The terminal can be a mobile phone, tablet computer, laptop computer, smart TV, wearable smart device, personal computer (PC), etc. Figure 2 The diagram shown is a flowchart of the animation processing method provided in this application. The method includes: Step 101: Display the application's session page, which includes a page for conversing with virtual objects.
[0019] The application can be a downloaded and installed application or a mini-program running on top of a base application. The application's user interface includes a conversation page through which users can interact with virtual objects within the application. Furthermore, the conversation page displays not only user-inputted information and feedback from the virtual objects based on that information, but also animations of the virtual objects. User-inputted information can be text, voice, or image; similarly, feedback can also be text, voice, or image. The animation of the virtual object can be determined based on the feedback; for example, if the feedback is "yes," the virtual object's animation could be a nodding animation.
[0020] Step 102: When dialogue content is detected being sent to the virtual object, determine the target animation to be executed when the virtual object responds to the dialogue content.
[0021] Users can enter dialogue in the dialogue box on the conversation page, or input voice dialogue by clicking on the animation of a virtual object, or they can input image dialogue. When user input is detected, the system recognizes the input and determines the corresponding feedback information. This feedback information includes a response to the dialogue and the playback of the virtual object's animation. The feedback content can include text and voice information. The animation of the virtual object is determined based on the feedback content.
[0022] In some embodiments, determining the target animation that the virtual object needs to perform in response to dialogue content includes: (1) Determine the corresponding feedback content based on the dialogue content; (2) Determine the target animation corresponding to the feedback content.
[0023] Specifically, when the user inputs text-based dialogue, semantic recognition is performed on the input text to determine its semantic meaning. Then, feedback content corresponding to that semantic meaning is generated based on the recognized semantic meaning. Alternatively, feedback content corresponding to the semantic meaning of the text can be retrieved from the internet.
[0024] When the dialogue content is voice information, speech recognition is first performed to determine the corresponding text information. Then, semantic recognition is performed on the text information to determine the feedback content. When the dialogue content is image information, image recognition is first performed to determine the corresponding text information. Then, semantic recognition is performed to further determine the feedback content. After determining the feedback content corresponding to the dialogue content, the corresponding target animation is determined based on the feedback content.
[0025] In some embodiments, determining the target animation corresponding to the feedback content includes: (a) Extract semantic information from the feedback content to obtain its semantic information; (b) Determine the target animation corresponding to the feedback content based on semantic information.
[0026] In this process, semantic extraction of the feedback content can be performed, focusing on extracting semantics such as judgments, expressions / emotions, or actions contained in the feedback content. Then, based on these recognized semantics, the expressions and body movements of the virtual character can be controlled to determine the target animation corresponding to the feedback content.
[0027] Step 103: Detect the canvas used to implement the animation in the current application file.
[0028] In their research on the increased memory usage of the aforementioned application after a period of use, which subsequently affected other applications, the inventors of this application discovered that the application's memory usage increased with the switching of animations during interaction. Further research into the increased memory data revealed that it contained a significant amount of canvas node data, which can be used to create canvases. The canvas can be used to generate images in real-time within the application, and its content can be manipulated; alternatively, the canvas can be understood as a container for interactive interfaces or animations, on which animations can run and be displayed in the interactive interface. The inventors found that each time a user inputs dialogue content, the virtual object analyzes the input and outputs feedback content. The virtual object also determines its animation based on the feedback content and plays the animation. In other words, each time a user inputs dialogue content, the application plays an animation provided by the virtual object. In related technologies, the process of an application playing an animation involves downloading canvas node data, creating a canvas, determining the animation based on the feedback content, and then loading the animation onto the canvas. Therefore, each time the application plays an animation, it needs to download canvas node data and save it to memory. The application then creates the canvas based on the downloaded canvas nodes. As a result, each time the application plays an animation, a new canvas node data is added to memory, causing the application to consume more and more memory.
[0029] Therefore, when the animation playback implementation method provided in this application detects dialogue content sent to a virtual object, it first detects the canvas used to implement the animation in the current application to determine whether the canvas already exists in the current application. Based on the detection result, it determines whether it is necessary to download the canvas node again and create a new canvas based on the downloaded canvas node. Specifically, detecting the canvas can detect whether there is a process running the canvas in the application's running process.
[0030] Step 104: When a target canvas is detected, check the animation file of the target animation in the cache.
[0031] When a target canvas is detected, it is determined that there is no need to download canvas node data from the internet or create a new canvas; the cached target canvas can be directly used for animation playback. In related technologies, after determining the target animation to be executed in response to dialogue content, the target animation is obtained. Specifically, the storage address information of the animation file of the target animation in the network is first found in memory, and then the animation file of the target animation is downloaded from the internet based on the network storage address information. Since downloading files from the internet takes time and is greatly affected by network signal, and may even fail in areas with poor network conditions, it significantly impacts the user experience. Therefore, in the animation processing method provided in this application embodiment, some frequently used animation files can be pre-cached in the terminal's cache. When the target animation to be executed in response to dialogue content is determined, a search can be performed in the terminal's cache to check if the animation file of the target animation exists in the cache.
[0032] Step 105: When the target animation file is detected in the cache, extract the target animation file from the cache.
[0033] Specifically, once the animation file for the target animation is detected in the terminal's cache, it can be determined that there is no need to download the animation file from the internet; the cached animation file can be directly retrieved and used. Therefore, the animation processing method provided in this application can improve the efficiency of animation file retrieval, thereby shortening the response time to dialogue content and accelerating the application's response speed.
[0034] Step 106: When a virtual object is detected to provide content feedback in response to the dialogue, the animation file of the target animation is loaded into the target canvas, and the target animation is played in the conversation page based on the loaded target canvas.
[0035] When displaying feedback information on the application's session page, both the feedback content and the animation of the virtual object can be displayed simultaneously. Specifically, displaying the target animation of the virtual object on the application's session page includes loading the animation file corresponding to the target animation of the determined virtual object into the target canvas, so that the target animation can be played on the target canvas. The user can then view the playing target animation on the application's session page. Therefore, the animation processing method provided in this application eliminates the need to download canvas nodes every time an animation is played, avoiding the memory occupation of canvas node data and alleviating the memory pressure on the terminal.
[0036] In some embodiments, loading the animation file of the target animation onto the target canvas includes: (1) When there is animation content in the target canvas, delete the file corresponding to the animation content in memory; (2) Update the target animation to the target canvas; Before displaying feedback on the application's session page, the system first checks the existing target canvas. Since the target canvas already exists, it indicates that it has already undergone a creation and invocation process, making it highly likely that the previously played animation content still exists on the target canvas. Therefore, the system first checks whether animation content exists on the target canvas. When animation content is detected on the target canvas, playback of that animation is paused, and the file corresponding to that animation content stored in memory is deleted. This ensures that no other animation content exists on the target canvas before the target animation is loaded. Then, the target animation is updated and loaded onto the target canvas, and the playback animation on the session page is switched to the target animation based on the updated target canvas.
[0037] The animation processing method provided in this embodiment deletes the file corresponding to the previously played animation content from memory each time the animation is switched, further avoiding the occupation of the inventory by historical animation content files, further reducing the application's memory usage, and alleviating the memory pressure on the terminal.
[0038] As described above, the animation processing method provided in this application includes: displaying a session page of the application, the session page including a page for interacting with virtual objects; when dialogue content is detected being sent to the virtual object, determining the target animation to be executed when the virtual object responds to the dialogue content; detecting the canvas used to implement the animation in the current application file; when the existence of the target canvas is detected, detecting the animation file of the target animation in the cache; when the existence of the animation file of the target animation is detected in the cache, retrieving the animation file of the target animation from the cache; when the virtual object responds to the dialogue content, loading the animation file of the target animation onto the target canvas, and playing the target animation on the session page according to the loaded target canvas. Thus, when the application needs to play an animation, it first checks whether a canvas exists in the program. If a canvas exists, there is no need to download the canvas node and rebuild the canvas, saving memory space and avoiding the situation where the application's memory usage increases with image switching, affecting other applications.
[0039] Accordingly, this application embodiment will further describe the animation processing method provided in this application from the perspective of the terminal. The terminal in this embodiment can be a mobile phone, tablet computer, laptop computer, smart TV, wearable smart device, personal computer (PC), etc. In this embodiment, the application can specifically be a mini-program, and the animation can specifically be a lottie animation. For example... Figure 3 The diagram shown is another flowchart illustrating the animation processing method provided in this application, which includes: Step 201: The terminal displays the mini-program's session page.
[0040] In this context, a mini-program can be a mini-program with virtual objects that interact with the user. These virtual objects can be displayed on the mini-program's conversation page, specifically, they can be displayed in the form of animation. The animation can be a Lottie animation. Playing a Lottie animation on a mini-program page involves building a Lottie framework within the mini-program to achieve compatibility between Lottie and the mini-program. The resulting mini-program can be called an animated mini-program (lottie-miniprogram). For example, a mini-program could be Tencent Cloud Xiaowei within WeChat Mini Program, which can have a virtual object named "Xiaowei." When a user engages in a conversation using the Tencent Cloud Xiaowei mini-program, the mini-program's conversation page not only displays the user's input and Xiaowei's feedback but also plays Xiaowei's Lottie animated image. Xiaowei's Lottie animated image determines its specific actions and expressions based on Xiaowei's feedback.
[0041] Step 202: When dialogue content is detected being sent to the virtual object, the terminal determines the target lottie animation to be executed when the virtual object responds to the dialogue content.
[0042] When the terminal receives dialogue input from the user, it needs to provide feedback, which involves displaying the feedback content and playing a virtual object's lottie animation. Specifically, the terminal first determines the feedback content corresponding to the dialogue content, and then determines the target lottie animation that matches the feedback content. Determining the target lottie animation based on the feedback content can be achieved by first performing semantic recognition on the feedback content, and then determining the target lottie animation based on the recognized semantics of the feedback content. The semantics of the feedback content can include emotions, facial expressions, or body language.
[0043] Step 203: The terminal detects the canvas used to implement the animation in the current mini-program.
[0044] In related technologies, each display of a lottie animation requires obtaining a canvas node and creating a canvas based on that node. Each canvas node retrieved from the network is stored in the mini-program's memory, causing the mini-program's memory usage to increase. Therefore, in the animation implementation method provided in this application, before playing the lottie animation, it first checks whether a canvas for implementing the lottie animation exists in the mini-program's process. Further operations are then performed based on the detection result.
[0045] The target canvas can be a universal canvas applicable to all lottie animations, or it can be a canvas corresponding to the dialogue content sent by the user. When the terminal detects the existence of a target canvas in the mini-program, it can determine that there is no need to download the canvas node and create the canvas again; instead, it can directly call the target canvas to implement the lottie animation. At this point, the terminal determines the feedback content corresponding to the dialogue content input by the user, and further determines the target lottie animation corresponding to the feedback content.
[0046] In some embodiments, after detecting the presence of a target canvas, the method further includes: (1) Detect whether there is a Lottie animation in the target canvas; (2) When a lottie animation exists in the target canvas, stop playing the lottie animation and delete the animation file corresponding to the lottie animation in memory.
[0047] When a target canvas is detected, it indicates that the target canvas has already been created and is highly likely to have been invoked. Therefore, before loading the target lottie animation, the target canvas is cleared to ensure that no other lottie animations exist on it. Furthermore, deleting files related to previously played lottie animations from memory can further reduce the memory usage of the mini-program and alleviate memory pressure on the terminal.
[0048] Step 204: When the target canvas is detected to be non-existent, the terminal obtains the canvas node and creates a canvas based on the canvas node, and detects the animation file of the target lottie animation in the cache.
[0049] When a target canvas is detected to be nonexistent, the terminal obtains the canvas node corresponding to the dialogue content input by the user and creates a canvas based on the canvas node.
[0050] In some embodiments, creating a canvas based on canvas nodes includes: (1) Determine the canvas creation component used to create the canvas under the Lottie framework; (2) Create components through the canvas and create a canvas based on the obtained canvas nodes.
[0051] Playing Lottie animations within a mini-program's chat page can be achieved by building the Lottie framework within the mini-program to adapt Lottie to the mini-program. The resulting mini-program can be called an animated mini-program (lottie-miniprogram). Therefore, after obtaining the canvas node data, the canvas creation component under the Lottie framework can be identified, and then the canvas is created using the canvas node data. After creation, the existence of the target Lottie animation file is checked in the terminal's cache, and the created canvas is used to load the target Lottie animation file for animation playback.
[0052] Step 205: When a target canvas is detected, the terminal checks the animation file of the target lottie animation in the cache.
[0053] In related technologies, after identifying the target lottie animation, the terminal queries the mini-program's memory file for the network storage address corresponding to the animation file. Then, based on this address, it downloads the animation file from the internet to the corresponding storage location in the terminal's memory, and finally retrieves it from that memory. Downloading the animation file from the internet takes time, resulting in a delay before user input and feedback, and ultimately, a poor user experience. Furthermore, poor network conditions can lead to lengthy download times or even download failures. Therefore, a method to improve the loading speed of lottie animation files is urgently needed.
[0054] Therefore, in this embodiment, after the animation file of the target lottie animation is determined, the terminal first checks whether the target lottie animation file exists in the terminal's cache, and then performs further operations based on the detection result. Furthermore, to ensure that the user can potentially detect the animation file of the target lottie animation in the cache, it is necessary to cache some commonly used lottie animation files in the terminal's cache beforehand.
[0055] Based on the above description, for a clearer description of the technical solution of this application, please refer to [link / reference needed]. Figure 4 This is a simplified flowchart of the animation processing method provided in this application. Figure 4 It can be seen that after receiving the dialogue content, the system first checks whether a canvas exists. If no canvas exists, it obtains the canvas node and creates the canvas. If a canvas exists, it obtains the target animation and then checks whether an animation exists in the canvas. If an animation exists in the canvas, it stops the animation playback and deletes the animation file. If no animation exists, it loads the target animation into the canvas for animation playback.
[0056] Step 206: When the terminal detects that the animation file of the target lottie animation exists in the cache, it retrieves the animation file of the target lottie animation from the cache.
[0057] Specifically, when the animation file of the target lottie animation is detected in the terminal's cache, it is determined that the terminal does not need to download the animation file from the internet; instead, the terminal directly retrieves the animation file from its cache. Therefore, using the animation processing method provided in this embodiment, the animation file of the target lottie animation can be retrieved directly from the terminal's cache without downloading it from the internet, thereby improving the efficiency of obtaining the animation file and shortening the feedback time.
[0058] In some embodiments, retrieving the animation file of the target lottie animation from the cache includes: (1) Determine the file extraction component under the Lottie framework for extracting animation files; (2) Extract the animation file of the target Lottie animation using the file extraction component.
[0059] When the cached animation file for the target lottie animation is detected, the file extraction component is triggered to extract the animation file. The target canvas then loads the extracted animation file, causing the target lottie animation to play in the mini-program's session page.
[0060] Step 207: When the terminal detects that the animation file for the target lottie animation does not exist in the cache, it checks the temporary file area of the mini-program. If the terminal detects that the animation file for the target lottie animation exists in the temporary file area, it retrieves the lottie animation file from the temporary file area.
[0061] Since the terminal's cache space is limited, some Lottie animation files can be cached in the mini-program's temporary file area. When the terminal does not detect the target Lottie animation file in the cache, it can check the mini-program's temporary file area to determine if the target Lottie animation file exists there. If the target Lottie animation file exists in the mini-program's temporary file area, the terminal can retrieve it. The animation processing method provided in this application further increases the number of cached Lottie animation files, improves the probability of detecting the target Lottie animation file in the local cache, and further improves the mini-program's response efficiency.
[0062] Step 208: When it is detected that the animation file of the target lottie animation does not exist in the temporary file area, the terminal obtains the network storage address corresponding to the animation file of the target lottie animation and downloads the animation file of the target lottie animation according to the network storage address.
[0063] Specifically, if the animation file for the target lottie animation is not detected in either the terminal's cache or the mini-program's temporary file area, it is determined that the animation file for the target lottie animation is not stored locally on the terminal. In this case, the terminal retrieves the network storage address of the target lottie animation file and downloads it from that address. The network storage address can be the URL (Uniform Resource Locator) corresponding to the target lottie animation file.
[0064] Based on the above description, for a clearer description of the technical solution of this application, please refer to [link / reference needed]. Figure 5 This is a simplified flowchart illustrating another part of the animation processing method provided in this application. Figure 5 As can be seen, the target lottie animation file in this application adopts a three-layer loading strategy of terminal cache—temporary file cache—network download. That is, when the loading of the target lottie animation file is triggered, it first checks whether the target lottie animation file exists in the terminal cache. If it exists, the target lottie animation file stored in the terminal cache area is retrieved. If the target lottie animation file does not exist in the terminal cache area, it then checks whether the target lottie animation file exists in the temporary file area of the mini program. If the target lottie animation file exists in the temporary file area of the mini program, it is retrieved from the temporary file area of the mini program. If the target lottie animation file does not exist in the temporary file area of the mini program, the target lottie animation file is downloaded from the network.
[0065] In some embodiments, downloading the animation file of the target lottie animation according to the network storage address of the target lottie animation includes: (1) Download the target file corresponding to the network storage address based on the network storage address; (2) When there is no file tag corresponding to the target file in the cache, generate the file tag corresponding to the target file; (3) Store the target file in the temporary file area and cache the file tag in the cache.
[0066] The process involves detecting whether the target lottie animation file exists in the terminal's cache and the mini-program's temporary file area, and detecting the file tags corresponding to the target lottie animation file. The terminal's cache stores tag information and storage addresses for all files stored in the terminal's cache and the mini-program's temporary file area. Specifically, the file tag information can be the file's MD5 hash. MD5 (Message-Digest Algorithm) is a widely used cryptographic hash function. The MD5 algorithm can be used as a method of electronic signature; it can generate a unique "digital fingerprint" for any file (regardless of size, format, or quantity). By checking whether the MD5 value of a file changes before and after modification, it can be determined whether the source file has been altered. When the MD5 hash of the target file is not found in the cache, an MD5 hash is generated for the target file and saved in the terminal's cache. On the other hand, the terminal saves the downloaded target lottie animation file in the mini-program's temporary file area and stores the storage address information of the target lottie animation file in the terminal's cache.
[0067] On the other hand, when an MD5 corresponding to the target file is detected in the cache, it checks whether the downloaded target file is updated relative to the existing animation file corresponding to that MD5. If it is updated, the existing animation file saved in the mini program's temporary file area is deleted and the target file is stored in the mini program's temporary file area.
[0068] However, in related technologies, downloading animation files from the internet involves first downloading the animation file to the corresponding storage location in memory, then downloading it to the temporary file area of the mini-program, and caching the mapping relationship between the network storage address information and the animation file in the terminal's cache. It does not check whether the terminal already has the same animation file or only a partially updated animation file. Therefore, the solution provided in this application can further save terminal memory space and alleviate terminal memory pressure.
[0069] Based on the above description, for a clearer description of the technical solution of this application, please refer to [link / reference needed]. Figure 6 ,like Figure 6The diagram shown is a simplified flowchart of another part of the animation processing method provided in this application. When the terminal downloads an animation file from the network, it checks whether an MD5 hash corresponding to the animation file exists in the cache. If it does not exist, an MD5 hash is generated for the animation file, and the animation file is stored in the temporary file area of the mini-program. The MD5 hash of the animation file and the file storage address are stored in the cache. If an MD5 hash corresponding to the animation file exists, it is determined whether the newly downloaded animation file is updated compared to the existing animation file corresponding to that MD5 hash. If it is updated, the existing animation file is deleted, and the newly downloaded animation file is saved to the temporary storage area of the mini-program.
[0070] Step 209: When the virtual object is detected to provide content feedback in response to the dialogue, the terminal loads the animation file of the target lottie animation into the target canvas and plays the target animation in the conversation page according to the loaded target canvas.
[0071] After determining the animation file for the target lottie animation and the target canvas, the terminal loads the animation file for the target lottie animation into the target canvas. This allows the virtual object's animation to play simultaneously on the mini-program's conversation page when the virtual object provides content feedback in response to the dialogue.
[0072] In some embodiments, loading the animation file of the lottie animation onto the target canvas may include: Identify the animation loading component in the Lottie framework used for animation loading; The animation loading component loads the animation file of the Lottie animation into the target canvas.
[0073] As described above, the animation processing method provided in this application displays a session page of the application, which includes a page for interacting with virtual objects. When dialogue content is detected being sent to the virtual object, the application detects the canvas used to implement the animation in the current application file. When a target canvas is detected, the target animation to be executed when the virtual object responds to the dialogue content is determined. When the virtual object responds to the dialogue content, the target animation is played on the session page based on the target canvas. Therefore, when the application needs to play an animation, it first checks whether a canvas exists in the program. If a canvas exists, there is no need to download the canvas node and rebuild the canvas, saving memory space. Furthermore, the animation files corresponding to already played animations are deleted, thereby mitigating the impact on other applications caused by increased memory usage during image switching.
[0074] Furthermore, this application adopts a three-layer loading strategy of terminal caching, temporary file caching, and network download when loading animation files. Compared with the method of loading from the Internet in related technologies, the method provided by this application can improve the loading efficiency of animation files and shorten the response time of the mini-program to the dialogue content input by the user.
[0075] To better implement the above methods, this application also provides an animation processing device that can be integrated into a terminal, which may include smartphones, tablets, laptops, and / or personal computers, etc.
[0076] like Figure 7 The diagram shown is a structural schematic of an animation processing device provided in an embodiment of this application. The device may include: a display unit 301, a determination unit 302, a first detection unit 303, a second detection unit 304, an extraction unit 305, and a playback unit 306.
[0077] Display unit 301 is used to display the application's session page, which includes a page for interacting with virtual objects.
[0078] The determining unit 302 is used to determine the target animation that the virtual object needs to execute when it detects that dialogue content has been sent to the virtual object.
[0079] The first detection unit 303 is used to detect the canvas used to implement animation in the current application file; The second detection unit 304 is used to detect the animation file of the target animation in the cache when the existence of the target canvas is detected; Extraction unit 305 is used to extract the animation file of the target animation from the cache when the existence of the animation file of the target animation is detected in the cache; The playback unit 306 is used to load the animation file of the target animation into the target canvas when it detects that the virtual object is responding to the dialogue content, and to play the target animation in the conversation page according to the loaded target canvas.
[0080] In some embodiments, such as Figure 8 The diagram shown is another structural schematic of the animation processing apparatus provided in this application embodiment, wherein the playback unit 306 includes: The deletion subunit 3061 is used to delete the file corresponding to the animation content in memory when the target canvas contains animation content.
[0081] Update subunit 3062 to update the target animation onto the target canvas.
[0082] In some embodiments, such as Figure 9The diagram shown is another structural schematic of the animation processing apparatus provided in this application embodiment. The animation processing apparatus further includes: The acquisition unit 307 is used to acquire a canvas node when it is detected that no canvas exists; Create unit 308, which is used to create a canvas based on the obtained canvas nodes; Playback unit 306 is also used to play the target animation in the session page based on the created canvas.
[0083] In some embodiments, the determining unit 302 includes: The first determining subunit is used to determine the feedback content corresponding to the dialogue content; The second determining subunit is used to determine the target animation corresponding to the feedback content.
[0084] In some embodiments, the second determining subunit can also be used for: Semantic extraction is performed on the feedback content to obtain its semantic information; The target animation corresponding to the feedback content is determined based on semantic information.
[0085] In some embodiments, such as Figure 10 The diagram shown is another structural schematic of the animation processing apparatus provided in this application embodiment. The animation processing apparatus further includes: The third detection unit 309 is used to detect the application's temporary file area when an animation file for the target animation is detected to be absent in the cache. The extraction unit 305 is also used to extract the animation file of the target animation from the temporary file area when the animation file of the target animation is detected to exist in the temporary file area.
[0086] In some embodiments, such as Figure 11 The diagram shown is another structural schematic of the animation processing apparatus provided in this application embodiment. The animation processing apparatus further includes: The fourth detection unit 310 is used to obtain the network storage address of the target animation when the animation file of the target animation is not detected in the temporary file area; Download unit 311 is used to download the animation file of the target animation according to the network storage address of the target animation.
[0087] In some embodiments, the target canvas includes the canvas within the Lottie frame, and the playback unit 304 is further configured to... Identify the animation loading component in the Lottie framework used for animation loading; The animation file of the target animation component is loaded onto the target canvas via animation loading.
[0088] In some embodiments, the extraction unit 308 is further configured to: Identify the file extraction component within the Lottie framework used to extract animation files; Extract the animation file of the target Lottie animation using the file extraction component.
[0089] In some embodiments, the creation unit 306 is further configured to: Identify the canvas creation component within the Lottie framework used to create the canvas; Components are created using the canvas and canvases are created based on canvas nodes.
[0090] In some embodiments, the download unit 311 includes: The download subunit is used to download the target file corresponding to the network storage address based on the network storage address. The generation subunit is used to generate the target file tag corresponding to the target file when the file tag corresponding to the target file does not exist in the cache; The storage sub-unit is used to store the target file in the temporary file area and cache the target file tag in the cache.
[0091] In some embodiments, the download unit 311 further includes: The determination subunit is used to determine the current file corresponding to the file tag that is already stored in the terminal when the cache contains the current file tag corresponding to the target file; The delete sub-unit is used to delete the current file when the target file is inconsistent with the current file; The storage subunit is also used to store the target file.
[0092] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0093] As described above, this embodiment of the application displays the application's session page through the display unit 301. The session page includes a page for conversing with virtual objects. When dialogue content is detected being sent to a virtual object, the determining unit 302 determines the target animation to be executed when the virtual object responds to the dialogue content. The first detection unit 303 detects the canvas used to implement the animation in the current application file. When a target canvas is detected, the second detection unit 304 detects the animation file of the target animation in the cache. When the animation file of the target animation is detected in the cache, the extraction unit 305 extracts the animation file of the target animation from the cache. When a virtual object responds to the dialogue content, the playback unit 306 loads the animation file of the target animation into the target canvas and plays the target animation in the session page based on the loaded target canvas. Thus, when the application needs to play an animation, it first checks whether a canvas exists in the program. If a canvas exists, there is no need to download the canvas node and rebuild the canvas, saving memory space and alleviating the situation where the application's increased memory usage during image switching affects other applications.
[0094] Accordingly, embodiments of this application also provide a terminal, which may include smartphones, tablets, laptops, and / or personal computers, etc.
[0095] like Figure 12 The diagram shown is a structural schematic of the terminal provided in this application. The terminal may include a radio frequency (RF) circuit 401, a memory 402 including one or more computer-readable storage media, an input unit 403, a display unit 404, a sensor 405, an audio circuit 406, a wireless Fidelity (WiFi) module 407, a processor 408 including one or more processing cores, and a power supply 409, among other components. Those skilled in the art will understand that... Figure 12 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: RF circuit 401 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 408 for processing; additionally, it transmits uplink data to the base station. Memory 402 can be used to store software programs and modules. Processor 408 executes various functional applications and data processing by running the software programs and modules stored in memory 402. Input unit 403 can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0096] The display unit 404 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the terminal. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof.
[0097] The terminal may also include at least one sensor 405, such as a light sensor, a motion sensor, and other sensors. Audio circuitry 406 includes a speaker and a microphone to provide an audio interface between the user and the terminal.
[0098] WiFi is a short-range wireless transmission technology. Terminals using the WiFi module 407 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 12 WiFi module 407 is shown, but it is understood that it is not a necessary component of the terminal and can be omitted as needed without changing the nature of the application.
[0099] The processor 408 is the control center of the terminal. It connects various parts of the mobile phone through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, it performs various functions of the terminal and processes data, thereby performing overall detection of the mobile phone.
[0100] The terminal also includes a power supply 409 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 408 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0101] Although not shown, the terminal may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 408 in the terminal loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 408 runs the applications stored in the memory 402 to achieve the following functions: The application displays a session page, which includes a page for interacting with virtual objects. When dialogue content is detected being sent to a virtual object, the target animation to be executed when the virtual object responds to the dialogue content is determined. The canvas used to implement the animation in the current application file is detected. When a target canvas is detected, the animation file for the target animation is checked in the cache. When the animation file for the target animation is detected in the cache, it is retrieved from the cache. When a virtual object responds to the dialogue content, the animation file for the target animation is loaded onto the target canvas, and the target animation is played in the session page based on the loaded target canvas.
[0102] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description above, and they will not be repeated here.
[0103] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0104] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to perform the following functions: The application displays a session page, which includes a page for interacting with virtual objects. When dialogue content is detected being sent to a virtual object, the target animation to be executed when the virtual object responds to the dialogue content is determined. The canvas used to implement the animation in the current application file is detected. When a target canvas is detected, the animation file for the target animation is checked in the cache. When the animation file for the target animation is detected in the cache, it is retrieved from the cache. When a response from the virtual object to the dialogue content is detected, the animation file for the target animation is loaded onto the target canvas, and the target animation is played on the session page based on the loaded target canvas. Specific implementation details for each of these operations can be found in the preceding embodiments and will not be repeated here.
[0105] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0106] Since the instructions stored in the storage medium can execute the steps of any of the methods provided in the embodiments of this application, the beneficial effects that any of the methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0107] Meanwhile, embodiments of this application provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of a terminal reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the terminal to perform the methods provided in the various optional implementations described above. For example, the following functions are implemented: The application displays a session page, which includes a page for interacting with virtual objects. When dialogue content is detected being sent to a virtual object, the target animation to be executed when the virtual object responds to the dialogue content is determined. The canvas used to implement the animation in the current application file is detected. When a target canvas is detected, the animation file for the target animation is checked in the cache. When the animation file for the target animation is detected in the cache, it is retrieved from the cache. When a virtual object responds to the dialogue content, the animation file for the target animation is loaded onto the target canvas, and the target animation is played in the session page based on the loaded target canvas.
[0108] The animation processing method, apparatus, terminal, and computer-readable storage medium provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An animation processing method, characterized in that, include: Displays the application's session pages, which include pages for engaging in conversations with virtual objects; When dialogue content is detected being sent to the virtual object, the target animation to be executed when the virtual object responds to the dialogue content is determined; Detect the canvas used for animation in the current application file; When a target canvas is detected, it is determined that there is no need to download canvas node data from the Internet or create a new canvas. The cached target canvas can be directly called to play the animation. The animation file of the target animation is detected in the cache. The target canvas is a canvas that already exists in the current application to implement the animation. The target canvas is a general canvas applicable to all LOTIE animations, or a canvas corresponding to the dialogue content sent by the user. When the presence of the target animation file in the cache is detected, the target animation file is retrieved from the cache; When the virtual object is detected to provide content feedback in response to the dialogue content, the animation file of the target animation is loaded into the target canvas, and the target animation is played on the conversation page according to the loaded target canvas; The method includes: pre-caching some frequently used animation files in the terminal's cache; when the target animation to be executed when responding to dialogue content is determined, first searching in the terminal's cache to detect whether the target animation file exists in the cache; when the target animation file is detected in the cache, the terminal retrieves the target animation file from the cache; when the target animation file is not detected in the cache, the terminal checks in the temporary file area of the mini-program to determine whether the target animation file exists in the temporary file area of the mini-program; when the target animation file is found in the temporary file area of the mini-program, the terminal retrieves the target animation file from the temporary file area of the mini-program; when the target animation file is not found in the temporary file area of the mini-program, the target animation file is downloaded from the network. The step of loading the animation file of the target animation into the target canvas includes: When the target canvas contains animation content, delete the file in memory corresponding to the animation content; Update the target animation to the target canvas.
2. The method according to claim 1, characterized in that, The method further includes: When no canvas is detected, retrieve the canvas node; Create a canvas based on the obtained canvas nodes; The target animation is played on the session page based on the created canvas.
3. The method according to claim 1, characterized in that, The step of determining the target animation to be executed when the virtual object responds to the dialogue content includes: Determine the feedback content corresponding to the dialogue content based on the dialogue content; Determine the target animation corresponding to the feedback content.
4. The method according to claim 3, characterized in that, Determining the target animation corresponding to the feedback content includes: Semantic extraction is performed on the feedback content to obtain the semantic information of the feedback content; The target animation corresponding to the feedback content is determined based on the semantic information.
5. The method according to claim 1, characterized in that, The method further includes: When it is detected that the animation file of the target animation does not exist in the cache, the temporary file area of the application is checked; When the temporary file area is detected to contain the animation file of the target animation, the animation file of the target animation is extracted from the temporary file area.
6. The method according to claim 5, characterized in that, The method further includes: When it is detected that the animation file of the target animation does not exist in the temporary file area, the network storage address of the target animation is obtained; Download the animation file of the target animation according to the network storage address of the target animation.
7. The method according to claim 1, characterized in that, The target canvas includes a canvas within the Lotte framework, and loading the animation file of the target animation into the target canvas includes: Identify the animation loading component in the Lottie framework used for animation loading; The animation loading component loads the animation file of the target animation into the target canvas.
8. The method according to claim 7, characterized in that, The target animation is a target lottie animation, and retrieving the animation file of the target animation from the cache includes: Identify the file extraction component within the Lottie framework used to extract animation files; The file extraction component extracts the animation file of the target Lottie animation.
9. The method according to claim 7, characterized in that, The method further includes: When no canvas is detected, retrieve the canvas node; Identify the canvas creation component within the Lottie framework used to create the canvas; Components are created using the canvas and canvases are created based on the canvas nodes.
10. The method according to claim 6, characterized in that, The step of downloading the animation file of the target animation according to the network storage address of the target animation includes: Download the target file corresponding to the network storage address according to the network storage address; If the file tag corresponding to the target file does not exist in the cache, generate the target file tag corresponding to the target file; Store the target file and cache the target file tag in the cache.
11. The method according to claim 10, characterized in that, The method further includes: If a current file tag corresponding to the target file exists in the cache, determine the current file corresponding to the file tag that is already stored in the terminal; If the target file is inconsistent with the current file, delete the current file; Store the target file.
12. An animation processing device, characterized in that, include: A display unit is used to display the application's session page, which includes a page for interacting with virtual objects; The determining unit is configured to determine the target animation to be executed when the virtual object responds to the dialogue content after detecting that dialogue content has been sent to the virtual object. The first detection unit is used to detect the canvas used to implement animation in the current application file; The second detection unit is used to determine, when a target canvas is detected, that there is no need to download canvas node data from the Internet or create a new canvas, and the target canvas in the cache can be directly called for animation playback. The target canvas is the animation file of the target animation in the cache. The target canvas is a canvas that already exists in the current application for implementing the animation. The target canvas is a general canvas applicable to all LOTIE animations, or a canvas corresponding to the dialogue content sent by the user. An extraction unit is configured to extract the animation file of the target animation from the cache when the existence of the animation file of the target animation is detected in the cache; The playback unit is used to load the animation file of the target animation into the target canvas when the virtual object provides content feedback in response to the dialogue content, and play the target animation in the conversation page according to the loaded target canvas; The extraction unit is specifically used to pre-cache some frequently used animation files in the terminal's cache. When the target animation to be executed when responding to the dialogue content is determined, the terminal first searches in the cache to check if the target animation file exists. If the target animation file is found in the cache, the terminal extracts the target animation file from the cache. If the target animation file is not found in the cache, the terminal checks the temporary file area of the mini-program to determine if the target animation file exists in the mini-program's temporary file area. If the target animation file is found in the mini-program's temporary file area, the terminal extracts the target animation file from the mini-program's temporary file area. If the target animation file is not found in the mini-program's temporary file area, the terminal downloads the target animation file from the network. The playback unit is specifically used to: when there is animation content in the target canvas, delete the file corresponding to the animation content in memory; and update the target animation to the target canvas.
13. A terminal, characterized in that, The method includes a processor and a memory, wherein the memory stores at least one instruction, which is loaded and executed by the processor to implement the steps of the animation processing method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the animation processing method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Animation processing method and device and storage medium
CN108010112A
Animation display method and mobile terminal
CN109660859A
Data processing method and device, electronic equipment and computer storage medium
CN111488186A