Page display method, device, electronic device, storage medium and product
By obtaining animation configuration information and independently rendering the target animation layer, the problem of low animation rendering efficiency is solved and efficient animation rendering effect is achieved.
Patent Information
- Application Number
- CN202111574041.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-12-21
AI Technical Summary
In the prior art, the animation rendering method has a large amount of calculation and low efficiency, resulting in poor animation rendering efficiency.
By obtaining the animation configuration information of the animation page, determine the target animation layer and its configuration objects, render the target display elements independently, and avoid rendering of non-current display elements.
It effectively reduces the calculation amount of animation rendering, improves animation rendering efficiency, and prevents animation lag.
Smart Images

Figure CN114463474B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of page display technology, and in particular to a page display method, device, electronic device, storage medium and product. Background Art
[0002] In order to realize animation with animation effect in terminal application (Application, APP), animation generation technology can be applied, for example, Lottie animation generation technology is applied to apply Lottie animation in APP.
[0003] In the related art, the terminal creates a view for the entire animation based on the animation file of the animation, which is used to play the animation on the page. When the terminal needs to render the animation, the terminal needs to pre-load all the animation resources and configuration information of the entire animation corresponding to the view to render the animation, and then play the above animation on the page. As a result, the animation rendering method in the above related art has the problems of large calculation amount and low animation rendering efficiency. Summary of the invention
[0004] The present disclosure provides a page display method, device, electronic device, storage medium and product to at least solve the problem of large amount of calculation and low efficiency of animation rendering in the related art. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a page display method, including:
[0006] Get the animation configuration information of the animation to be displayed in the animation page;
[0007] Based on the animation configuration information, determining a target number of target animation layers corresponding to the animation page, wherein the target display elements corresponding to the target number of target animation layers are the elements currently displayed in the animation page;
[0008] Obtaining the configuration objects corresponding to the target animation layers, wherein the configuration objects are used to load and render display elements in the animation layers;
[0009] Based on the configuration object, the target presentation element is displayed on the animation page.
[0010] In one possible design, the animation configuration information includes carousel animation identification information, and the method further includes:
[0011] When the carousel animation identification information indicates that the animation to be displayed includes a carousel animation, determining a carousel animation layer corresponding to the carousel animation;
[0012] A first number of carousel animation configuration objects corresponding to the carousel animation layer is created, the number of layers of the carousel animation layer is greater than or equal to the first number, and the carousel animation configuration object is used to load and render the carousel display elements in the carousel animation layer.
[0013] In a possible design, the target number of target animation layers includes a second number of carousel animation layers corresponding to the carousel display elements currently displayed in the animation page, the target display elements include carousel display elements corresponding to each of the second number of carousel animation layers, and obtaining the configuration objects corresponding to each of the target animation layers includes:
[0014] Determine, from the first number of carousel animation configuration objects, carousel animation configuration objects corresponding to the second number of carousel animation layers, wherein the first number is greater than or equal to the second number;
[0015] The step of displaying the target display element on the animation page based on the configuration object includes:
[0016] Based on the carousel animation configuration objects corresponding to the second number of carousel animation layers, the carousel display elements corresponding to the second number of carousel animation layers are displayed on the animation page.
[0017] In a possible design, the second number of carousel animation layers includes the first carousel animation layer, and the method further includes:
[0018] When the first carousel display element corresponding to the first carousel animation layer is displayed, the first carousel animation configuration object corresponding to the first carousel animation layer is used as the carousel animation configuration object corresponding to the second carousel animation layer, and the second carousel animation layer is the carousel animation layer corresponding to the second carousel display element displayed after the first carousel display element.
[0019] In a possible design, displaying the target display element on the animation page based on the configuration object further includes:
[0020] Based on the first carousel animation configuration object, the second carousel display element is displayed on the animation page.
[0021] In one possible design, the method further includes:
[0022] Create configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
[0023] In a possible design, the animation configuration information includes display configuration information, and determining a target number of target animation layers corresponding to the animation page based on the animation configuration information includes:
[0024] Based on the display configuration information, determine the current display position information of the display element in the animation to be displayed;
[0025] Determining a target display element of the animation page based on the current display position information;
[0026] Based on the animation layer corresponding to the target display element, the target number of target animation layers is obtained.
[0027] In a possible design, determining the target display element of the animation page based on the current display position information includes:
[0028] In a case where the current display position information indicates that the display element is located within the screen, the display element is determined as the target display element.
[0029] In a possible design, displaying the target display element on the animation page based on the configuration object includes:
[0030] Based on the configuration objects corresponding to the animation layers in the animation playing state among the target number of target animation layers, obtaining the first media resources corresponding to the animation layers in the animation playing state;
[0031] Based on the first media resource, a display element corresponding to the animation layer in the animation playing state is displayed on the animation page.
[0032] In a possible design, displaying the target display element on the animation page based on the configuration object further includes:
[0033] Based on the configuration objects corresponding to the animation layers in the static state among the target number of target animation layers, obtaining the second media resources corresponding to the animation layers in the static state from the cache;
[0034] Based on the second media resource, a display element corresponding to the animation layer in the static state is displayed on the animation page.
[0035] In a possible design, displaying the target display element on the animation page based on the configuration object includes:
[0036] Based on the configuration object, determining first layer configuration information corresponding to each of the target number of target animation layers in the current animation frame, and second layer configuration information corresponding to each of the target number of target animation layers in the previous animation frame;
[0037] Performing matching processing on the first layer configuration information and the second layer configuration information to obtain a matching result;
[0038] The target animation layer with a difference in matching results among the target number of target animation layers is used as the first animation layer;
[0039] Obtaining a third media resource corresponding to the first animation layer;
[0040] Based on the third media resource, a display element corresponding to the first animation layer is displayed on the animation page.
[0041] In a possible design, displaying the target display element on the animation page based on the configuration object further includes:
[0042] The target animation layer whose matching result shows no difference among the target number of target animation layers is used as the second animation layer;
[0043] Based on the second layer configuration information corresponding to the second animation layer, the display element corresponding to the second animation layer is displayed on the animation page.
[0044] According to a second aspect of an embodiment of the present disclosure, there is provided a page display device, including:
[0045] A configuration information acquisition module is configured to execute the acquisition of animation configuration information of the animation to be displayed in the animation page;
[0046] A target layer determination module is configured to determine a target number of target animation layers corresponding to the animation page based on the animation configuration information, wherein the target display elements corresponding to the target number of target animation layers are the elements currently displayed in the animation page;
[0047] A configuration object acquisition module is configured to execute acquisition of configuration objects corresponding to the target animation layers, wherein the configuration objects are used to load display elements in the rendering animation layer;
[0048] The page display module is configured to display the target display element on the animation page based on the configuration object.
[0049] In a possible design, the animation configuration information includes carousel animation identification information, and the device further includes:
[0050] a carousel animation determination module, configured to determine a carousel animation layer corresponding to the carousel animation when the carousel animation identification information indicates that the animation to be displayed includes a carousel animation;
[0051] The configuration object creation module is configured to execute the creation of a first number of carousel animation configuration objects corresponding to the carousel animation layer, the number of layers of the carousel animation layer is greater than or equal to the first number, and the carousel animation configuration object refers to the carousel display element used to load and render the carousel animation layer.
[0052] In a possible design, the target number of target animation layers includes a second number of carousel animation layers corresponding to the carousel display elements currently displayed in the animation page, the target display elements include carousel display elements corresponding to each of the second number of carousel animation layers, and the configuration object acquisition module includes:
[0053] A configuration object allocating unit is configured to determine, from the first number of carousel animation configuration objects, the carousel animation configuration objects corresponding to the second number of carousel animation layers, wherein the first number is greater than or equal to the second number;
[0054] The page display module includes:
[0055] The carousel element display unit is configured to execute the carousel animation configuration objects corresponding to the second number of carousel animation layers, and display the carousel display elements corresponding to the second number of carousel animation layers on the animation page.
[0056] In a possible design, the second number of carousel animation layers includes the first carousel animation layer, and the configuration object allocation unit is further configured to execute:
[0057] When the first carousel display element corresponding to the first carousel animation layer is displayed, the first carousel animation configuration object corresponding to the first carousel animation layer is used as the carousel animation configuration object corresponding to the second carousel animation layer, and the second carousel animation layer is the carousel animation layer corresponding to the second carousel display element displayed after the first carousel display element.
[0058] In a possible design, the carousel element display unit is further configured to execute:
[0059] Based on the first carousel animation configuration object, the second carousel display element is displayed on the animation page.
[0060] In a possible design, the configuration object creation module is further configured to execute:
[0061] Create configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
[0062] In a possible design, the animation configuration information includes display configuration information, and the target layer determination module includes:
[0063] an element position determining unit, configured to determine current display position information of the display element in the animation to be displayed based on the display configuration information;
[0064] a display element determination unit, configured to determine a target display element of the animation page based on the current display position information;
[0065] The target layer determination unit is configured to execute the animation layer corresponding to the target display element to obtain the target number of target animation layers.
[0066] In a possible design, the display element determination unit is specifically configured to execute:
[0067] In a case where the current display position information indicates that the display element is located within the screen, the display element is determined as the target display element.
[0068] In a possible design, the page display module includes:
[0069] A media resource acquisition unit is configured to execute a configuration object corresponding to an animation layer in an animation playing state among the target number of target animation layers, and acquire a first media resource corresponding to the animation layer in an animation playing state;
[0070] The display element display unit is configured to display the display element corresponding to the animation layer in the animation playing state on the animation page based on the first media resource.
[0071] In a possible design, the media resource acquisition unit is configured to execute, based on the configuration object corresponding to the animation layer in the target number of target animation layers in a stationary state, acquire the second media resource corresponding to the animation layer in a stationary state from the cache;
[0072] The display element display unit is further configured to display, on the animation page, the display element corresponding to the animation layer in the static state based on the second media resource.
[0073] In a possible design, the page display module includes:
[0074] A layer information determination unit is configured to determine, based on the configuration object, first layer configuration information corresponding to each of the target number of target animation layers in the current animation frame, and second layer configuration information corresponding to each of the target number of target animation layers in the previous animation frame;
[0075] a layer information matching unit, configured to perform matching processing on the first layer configuration information and the second layer configuration information to obtain a matching result;
[0076] The first layer determination unit is configured to execute the target animation layer with a difference in the matching result among the target number of target animation layers as the first animation layer;
[0077] A media resource acquisition unit, configured to acquire a third media resource corresponding to the first animation layer;
[0078] The display element display unit is configured to display the display element corresponding to the first animation layer on the animation page based on the third media resource.
[0079] In a possible design, the page display module further includes:
[0080] The second layer determination unit is configured to execute the target animation layer whose matching result shows no difference among the target number of target animation layers as the second animation layer;
[0081] The display element display unit is further configured to display the display element corresponding to the second animation layer on the animation page based on the second layer configuration information corresponding to the second animation layer.
[0082] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement a method as described in any one of the above-mentioned first aspects.
[0083] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any method described in the first aspect of the embodiment of the present disclosure.
[0084] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect of the embodiment of the present disclosure.
[0085] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0086] During the animation rendering process, the target animation layer corresponding to the current display element in the animation page is determined according to the animation configuration information of the animation to be displayed, and the configuration objects corresponding to each target animation layer are obtained. Based on the configuration objects corresponding to each target animation layer, the target display elements corresponding to each target animation layer can be rendered in the animation page, and independent rendering of the target display elements corresponding to each target animation layer can be achieved. This ensures that only the current display element needs to be rendered during the animation rendering process, and there is no need to render non-current display elements, which effectively reduces the amount of calculation required for animation rendering and effectively improves animation rendering efficiency.
[0087] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0089] Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment;
[0090] Figure 2 A process of a page display method according to an exemplary embodiment is shown Figure 1 ;
[0091] Figure 3 A process of a page display method according to an exemplary embodiment is shown Figure 2 ;
[0092] Figure 4 A process of a page display method according to an exemplary embodiment is shown Figure 3 ;
[0093] Figure 5 A process of a page display method according to an exemplary embodiment is shown Figure 4 ;
[0094] Figure 6 A schematic diagram of a process of loading an animation of an application is shown as an example;
[0095] Figure 7 is a block diagram of a page display device according to an exemplary embodiment;
[0096] Figure 8 The invention is a block diagram of an electronic device for page display according to an exemplary embodiment. DETAILED DESCRIPTION
[0097] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0098] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0099] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0100] See also Figure 1 , Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment. Figure 1 As shown, the application environment may include a terminal 100 and a server 200 .
[0101] Applications can be installed in the terminal 100, and the corresponding application page can be displayed to any user. Optionally, the application page includes animation. Specifically, the terminal 100 may include but is not limited to electronic devices such as smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc., and may also be software running on the above electronic devices, such as applications. Optionally, the operating system running on the electronic device may include but is not limited to Android system, IOS system, Linux, Windows, etc.
[0102] In an optional embodiment, the server 200 can provide background services for the terminal 100. Specifically, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0103] In addition, it should be noted that Figure 1 What is shown is only one application environment provided by the present disclosure. In actual application, other application environments may also be included, for example, more terminals may be included.
[0104] In the embodiments of this specification, the terminal 100 and the server 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in this disclosure.
[0105] Figure 2 A process of a page display method according to an exemplary embodiment is shown Figure 1 ,like Figure 2 As shown, the page display method is used in a terminal electronic device and includes the following steps (S210-S240).
[0106] Step S210: Obtain animation configuration information of the animation to be displayed in the animation page.
[0107] The animation page is a page that can display animations. For example, the animation page is an application page of an application.
[0108] The animation to be displayed is an animation displayed in the animation page. The animation to be displayed may be a Lottie animation. Lottie is a library that supports Android, iOS, and ReactNative and uses JSON (JavaScript Object Notation) files to achieve animation effects.
[0109] The animation to be displayed includes multiple animation frames. Each animation frame in an animation can be formed by the superposition of multiple animation layers (i.e., animation layers). The layers in the animation are similar to a stack of transparent papers, each with a different picture on it, and stacking these papers together forms a more complex picture.
[0110] Optionally, the animation to be displayed has a corresponding timeline. The timeline is used to organize and control the changes and actions of the animation. The number of animation frames and the position of each frame can be identified through the timeline. For example, each scale in the timeline represents a frame, and the number on it represents the sequence number of the frame.
[0111] The animation to be displayed has a corresponding animation file. The animation file can be generated and exported through graphics software or video software. Optionally, the animation designed by the animation designer is exported through a plug-in of the graphics software or video software to form the above animation file. Optionally, the animation file includes a data file and an image file, wherein the image file includes multiple pictures. The data file includes structural data, layer data and element data. Among them, the structural data includes the width and height of the animation canvas, background color, time, start frame, end frame, number of frames, etc. The layer data includes each layer of the animation (such as shape layer, text layer, light layer, etc.) and the frames included in each layer. Each frame can be regarded as a sublayer of the corresponding layer. The frames (sublayers) in the same layer are synthesized to obtain the layer, and each layer can be superimposed to obtain the corresponding animation. The element data includes the information of the elements in each layer, and each element corresponds to a layer. For example, for the element of text, the data file can include attribute data such as the size, color, font, etc. of the text; for the element of picture, the data file can include attribute data such as the name, storage path, width and height of the picture.
[0112] The animation file can be in the form of a JSON file. JSON is a lightweight data exchange format. The animation file can be placed on the server and sent to the client when the client calls it. The animation file can also be placed directly on the client.
[0113] The client can parse the animation file and obtain the animation configuration information of the animation to be displayed. For example, the client asynchronously loads the animation file into the memory, which does not occupy the main thread and reduces the computing pressure. The client can also cache the animation file, so that the next time the animation file is reused, it does not need to be parsed again.
[0114] The animation configuration information can be used to be called when playing the animation. The animation configuration information may include but is not limited to resource information, layer information, font information and other information. Among them, other information can be understood as information that does not affect the animation synthesis, such as name information.
[0115] Assets can provide media resources for layers. Assets can include media resources associated with display elements corresponding to each animation layer. The above media resources can correspond to a resource path identifier. The application can call the corresponding media resources according to the above resource path identifier. The above media resources include but are not limited to media types such as pictures, videos, and audio.
[0116] Layer information (layers) may include information of one or more layers. Layer information may include information of multiple layers. Layer information may include resource reference identifier, time parameter information, size information, layer transformation attribute information, etc. Time parameter information may include animation start frame, animation end frame and start time, etc. Size information may include width information and height information. Layer transformation attribute information may include anchor point attribute information, position attribute information, transparency attribute information, transformation rotation attribute information, scaling attribute information, anchor point attribute information, etc.
[0117] Step S220: determining a target number of target animation layers corresponding to the animation page based on the animation configuration information.
[0118] The target display elements corresponding to the above target number of target animation layers are the elements currently displayed in the animation page.
[0119] Animation layers are like a stack of transparent paper. Each animation layer corresponds to different display elements. Stacking the display elements corresponding to each animation layer together forms a more complex picture. If a display element is placed at a certain position in the previous animation layer, the display element at the same position in the next animation layer may be blocked and cannot be displayed on the screen. If a display element is not placed at a certain position in the previous animation layer, the display element at the same position in the next animation layer will not be blocked, and the display element at the same position in the next animation layer can be seen at that position in the previous animation layer. Each layer in the animation is independent of each other.
[0120] The above-mentioned current display element refers to the display element that can be displayed in the animation page. For example, the animation page displays the picture corresponding to the current animation frame, and the above-mentioned current display element is the display element displayed in the animation page at the moment corresponding to the current animation frame. The obscured display element does not belong to the current display element.
[0121] The target display element can be obtained by determining whether the display element in each animation layer is the current display element currently displayed in the animation page. The animation layer corresponding to the target display element is the target animation layer. The target animation layer refers to the animation layer in which the display element in the layer is displayed in the animation page at the current moment. The target number is a variable value, which is a positive integer greater than or equal to 0. Optionally, the target number is the number of animation layers corresponding to the current display element displayed in the animation page at the current moment.
[0122] In an exemplary embodiment, the animation configuration information includes display configuration information. The display configuration information is used to indicate the display information of the display element corresponding to the animation layer. The display configuration information includes the display position information corresponding to the display element at each moment during the animation process.
[0123] Correspondingly, such as Figure 3 As shown, the implementation process of the above step S220 may include the following steps (S221-S223): Figure 3 A process of a page display method according to an exemplary embodiment is shown Figure 2 .
[0124] Step S221: Determine the current display position information of the display element in the animation to be displayed based on the display configuration information.
[0125] From the display position information corresponding to each moment of the display element during the animation process, the display position of the display element at the current moment corresponding to the current animation frame is obtained. The current display position information is the display position of the display element at the current moment corresponding to the current animation frame. The above display position can be a coordinate value corresponding to the screen coordinate system.
[0126] Step S222: determining the target display element of the animation page based on the current display position information.
[0127] The target display element is a display element whose display position at the current moment is within the animation page. By judging whether the display position of the display element at the current moment corresponding to the current animation frame is within the animation page, it can be determined whether the display element is the target display element. If it is within the page, it can be determined that the display element is the target display element; if it is not within the page, it can be determined that the display element is a non-target display element.
[0128] In an exemplary embodiment, the implementation process of the above step S222 includes: when the current display position information indicates that the display element is located within the screen, determining the display element as a target display element.
[0129] Step S223: obtaining a target number of target animation layers based on the animation layers corresponding to the target display element.
[0130] The animation layer corresponding to the target display element is the above-mentioned target animation layer.
[0131] By using the current display position information of the display element to determine the target display element currently displayed in the animation page, and determining the target display layer corresponding to the target display element, the target animation layer currently displayed in the animation page among the animation layers in the animation to be displayed can be accurately and timely determined, providing a guarantee for subsequent on-demand rendering of the layer.
[0132] Step S230, obtaining configuration objects corresponding to the target animation layers.
[0133] The above configuration object is used to load the display elements in the rendering animation layer, and the configuration object includes the display element configuration information of the corresponding display element. The above display element configuration information is the configuration information of the display element during the animation process. For example, the display element configuration information includes but is not limited to the position information, size information, scaling information, transparency information, graphic transformation information, anchor point information and other configuration information corresponding to the display element at each moment in the animation process.
[0134] In some application scenarios, the above configuration object is a view in the application. Optionally, each animation layer in the animation to be displayed has a corresponding View. There may be a one-to-one correspondence between the animation layer and the View, or it may not be a one-to-one correspondence, which can be determined according to the application scenario. For example, the display elements between two animation layers are bound to each other, appearing and disappearing at the same time. One View can be used to load and render the display elements corresponding to the two animation layers, reducing the amount of calculation and program complexity. At the same time, the configuration objects corresponding to the animation layers where other display elements are located are independent, which can further improve the efficiency of animation rendering.
[0135] In the related technology, one View is used to correspond to the entire animation, which means that when rendering the animation, the display elements corresponding to all animation layers and the media resources corresponding to all display elements need to be loaded. The display elements in each animation layer cannot be loaded and rendered separately, and the loading of media resources is also in the main thread, which takes up a lot of memory and causes animation effects to freeze. In the technical solution provided in the embodiment of the present disclosure, the configuration objects corresponding to each animation layer in the animation to be displayed are independent and do not affect each other. Each animation layer can be drawn separately and on demand. For some non-current display elements that are not currently displayed on the animation page, there is no need to obtain the configuration object corresponding to the animation layer in which it is located, nor is there any need to execute its rendering process, thereby reducing the amount of animation rendering calculations, improving animation rendering efficiency, and preventing animation freezes.
[0136] Optionally, each of the above target animation layers corresponds to a separate configuration object.
[0137] Before the above step S230, a configuration object corresponding to the animation layer of the animation to be displayed needs to be created. The process of creating the configuration object can refer to the following embodiment.
[0138] In an exemplary embodiment, the animation configuration information includes carousel animation identification information. The above carousel animation identification information can be used as a basis for determining whether the animation to be displayed includes a carousel animation. Figure 3 As shown, the above method also includes the following steps (S250~S260).
[0139] Step S250 , when the carousel animation identification information indicates that the animation to be displayed includes the carousel animation, determining the carousel animation layer corresponding to the carousel animation.
[0140] The above-mentioned carousel animation refers to an animation in which display elements are cyclically displayed on the page at a certain frequency. Optionally, the carousel animation includes a covered carousel animation. In one example, during the playback of the covered carousel animation, the next carousel picture to be displayed can be moved out from the edge of the screen and displayed on top of the current carousel picture until it completely covers the current recorded picture, and then this process is cyclically performed for all carousel pictures. The embodiment of the present application does not limit the type of carousel animation, which can be determined according to the specific scenario.
[0141] The above-mentioned carousel animation identification information includes layer position information and layer size information. In a possible implementation, the first layer size information and first layer position information of the display element corresponding to the current animation layer at the end of the display, as well as the second layer size information and second layer position information of the display element corresponding to the previous animation layer at the end of the display are determined, and it is determined whether the first layer size information and first layer position information of the current animation layer are equal to the second layer size information and second layer position information of the previous animation layer, and whether the current animation layer overlaps the previous animation layer. In the case that the first layer size information and the first layer position information are respectively equal to the second layer size information and the second layer position information, and the current animation layer overlaps the previous animation layer, it is determined that the animation to be displayed includes a carousel animation.
[0142] Furthermore, based on the above-mentioned layer position information and layer size information, the carousel animation layer corresponding to the carousel animation in each animation layer of the animation to be displayed can be determined. For example, according to the above-mentioned judgment method, each animation layer is traversed to determine that the layer size information and layer position information of the display element at the end of the display are the same, and the layer that is cyclically overlapped between layers is the carousel animation layer corresponding to the carousel animation. The embodiment of the present application does not limit the judgment method for judging whether the animation to be displayed includes a carousel animation, and the corresponding judgment method can be determined according to the specific carousel animation type.
[0143] Step S260: creating a first number of carousel animation configuration objects corresponding to the carousel animation layer.
[0144] The number of layers of the carousel animation layer is greater than or equal to the first number. The carousel animation configuration object is used to load and render the carousel display elements in the carousel animation layer.
[0145] In some application scenarios, a carousel animation usually has multiple carousel display elements that need to be displayed in a loop, but an animation page can only display a limited number of carousel display elements at the same time. Therefore, in order to reduce the amount of calculation required for animation rendering, the disclosed embodiment can create a first number of carousel animation configuration objects for the carousel animation layer. The above first number is the maximum number of carousel display elements that can be displayed simultaneously in the animation page. The first number of carousel animation configuration objects can be reused later. The animation layer where the carousel display elements that are not currently displayed are located can be rendered without allocating configuration objects. It only needs to allocate configuration objects for rendering for the animation layer where the carousel display elements that are currently displayed are located, which effectively reduces the amount of calculation required for animation rendering.
[0146] In an exemplary embodiment, for the animation layer corresponding to the non-carousel animation in the animation to be displayed, a corresponding configuration object also needs to be created. Figure 3 As shown, a corresponding configuration object is created for the non-carousel animation layer, and the method further includes step S270.
[0147] Step S270: creating configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
[0148] Non-carousel animation layers refer to animation layers other than the carousel animation layers corresponding to the above carousel animations in the animation layers to be displayed. For non-carousel animation layers, the application can create configuration objects corresponding to each non-carousel animation layer, and can separate the rendering process of each non-carousel animation layer to achieve independent rendering and on-demand rendering of each non-carousel animation layer.
[0149] In an exemplary embodiment, the target number of target animation layers includes a third number of non-carousel animation layers. Figure 3 As shown, the method further includes step S232 and step S240c. Step S232 can be used as a sub-step of step S230.
[0150] Step S232: determining configuration objects corresponding to the third number of non-carousel animation layers.
[0151] The third number of non-rotation animation layers refers to animation layers other than the rotation animation layers in the target number of target animation layers. The display elements corresponding to the third number of non-rotation animation layers belong to the current display elements of the animation page.
[0152] The configuration objects corresponding to the non-carousel animation layers have been created in step S270. Here, the configuration objects corresponding to the third number of non-carousel animation layers can be determined according to the correspondence between the animation layers and the configuration objects. For example, the corresponding configuration objects are determined according to the animation layer identifiers.
[0153] Step S240c: Based on the configuration objects corresponding to the third number of non-carousel animation layers, display elements corresponding to the third number of non-carousel animation layers are displayed on the animation page.
[0154] The configuration objects corresponding to each of the third number of non-carousel animation layers include display configuration information of each of the third number of non-carousel animation layers, specifically including but not limited to layer size information, layer position information, size information, position information, transformation information and other configuration information of display elements within the layer.
[0155] Based on the above display configuration information, display elements corresponding to a third number of non-carousel animation layers are drawn in the animation page.
[0156] In an exemplary embodiment, the target number of target animation layers includes a second number of carousel animation layers corresponding to the carousel display elements currently displayed in the animation page. Accordingly, the target display elements include carousel display elements corresponding to the second number of carousel animation layers. Figure 3 As shown, the implementation process of the above step S230 includes the following sub-step S231.
[0157] Step S231: Determine, from the first number of carousel animation configuration objects, the carousel animation configuration objects corresponding to the second number of carousel animation layers.
[0158] The first quantity is greater than or equal to the second quantity.
[0159] The second number of carousel animation layers refers to the carousel animation layers corresponding to the carousel display elements currently displayed in the animation page. Since the first number is the maximum number of carousel display elements that can be displayed simultaneously in the animation page, the first number is greater than or equal to the second number.
[0160] Optionally, when the first number is equal to the second number, the carousel animation configuration objects may be allocated one by one to the second number of carousel animation layers.
[0161] Optionally, when the first number is greater than the second number, a second number of carousel animation configuration objects may be selected from the first number of carousel animation configuration objects, and the second number of carousel animation configuration objects may be allocated one by one to the second number of carousel animation layers.
[0162] In the case that the target number of target animation layers includes a second number of carousel animation layers, and the target display elements include carousel display elements corresponding to the second number of carousel animation layers, step S240a may be executed.
[0163] Step S240a: Based on the carousel animation configuration objects corresponding to the second number of carousel animation layers, the carousel display elements corresponding to the second number of carousel animation layers are displayed on the animation page.
[0164] The carousel animation configuration objects corresponding to the second number of carousel animation layers respectively include display configuration information of the second number of carousel animation layers respectively, specifically including but not limited to layer size information, layer position information, size information, position information, transformation information and other configuration information of the carousel display elements in the layer.
[0165] Based on the display configuration information, carousel display elements corresponding to each of the second number of carousel animation layers are drawn in the animation page.
[0166] By allocating the corresponding carousel animation configuration objects to each of the second number of carousel animation layers, the carousel display elements corresponding to the currently displayed carousel animation layer are independently rendered, thereby improving the carousel animation rendering efficiency.
[0167] In an exemplary embodiment, the second number of carousel animation layers includes a first carousel animation layer. The first carousel animation layer is any animation layer in the second number of carousel animation layers. When the first carousel display element corresponding to the first carousel animation layer ends display, the configuration object corresponding to the first carousel animation layer can be reallocated to other carousel animation layers to be displayed in the animation page. Figure 3 As shown, the above method also includes the following step S280.
[0168] Step S280, when the first carousel display element corresponding to the first carousel animation layer is displayed, the first carousel animation configuration object corresponding to the first carousel animation layer is used as the carousel animation configuration object corresponding to the second carousel animation layer.
[0169] The first carousel animation layer is any carousel animation layer in the second number of carousel animation layers, and the first carousel display element corresponding to the first carousel animation layer belongs to the current display element in the animation page.
[0170] During the animation display process of the carousel animation, the carousel display elements are displayed alternately in a loop in the animation page. When the carousel display element moves out of the animation page or is covered by other display elements in the animation page, that is, the carousel display element is no longer displayed in the animation page, it can be considered that the display of the carousel display element has ended.
[0171] The configuration object corresponding to the first carousel animation layer where the first carousel display element is located can be called the first carousel animation configuration object. Since the carousel animation configuration object is alternately reused by each carousel animation layer, when the first carousel display element is displayed, the first carousel animation configuration object should be reset and assigned to the next carousel animation layer to be displayed. In this way, the carousel display elements can be rendered on demand, effectively reducing the amount of calculation required for rendering the carousel animation and improving the rendering efficiency of the carousel animation.
[0172] The second carousel animation layer is a carousel animation layer corresponding to the second carousel display element displayed after the first carousel display element. The second carousel animation layer can be a carousel animation layer in the second number of carousel animation layers, or a carousel animation layer outside the second number of carousel animation layers.
[0173] In a possible implementation, the first carousel display element and the second carousel display element may be the same carousel display element. In the case where the first carousel display element and the second carousel display element are the same carousel display element, the correspondence between the first carousel animation configuration object and the first carousel animation layer is maintained without reallocation. Here, an example is used to illustrate the case where the first carousel display element and the second carousel display element are the same carousel display element. The carousel display elements of the carousel animation include carousel display element 1 and carousel display element 2. Carousel display element 1 and carousel display element 2 are displayed cyclically in the animation page. Carousel display element 2 is moved out and displayed above carousel display element 1 until it completely covers carousel display element 1, and carousel display element 1 is displayed. Here, it can be considered that carousel display element 1 is the above-mentioned first carousel display element. Since there are only two carousel display elements, after the display of carousel display element 1 is finished, it is also necessary to move out from above carousel display element 2 and display it in the animation page. Here, carousel display element 1 is the second carousel display element displayed after the above-mentioned first carousel display element, and there is no need to reset and update the configuration object.
[0174] In an exemplary embodiment, if Figure 3 As shown, after the above step S280, step S240b may be executed.
[0175] Step S240b: Based on the first carousel animation configuration object, display the second carousel display element on the animation page.
[0176] Before the first carousel animation configuration object is reset, the first carousel animation configuration object includes the display configuration information of the first carousel animation layer; after the first carousel animation configuration object is reset and assigned to the second carousel animation layer, the first carousel animation configuration object includes the display configuration information of the second carousel animation layer. Therefore, based on the display configuration information of the second carousel animation layer in the first carousel animation configuration object, the second carousel display element is drawn in the animation page. By reusing the carousel animation configuration object, the complexity and calculation amount of the application are effectively reduced, and the rendering efficiency of the carousel animation is effectively improved.
[0177] Step S240: displaying the target display element on the animation page based on the configuration object.
[0178] In an exemplary embodiment, if Figure 4 As shown, the implementation process of the above step 240 may include the following steps (S241-S244): Figure 4 A process of a page display method according to an exemplary embodiment is shown Figure 3 .
[0179] Step S2401: based on the configuration objects corresponding to the animation layers in the animation playing state among the target number of target animation layers, obtain the first media resource corresponding to the animation layers in the animation playing state.
[0180] An animation layer in the animation playing state refers to an animation layer in the animation playing stage at the current animation frame. For example, the animation to be displayed has 100 animation frames, and the animation playing stage of an animation layer in the target number of target animation layers is from the 10th frame to the 30th frame. If the current animation frame is the 20th frame, then the animation layer is in the animation playing state.
[0181] In a possible implementation, it is determined whether the animation layer in the animation playing state is in the animation playing stage in the current animation frame. If so, it means that the animation layer in the animation playing state needs to animate and display the display element in the current animation frame, and it can be further determined whether the display element corresponding to the animation layer in the animation playing state has an associated media resource. The above-mentioned first media resource is a media resource associated with the display element corresponding to the animation layer in the animation playing state. Media resources include but are not limited to media types such as pictures, videos, and audio.
[0182] The reason for judging whether the animation layer in the animation playing state has associated media resources is that if the display element does not have associated media resources, it can be drawn and rendered in the animation page without calling the associated media resources. For example, if the display element is text, it can be directly displayed in the animation page according to the display configuration information such as font information and font size information.
[0183] Therefore, if the display element corresponding to the animation layer in the animation playing state does not have an associated media resource, that is, the above-mentioned first media resource, there is no need to call the first media resource, and the corresponding configuration object is directly rendered to display the display element corresponding to the animation layer in the animation playing state; if the display element corresponding to the animation layer in the animation playing state has an associated media resource, that is, the first media resource, it can be further determined whether the first media resource is in the cache. If so, the first media resource is obtained from the cache; if not, the first media resource is asynchronously loaded into the memory, and the first media resource is cached and stored in the cache pool. The first media resource is directly reused from the cache when it is needed next time, thereby improving efficiency. In addition, the asynchronous loading method does not affect the application process on the main thread, which can reduce the application operation pressure and improve the smoothness of animation playback.
[0184] Step S2402: Based on the first media resource, display elements corresponding to the animation layer in the animation playing state are displayed on the animation page.
[0185] After acquiring the first media resource, corresponding display elements may be drawn in the animation page according to the display configuration information of the animation layer in the configuration object corresponding to the animation layer in the animation playing state.
[0186] The disclosed embodiment determines the method of acquiring media resources by judging the animation state of the animation layer, thereby acquiring media resources on demand to render animations, thereby ensuring the accuracy of animation rendering and effectively reducing the operating pressure of the main thread.
[0187] Step S2403: based on the configuration objects corresponding to the animation layers in the static state among the target number of target animation layers, obtain the second media resource corresponding to the animation layers in the static state from the cache.
[0188] In a possible implementation, it is determined whether the current animation layer is in the animation playing stage in the current animation frame. If not, it means that the current animation layer is not animated in the current animation frame, and the current animation layer is a static animation layer. The media resources associated with the static animation layer have been asynchronously loaded and cached before. Therefore, the second media resource corresponding to the static animation layer can be obtained from the cache to reduce the operating pressure of the main thread.
[0189] Step S2404: Based on the second media resource, display elements corresponding to the animation layer in a static state are displayed on the animation page.
[0190] After acquiring the second media resource, the corresponding display element can be drawn in the animation page according to the display configuration information of the animation layer in the configuration object corresponding to the animation layer in the static state.
[0191] The disclosed embodiment effectively reduces the operating pressure of the main thread of the application program and ensures the smoothness of animation rendering by acquiring the media resources of the animation layer in a static state from the cache.
[0192] In an exemplary embodiment, if Figure 5 As shown, the implementation process of the above step S240 may further include the following steps (S2405-S2411): Figure 5 A process of a page display method according to an exemplary embodiment is shown Figure 4 .
[0193] Step S2405 , based on the configuration object, determining first layer configuration information corresponding to each of the target number of target animation layers in the current animation frame, and second layer configuration information corresponding to each of the target number of target animation layers in the previous animation frame.
[0194] The above configuration object includes the layer configuration information corresponding to the animation layer at each moment. The layer configuration information includes configuration data such as transparency data, rotation data, position data, anchor point data, and scaling data.
[0195] For any animation layer among the target number of target animation layers, the first layer configuration information of the animation layer includes the transparency data, rotation data, position data, anchor point data, scaling data and other configuration data corresponding to the animation layer in the current animation frame. The second layer configuration information of the animation layer includes the transparency data, rotation data, position data, anchor point data, scaling data and other configuration data corresponding to the animation layer in the previous animation frame.
[0196] Step S2406: performing matching processing on the first layer configuration information and the second layer configuration information to obtain a matching result.
[0197] The matching process of the first layer configuration information and the second layer configuration information is to determine whether the first layer configuration information and the second layer configuration information of each animation layer in the target number of target animation layers are the same, that is, to determine whether the animation layer is in a static state. If they are the same, the matching result is that there is no difference between the first layer configuration information and the second layer configuration information, indicating that the animation layer has not changed between the previous animation frame and the current animation frame, and the animation layer is in a static state; if they are not the same, the matching result is that there is a difference between the first layer configuration information and the second layer configuration information, indicating that the animation layer has changed between the previous animation frame and the current animation frame, and the animation layer is in a changing state.
[0198] Step S2407: Among the target number of target animation layers, the target animation layer with a matching result showing a difference is used as the first animation layer.
[0199] The first animation layer is an animation layer in a changing state among the target number of target animation layers.
[0200] Step S2408: Acquire a third media resource corresponding to the first animation layer.
[0201] In a possible implementation, it can be further determined whether the display element corresponding to the current animation layer has associated media resources. The third media resource is a media resource associated with the display element corresponding to the animation layer in a changing state. Media resources include but are not limited to media types such as pictures, videos, and audio.
[0202] The reason for judging whether there is an associated media resource here is that if the display element does not have an associated media resource, it can be drawn and rendered in the animation page without calling the associated media resource. For example, if the display element is text, it can be directly displayed in the animation page according to the display configuration information such as font information and font size information.
[0203] Therefore, if the display element corresponding to the first animation layer does not have associated media resources, there is no need to call the media resources, and the display element corresponding to the first animation layer is directly rendered and displayed according to the configuration object; if the display element corresponding to the first animation layer has associated media resources, that is, the third media resource mentioned above, it can be further determined whether the third media resource is in the cache. If so, the third media resource is obtained from the cache; if not, the third media resource is asynchronously loaded into the memory, and the third media resource is cached and stored in the cache pool. The third media resource is directly reused from the cache when it is needed next time, which improves efficiency. In addition, the asynchronous loading method does not affect the application process on the main thread, which can reduce the application operation pressure and improve the smoothness of animation playback.
[0204] Step S2409: Based on the third media resource, display elements corresponding to the first animation layer are displayed on the animation page.
[0205] After acquiring the third media resource, the corresponding display element may be drawn in the animation page according to the layer configuration information of the animation layer in the configuration object corresponding to the first animation layer.
[0206] The disclosed embodiment determines the animation layer in a changing state that needs to be rendered by detecting whether the animation layer has changed between previous and subsequent animation frames, and obtains its corresponding media resources for corresponding animation rendering, thereby preventing repeated rendering of display elements corresponding to the animation layer, and effectively improving animation rendering efficiency.
[0207] Step S2410: Use the target animation layer with no difference in the matching result among the target number of target animation layers as the second animation layer.
[0208] The second animation layer is an animation layer in a stationary state among the target number of target animation layers.
[0209] Step S2411: Based on the second layer configuration information corresponding to the second animation layer, display elements corresponding to the second animation layer are displayed on the animation page.
[0210] If the animation layer is in a static state, there is no need to repeatedly render the animation layer. The animation page only needs to display the display elements corresponding to the second animation layer. The display elements corresponding to the second animation layer are still displayed according to the display elements corresponding to the second animation layer in the previous animation frame. This realizes on-demand rendering of the display elements corresponding to the animation layer, thereby improving animation rendering efficiency.
[0211] To sum up, in the embodiments provided by the present disclosure, during the animation rendering process, the target animation layer corresponding to the current display element in the animation page is determined according to the animation configuration information of the animation to be displayed, and the configuration objects corresponding to each target animation layer are obtained. Based on the configuration objects corresponding to each target animation layer, the target display elements corresponding to each target animation layer can be rendered in the animation page, so as to achieve independent rendering of the target display elements corresponding to each target animation layer, thereby ensuring that only the current display element needs to be rendered during the animation rendering process, and there is no need to render non-current display elements, which effectively reduces the amount of calculation required for animation rendering and effectively improves the animation rendering efficiency.
[0212] Figure 6 The following is a schematic diagram showing an example of a process flow of an application loading animation. Figure 6 As shown, the application loading animation includes the following steps (S01-S26).
[0213] S01, obtaining an animation file of an animation to be displayed.
[0214] Use animation production software to create the animation to be displayed, and use conversion tools to generate the JSON file of the animation to be displayed.
[0215] The JSON file can be placed on the server and sent to the client by the server. The JSON file can also be placed directly on the client.
[0216] Optionally, the JSON file is set in the client application, and the client can start calling the animation to be displayed according to relevant instructions. Specifically, the client asynchronously loads the JSON file into the memory and caches the JSON file. The cache size is controlled by the business and reused next time without re-parsing.
[0217] S02, parsing the animation file to obtain animation configuration information.
[0218] Generate a composition, that is, the animation configuration information mentioned above, which includes layer information and resource information. Layer information refers to the set of animation information corresponding to each animation layer. For example, the start and end frames of the entire animation, and the animation frame rate. Resource information includes the media resource information required for the animation to be displayed, such as pictures.
[0219] Each animation layer contains its own animation process. For example, the animation start frame is the 20th frame; the animation end frame is the 50th frame. The display elements in the animation layer will animate from the animation start frame to the animation end frame. In addition, the layer information also includes transparency data, rotation data, position data, anchor point data, scaling data and other information, which are used to determine the animation process of the display elements corresponding to the animation layer.
[0220] S03, determining whether there is a carousel animation in the animation to be displayed. If yes, executing from step S04; if no, executing from step S06.
[0221] Specifically, the position where the picture ends, the refresh time, and the animation process are used to determine whether there is a carousel animation in the animation to be displayed. The method for determining the carousel animation has been described in the above embodiment and will not be repeated here.
[0222] S04: Determine the carousel animation layer corresponding to the carousel animation.
[0223] S05: Create a first number of carousel animation configuration objects corresponding to the carousel animation layer.
[0224] In a covered carousel animation, at most two recorded images are displayed on the animation page, so two local layer Views can be created, and the layer animations of different carousel animation layers are subsequently rendered through the above two Views.
[0225] S06: Create configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
[0226] Optionally, create a local layer View (i.e. the above configuration object), bind a non-carousel animation layer to a View, and each View can be refreshed and drawn independently. The View contains the animation information of the non-carousel animation layer.
[0227] S07, in response to a loading instruction of the animation to be displayed, obtaining a current animation frame.
[0228] Start the animation and loop through the animation frames, from the start frame to the end frame.
[0229] Get the current animation frame, and then loop all animation layers corresponding to the current animation frame.
[0230] S08, obtaining the current animation layer of the current animation frame.
[0231] S09, determining whether the display position of the current animation layer in the current animation frame is within the animation page. If yes, executing from step S10; if no, executing from step S17.
[0232] Optionally, the display range of the animation page is the terminal screen range. If the display position of the current animation layer in the current animation frame is not within the screen, it will not be rendered, thereby reducing unnecessary layer rendering and improving animation rendering efficiency.
[0233] S10, determining whether the current animation layer is in the animation playing stage in the current animation frame. If yes, executing from step S11; if no, executing from step S17.
[0234] For animation layers that are not in the animation playback stage but in the animation static stage, they are not rendered repeatedly and the next animation layer is traversed directly.
[0235] S11, determine whether the current animation layer is in a static state. If not, start from step S12; if yes, start from step S17.
[0236] The purpose of judging whether the current animation layer is in a static state is that although some animation layers are in the animation playback stage, the display elements may be static during the animation playback stage. If the display element is static, there is no need to repeatedly render the animation layer, and the next animation layer can be traversed directly. If the display element is not static, it means that the current animation layer needs to be animated and display the display element in the current animation frame. Therefore, after judging whether the current animation layer is in a static state, if so, traverse the next animation layer; if not, it can be further judged whether the display element corresponding to the current animation layer has associated media resources.
[0237] S12, determining whether the display element corresponding to the current animation layer has associated media resources. If yes, executing from step S13; if no, executing from step S17.
[0238] For animation layers that do not have associated media resources, the display elements of the animation layer can be rendered directly according to the corresponding configuration object without calling the media resources again. For example, the animation layer corresponding to the text display element is an animation layer that does not have associated media resources and can be rendered directly.
[0239] S13, determine whether the associated media resource is in the cache. If yes, execute from step S14; if no, execute from step S15.
[0240] S14, obtaining associated media resources from the cache.
[0241] S15, asynchronously loading associated media resources.
[0242] S16: Based on the associated media resources, display elements corresponding to the current animation layer are displayed on the animation page.
[0243] S17, judging whether the current animation layer is the last animation layer. If not, executing from step S18; if yes, executing from step S19.
[0244] S18, taking the next animation layer of the current animation layer as the current animation layer.
[0245] S19, determine whether the current animation frame is the last frame. If not, execute from step S20; if yes, execute step S21.
[0246] S20: Taking the next animation frame of the current animation frame as the current animation frame.
[0247] S21, stop loading the animation to be displayed.
[0248] Optionally, after the above step S07, the following steps (S22 to S26) may also be included.
[0249] S22, obtaining the next animation frame of the current animation frame.
[0250] S23, determine whether to preload the associated media resources of the next animation frame. If yes, execute from step S24; if no, execute step S26.
[0251] Get the next animation frame and determine whether to preload the associated media resources of the next animation frame. The purpose is to preload media resources, improve rendering efficiency, avoid the client reading associated media resources in the main thread, and solve the problem of main thread freezing.
[0252] S24, determining whether the cache includes the associated media resource of the next animation frame. If not, executing step S25; if yes, executing step S26.
[0253] S25, asynchronously loading the associated media resources of the next animation frame.
[0254] Asynchronously load the associated media resources of the next animation frame and cache them. The associated media resources will be reused directly next time to avoid the client reading the associated media resources in the main thread, solve the problem of main thread jamming, and improve animation rendering efficiency.
[0255] S26, stop preloading the associated media resources of the next animation frame.
[0256] In summary, the embodiments provided by the present disclosure determine the animation layer displayed in the page according to the animation configuration information of the animation to be displayed; do not render the animation layer not displayed in the page, and further determine whether the animation layer displayed in the page is in the animation playing state; do not render repeatedly for the animation layer in the static state, and further determine whether the animation layer in the animation playing state is in the static state; do not render repeatedly for the static animation layer in the animation playing state, and further determine whether the animation layer in the changing state has associated media resources; directly render the animation layer without associated media resources, and further determine whether the associated media resources of the animation layer with associated media resources are in the cache, if so, obtain them from the cache, if not, asynchronously load the associated media resources, and finally display the display elements corresponding to the current animation layer in the page. By allocating independent configuration objects to the animation layers and setting the above judgment logic, the amount of calculation required for rendering the animation can be effectively reduced, unnecessary layer rendering and repeated layer rendering can be avoided, and the media resources can be obtained by asynchronous loading and caching, which reduces the calculation pressure of the main thread of the application, avoids animation jams, and effectively improves the animation rendering efficiency.
[0257] Figure 7 is a block diagram of a page display device according to an exemplary embodiment. Figure 7 , the device 700 comprises:
[0258] The configuration information acquisition module 710 is configured to execute the acquisition of animation configuration information of the animation to be displayed in the animation page;
[0259] The target layer determination module 720 is configured to determine a target number of target animation layers corresponding to the animation page based on the animation configuration information, wherein the target display elements corresponding to the target number of target animation layers are the elements currently displayed in the animation page;
[0260] The configuration object acquisition module 730 is configured to execute acquisition of configuration objects corresponding to the target animation layers, wherein the configuration objects are used to load and render display elements in the animation layers;
[0261] The page display module 740 is configured to display the target display element on the animation page based on the configuration object.
[0262] In an exemplary embodiment, the animation configuration information includes carousel animation identification information, and the device 700 further includes: a carousel animation determination module and a configuration object creation module.
[0263] a carousel animation determination module, configured to determine a carousel animation layer corresponding to the carousel animation when the carousel animation identification information indicates that the animation to be displayed includes a carousel animation;
[0264] The configuration object creation module is configured to execute the creation of a first number of carousel animation configuration objects corresponding to the carousel animation layer, the number of layers of the carousel animation layer is greater than or equal to the first number, and the carousel animation configuration object refers to the carousel display element used to load and render the carousel animation layer.
[0265] In an exemplary embodiment, the target number of target animation layers includes a second number of carousel animation layers corresponding to the carousel display elements currently displayed in the animation page, and the target display elements include the carousel display elements corresponding to each of the second number of carousel animation layers. The configuration object acquisition module 730 includes: a configuration object allocation unit
[0266] The configuration object allocating unit is configured to determine the carousel animation configuration objects corresponding to the second number of carousel animation layers from the first number of carousel animation configuration objects, wherein the first number is greater than or equal to the second number.
[0267] The page display module 740 includes: a carousel element display unit.
[0268] The carousel element display unit is configured to execute the carousel animation configuration objects corresponding to the second number of carousel animation layers, and display the carousel display elements corresponding to the second number of carousel animation layers on the animation page.
[0269] In an exemplary embodiment, the second number of carousel animation layers includes a first carousel animation layer, and the configuration object allocation unit is further configured to execute:
[0270] When the first carousel display element corresponding to the first carousel animation layer is displayed, the first carousel animation configuration object corresponding to the first carousel animation layer is used as the carousel animation configuration object corresponding to the second carousel animation layer, and the second carousel animation layer is the carousel animation layer corresponding to the second carousel display element displayed after the first carousel display element.
[0271] In an exemplary embodiment, the carousel element display unit is further configured to execute:
[0272] Based on the first carousel animation configuration object, the second carousel display element is displayed on the animation page.
[0273] In an exemplary embodiment, the configuration object creation module is further configured to execute:
[0274] Create configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
[0275] In an exemplary embodiment, the animation configuration information includes display configuration information, and the target layer determination module 720 includes: an element position determination unit, a display element determination unit, and a target layer determination unit.
[0276] The element position determining unit is configured to determine the current display position information of the display element in the animation to be displayed based on the display configuration information.
[0277] The display element determination unit is configured to determine a target display element of the animation page based on the current display position information.
[0278] The target layer determination unit is configured to execute the animation layer corresponding to the target display element to obtain the target number of target animation layers.
[0279] In an exemplary embodiment, the display element determination unit is specifically configured to execute:
[0280] In a case where the current display position information indicates that the display element is located within the screen, the display element is determined as the target display element.
[0281] In an exemplary embodiment, the page display module 740 includes: a media resource acquisition unit and a presentation element display unit.
[0282] A media resource acquisition unit is configured to execute a configuration object corresponding to an animation layer in an animation playing state among the target number of target animation layers, and acquire a first media resource corresponding to the animation layer in an animation playing state;
[0283] The display element display unit is configured to display the display element corresponding to the animation layer in the animation playing state on the animation page based on the first media resource.
[0284] In an exemplary embodiment, the media resource acquisition unit is configured to execute configuration objects corresponding to the animation layers in a static state among the target number of target animation layers, and acquire second media resources corresponding to the animation layers in a static state from a cache.
[0285] The display element display unit is further configured to display, on the animation page, the display element corresponding to the animation layer in the static state based on the second media resource.
[0286] In an exemplary embodiment, the page display module 740 includes: a layer information determination unit, a layer information matching unit, a first layer determination unit, a media resource acquisition unit, and a presentation element display unit.
[0287] The layer information determination unit is configured to determine, based on the configuration object, first layer configuration information corresponding to each of the target number of target animation layers in the current animation frame, and second layer configuration information corresponding to each of the target number of target animation layers in the previous animation frame.
[0288] The layer information matching unit is configured to perform matching processing on the first layer configuration information and the second layer configuration information to obtain a matching result.
[0289] The first layer determination unit is configured to execute the target animation layer with a difference in matching results among the target number of target animation layers as the first animation layer.
[0290] The media resource acquisition unit is configured to acquire a third media resource corresponding to the first animation layer.
[0291] The display element display unit is configured to display the display element corresponding to the first animation layer on the animation page based on the third media resource.
[0292] In an exemplary embodiment, the page display module 740 further includes: a second layer determination unit.
[0293] The second layer determination unit is configured to execute the target animation layer whose matching result shows no difference among the target number of target animation layers as the second animation layer.
[0294] The display element display unit is further configured to display the display element corresponding to the second animation layer on the animation page based on the second layer configuration information corresponding to the second animation layer.
[0295] To sum up, in the embodiments provided by the present disclosure, during the animation rendering process, the target animation layer corresponding to the current display element in the animation page is determined according to the animation configuration information of the animation to be displayed, and the configuration objects corresponding to each target animation layer are obtained. Based on the configuration objects corresponding to each target animation layer, the target display elements corresponding to each target animation layer can be rendered in the animation page, so as to achieve independent rendering of the target display elements corresponding to each target animation layer, thereby ensuring that only the current display element needs to be rendered during the animation rendering process, and there is no need to render non-current display elements, which effectively reduces the amount of calculation required for animation rendering and effectively improves the animation rendering efficiency.
[0296] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0297] Figure 8 is a block diagram of an electronic device for page display according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a page display method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0298] Those skilled in the art will understand that Figure 8 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0299] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the page display method in the embodiment of the present disclosure.
[0300] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the page display method in the embodiment of the present disclosure.
[0301] In an exemplary embodiment, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer is enabled to execute the page display method in the embodiment of the present disclosure.
[0302] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0303] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0304] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A page display method, characterized in that: include: Get the animation configuration information of the animation to be displayed in the animation page; Based on the animation configuration information, determining a target number of target animation layers corresponding to the animation page, wherein the target display elements corresponding to the target number of target animation layers are the elements currently displayed in the animation page; Obtaining the configuration objects corresponding to the target animation layers, wherein the configuration objects are used to load and render display elements in the animation layers; Based on the configuration object, displaying the target display element on the animation page; The step of displaying the target display element on the animation page based on the configuration object includes: Based on the configuration object, determining first layer configuration information corresponding to each of the target number of target animation layers in the current animation frame, and second layer configuration information corresponding to each of the target number of target animation layers in the previous animation frame; Performing matching processing on the first layer configuration information and the second layer configuration information to obtain a matching result; The target animation layer with a difference in matching results among the target number of target animation layers is used as the first animation layer; Obtaining a third media resource corresponding to the first animation layer; Based on the third media resource, a display element corresponding to the first animation layer is displayed on the animation page.
2. The page display method according to claim 1, characterized in that: The animation configuration information includes carousel animation identification information, and the method further includes: When the carousel animation identification information indicates that the animation to be displayed includes a carousel animation, determining a carousel animation layer corresponding to the carousel animation; A first number of carousel animation configuration objects corresponding to the carousel animation layer is created, the number of layers of the carousel animation layer is greater than or equal to the first number, and the carousel animation configuration object is used to load and render the carousel display elements in the carousel animation layer.
3. The page display method according to claim 2, characterized in that: The target number of target animation layers includes a second number of carousel animation layers corresponding to the carousel display elements currently displayed in the animation page, the target display elements include carousel display elements corresponding to each of the second number of carousel animation layers, and obtaining the configuration objects corresponding to each of the target animation layers includes: Determine, from the first number of carousel animation configuration objects, carousel animation configuration objects corresponding to the second number of carousel animation layers, wherein the first number is greater than or equal to the second number; The step of displaying the target display element on the animation page based on the configuration object includes: Based on the carousel animation configuration objects corresponding to the second number of carousel animation layers, the carousel display elements corresponding to the second number of carousel animation layers are displayed on the animation page.
4. The page display method according to claim 3, characterized in that: The second number of carousel animation layers includes the first carousel animation layer, and the method further includes: When the first carousel display element corresponding to the first carousel animation layer is displayed, the first carousel animation configuration object corresponding to the first carousel animation layer is used as the carousel animation configuration object corresponding to the second carousel animation layer, and the second carousel animation layer is the carousel animation layer corresponding to the second carousel display element displayed after the first carousel display element.
5. The page display method according to claim 4, characterized in that: The step of displaying the target display element on the animation page based on the configuration object further includes: Based on the first carousel animation configuration object, the second carousel display element is displayed on the animation page.
6. The page display method according to claim 2, characterized in that: The method further comprises: Create configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
7. The page display method according to claim 1, characterized in that: The animation configuration information includes display configuration information, and determining a target number of target animation layers corresponding to the animation page based on the animation configuration information includes: Based on the display configuration information, determine the current display position information of the display element in the animation to be displayed; Determining a target display element of the animation page based on the current display position information; Based on the animation layer corresponding to the target display element, the target number of target animation layers is obtained.
8. The page display method according to claim 7, characterized in that: The determining the target display element of the animation page based on the current display position information includes: In a case where the current display position information indicates that the display element is located within the screen, the display element is determined as the target display element.
9. The page display method according to claim 1, characterized in that: The step of displaying the target display element on the animation page based on the configuration object includes: Based on the configuration objects corresponding to the animation layers in the animation playing state among the target number of target animation layers, obtaining the first media resources corresponding to the animation layers in the animation playing state; Based on the first media resource, a display element corresponding to the animation layer in the animation playing state is displayed on the animation page.
10. The page display method according to claim 9, characterized in that: The step of displaying the target display element on the animation page based on the configuration object further includes: Based on the configuration objects corresponding to the animation layers in the static state among the target number of target animation layers, obtaining the second media resources corresponding to the animation layers in the static state from the cache; Based on the second media resource, a display element corresponding to the animation layer in the static state is displayed on the animation page.
11. The page display method according to claim 10, characterized in that: The step of displaying the target display element on the animation page based on the configuration object further includes: The target animation layer whose matching result shows no difference among the target number of target animation layers is used as the second animation layer; Based on the second layer configuration information corresponding to the second animation layer, the display element corresponding to the second animation layer is displayed on the animation page.
12. A page display device, characterized in that: include: A configuration information acquisition module is configured to execute the acquisition of animation configuration information of the animation to be displayed in the animation page; A target layer determination module is configured to determine a target number of target animation layers corresponding to the animation page based on the animation configuration information, wherein the target display elements corresponding to the target number of target animation layers are the elements currently displayed in the animation page; A configuration object acquisition module is configured to execute acquisition of configuration objects corresponding to the target animation layers, wherein the configuration objects are used to load display elements in the rendering animation layer; A page display module, configured to display the target display element on the animation page based on the configuration object; The page display module includes: A layer information determination unit is configured to determine, based on the configuration object, first layer configuration information corresponding to each of the target number of target animation layers in the current animation frame, and second layer configuration information corresponding to each of the target number of target animation layers in the previous animation frame; a layer information matching unit, configured to perform matching processing on the first layer configuration information and the second layer configuration information to obtain a matching result; The first layer determination unit is configured to execute the target animation layer with a difference in the matching result among the target number of target animation layers as the first animation layer; A media resource acquisition unit, configured to acquire a third media resource corresponding to the first animation layer; The display element display unit is configured to display the display element corresponding to the first animation layer on the animation page based on the third media resource.
13. The page display device according to claim 12, characterized in that: The animation configuration information includes carousel animation identification information, and the device further includes: a carousel animation determination module, configured to determine a carousel animation layer corresponding to the carousel animation when the carousel animation identification information indicates that the animation to be displayed includes a carousel animation; The configuration object creation module is configured to execute the creation of a first number of carousel animation configuration objects corresponding to the carousel animation layer, the number of layers of the carousel animation layer is greater than or equal to the first number, and the carousel animation configuration object refers to the carousel display element used to load and render the carousel animation layer.
14. The page display device according to claim 13, characterized in that: The target number of target animation layers includes a second number of carousel animation layers corresponding to the carousel display elements currently displayed in the animation page, the target display elements include carousel display elements corresponding to each of the second number of carousel animation layers, and the configuration object acquisition module includes: A configuration object allocating unit is configured to determine, from the first number of carousel animation configuration objects, the carousel animation configuration objects corresponding to the second number of carousel animation layers, wherein the first number is greater than or equal to the second number; The page display module includes: The carousel element display unit is configured to execute the carousel animation configuration objects corresponding to the second number of carousel animation layers, and display the carousel display elements corresponding to the second number of carousel animation layers on the animation page.
15. The page display device according to claim 14, characterized in that: The second number of carousel animation layers includes the first carousel animation layer, and the configuration object allocation unit is further configured to execute: When the first carousel display element corresponding to the first carousel animation layer is displayed, the first carousel animation configuration object corresponding to the first carousel animation layer is used as the carousel animation configuration object corresponding to the second carousel animation layer, and the second carousel animation layer is the carousel animation layer corresponding to the second carousel display element displayed after the first carousel display element.
16. The page display device according to claim 15, characterized in that: The carousel element display unit is further configured to execute: Based on the first carousel animation configuration object, the second carousel display element is displayed on the animation page.
17. The page display device according to claim 13, characterized in that: The configuration object creation module is further configured to execute: Create configuration objects corresponding to the non-carousel animation layers in the animation to be displayed.
18. The page display device according to claim 12, characterized in that: The animation configuration information includes display configuration information, and the target layer determination module includes: an element position determining unit, configured to determine current display position information of the display element in the animation to be displayed based on the display configuration information; a display element determination unit, configured to determine a target display element of the animation page based on the current display position information; The target layer determination unit is configured to execute the animation layer corresponding to the target display element to obtain the target number of target animation layers.
19. The page display device according to claim 18, characterized in that: The display element determination unit is specifically configured to execute: In a case where the current display position information indicates that the display element is located within the screen, the display element is determined as the target display element.
20. The page display device according to claim 12, characterized in that: The page display module includes: A media resource acquisition unit is configured to execute a configuration object corresponding to an animation layer in an animation playing state among the target number of target animation layers, and acquire a first media resource corresponding to the animation layer in an animation playing state; The display element display unit is configured to display the display element corresponding to the animation layer in the animation playing state on the animation page based on the first media resource.
21. The page display device according to claim 20, characterized in that: The media resource acquisition unit is configured to execute, based on the configuration object corresponding to the animation layer in the target number of target animation layers in a stationary state, acquire the second media resource corresponding to the animation layer in a stationary state from the cache; The display element display unit is further configured to display, on the animation page, the display element corresponding to the animation layer in the static state based on the second media resource.
22. The page display device according to claim 21, characterized in that: The page display module further includes: The second layer determination unit is configured to execute the target animation layer whose matching result shows no difference among the target number of target animation layers as the second animation layer; The display element display unit is further configured to display the display element corresponding to the second animation layer on the animation page based on the second layer configuration information corresponding to the second animation layer.
23. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instruction to implement the page display method according to any one of claims 1 to 11.
24. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the page display method as claimed in any one of claims 1 to 11.
25. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the page display method according to any one of claims 1 to 11 is implemented.
