Animation rendering method, device, electronic device and storage medium
By analyzing the style attributes in the animation start view and the end view and combining the target animation duration, the whole style attributes of the target view element are determined, which solves the problems of large amount of data, complex operation, low efficiency and poor fluency during the animation rendering process, and realizes the problem of large amount of data, complex operation, low efficiency and poor fluency. More efficient and smooth animation rendering.
Patent Information
- Application Number
- CN202210343845.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-03-31
AI Technical Summary
In the prior art, the data volume is large, the operation is complex, the efficiency is low, and the animation fluency is poor.
By parsing the style attributes in the animation start view and the end view from the animation configuration information, and combining the target animation duration, the whole style attributes of the target view element are determined, thereby rendering the target animation.
It effectively reduces the amount of data for animation configuration analysis, improves the convenience and efficiency of animation configuration analysis, and improves the operation convenience, rendering efficiency and animation fluency of animation rendering.
Smart Images

Figure CN114862996B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of animation production technology, and in particular to an animation rendering method, device, electronic device and storage medium. Background Art
[0002] With the development of animation technology, animation has been widely used in many fields. On the Internet, animation is often placed in a certain area of a web page to emphasize a certain content, thereby better improving the user experience.
[0003] In the related technologies, animations are generally produced using multiple layers, and it is necessary to pre-configure the rendering information of multiple layers in each frame of the animation view; then, it is necessary to parse the rendering attribute information from the rendering configuration information layer by layer and frame by frame, and then combine the parsed rendering attribute information to perform layer by layer and frame by frame rendering to achieve animation rendering production. The rendering configuration information in the above-mentioned related technologies is complex and has a large amount of data, which results in the need to parse the rendering attribute information required for animation rendering layer by layer and frame by frame during the animation rendering process, resulting in complex operations, low efficiency, and poor animation fluency during the animation rendering process. Summary of the invention
[0004] The present disclosure provides an animation rendering method, device, electronic device and storage medium to at least solve the problems of large amount of data processed by animation rendering in related technologies, complex operation, low efficiency and poor animation fluency during animation rendering. 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 an animation rendering method, comprising:
[0006] Parsing the start style attribute of at least one first view element in the animation start view, the end style attribute of at least one second view element in the animation end view, and the target animation duration from the animation configuration information;
[0007] Based on the start style attribute and the end style attribute, determine the start and end style attributes of the target view element, the target view element being the element union of the at least one first view element and the at least one second view element; the start and end style attributes of the target view element include the style attributes of the target view element in the animation start view and the style attributes of the target view element in the animation end view;
[0008] Render the target animation based on the start and end style attributes and the target animation duration.
[0009] In an optional embodiment, rendering the target animation based on the start and end style attributes and the target animation duration includes:
[0010] Create an animation rendering executor that matches the local operating system;
[0011] The target animation is rendered based on the animation rendering executor, the start and end style attributes and the target animation duration.
[0012] In an optional embodiment, rendering the target animation based on the animation rendering executor, the start and end style attributes and the target animation duration includes:
[0013] Controlling the animation rendering executor to generate style attribute change information of the target view element within the target animation duration based on the start and end style attributes;
[0014] The animation rendering executor is controlled to render the target animation based on the style attribute change information.
[0015] In an optional embodiment, the style attribute change information includes change information of multiple attributes within the duration of the target animation; and controlling the animation rendering executor to render the target animation based on the style attribute change information includes:
[0016] The animation rendering executor is controlled to render the view corresponding to the target view element within the target animation duration based on the change information of the multiple attributes within the target animation duration to obtain the target animation.
[0017] In an optional embodiment, the method further includes:
[0018] comparing the at least one first view element and the at least one second view element to obtain a comparison result;
[0019] When the comparison result indicates that the at least one first view element and the at least one second view element are inconsistent, determining the start and end style attributes of the target view element based on the start style attribute and the end style attribute includes:
[0020] Determine a shared view element and a non-shared view element in the target view element;
[0021] Determine, based on a preset style attribute and a target style attribute of the non-shared view element, a start and end style attribute corresponding to the non-shared view element, wherein the target style attribute is a start style attribute or an end style attribute of the non-shared view element;
[0022] The start and end style attributes of the shared view element are determined according to the start style attribute of the shared view element and the end style attribute of the shared view element.
[0023] In an optional embodiment, when the comparison result indicates that the at least one first view element is consistent with the at least one second view element, determining the start and end style attributes of the target view element based on the start style attribute and the end style attribute includes:
[0024] The start style attribute of the target view element and the end style attribute of the target view element are used as the start and end style attributes of the target view element.
[0025] In an optional embodiment, parsing the start style attribute of at least one first view element in the animation start view, the end style attribute of at least one second view element in the animation end view, and the target animation duration from the animation configuration information includes:
[0026] The animation configuration information is parsed to obtain a starting view element tree corresponding to the animation starting view, an ending view element tree corresponding to the animation ending view, and the target animation duration; the starting view element tree is a structure tree with view elements in the animation starting view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation starting view as node hierarchy relationships; the ending view element tree is a structure tree with view elements in the animation ending view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation ending view as node hierarchy relationships;
[0027] Acquire a starting style attribute of the at least one first view element from the starting view element tree;
[0028] From the end view element tree, obtain the end style attribute of the at least one second view element.
[0029] In an optional embodiment, acquiring the starting style attribute of the at least one first view element from the starting view element tree includes:
[0030] Traversing the nodes in the starting view element tree to obtain the at least one first view element;
[0031] In the process of traversing the nodes in the starting view element tree, obtaining a style attribute corresponding to the first currently traversed node;
[0032] The style attribute corresponding to the first currently traversed node is used as the starting style attribute of the view element corresponding to the first currently traversed node in the at least one first view element.
[0033] In an optional embodiment, acquiring the end style attribute of the at least one second view element from the end view element tree includes:
[0034] Traversing the nodes in the end view element tree to obtain the at least one second view element;
[0035] In the process of traversing the nodes in the end view element tree, obtaining a style attribute corresponding to the second currently traversed node;
[0036] The style attribute corresponding to the second currently traversed node is used as the ending style attribute of the view element corresponding to the second currently traversed node in the at least one second view element.
[0037] According to a second aspect of an embodiment of the present disclosure, there is provided an animation rendering device, comprising:
[0038] A data acquisition module is configured to parse the animation configuration information to obtain a start style attribute of at least one first view element in the animation start view, an end style attribute of at least one second view element in the animation end view, and a target animation duration;
[0039] a start-end style attribute determination module, configured to determine the start-end style attributes of a target view element based on the start style attribute and the end style attribute, wherein the target view element is a union of the at least one first view element and the at least one second view element; the start-end style attributes of the target view element include the style attributes of the target view element in the animation start view and the style attributes of the target view element in the animation end view;
[0040] The target animation rendering module is configured to render the target animation based on the start and end style attributes and the target animation duration.
[0041] In an optional embodiment, the target animation rendering module includes:
[0042] An animation rendering executor creation unit is configured to execute creation of an animation rendering executor matching a local operating system;
[0043] The target animation rendering unit is configured to render the target animation based on the animation rendering executor, the start and end style attributes and the target animation duration.
[0044] In an optional embodiment, the target animation rendering unit includes:
[0045] A style attribute change information generating unit is configured to execute and control the animation rendering executor to generate style attribute change information of the target view element within the target animation duration based on the start and end style attributes;
[0046] The target animation rendering subunit is configured to execute and control the animation rendering executor to render the target animation based on the style attribute change information.
[0047] In an optional embodiment, the style attribute change information includes change information of multiple attributes within the target animation duration; the target animation rendering subunit is specifically configured to execute: control the animation rendering executor, and based on the change information of the multiple attributes within the target animation duration, render the view corresponding to the target view element within the target animation duration to obtain the target animation.
[0048] In an optional embodiment, the device further comprises:
[0049] a view element comparison module, configured to compare the at least one first view element with the at least one second view element to obtain a comparison result;
[0050] When the comparison result indicates that the at least one first view element and the at least one second view element are inconsistent, the start-end style attribute determination module includes:
[0051] A view element determining unit, configured to determine a shared view element and a non-shared view element in the target view element;
[0052] A first start-end style attribute determining unit is configured to determine the start-end style attributes corresponding to the non-shared view element based on a preset style attribute and a target style attribute of the non-shared view element, wherein the target style attribute is a start style attribute or an end style attribute of the non-shared view element;
[0053] The second start-end style attribute determining unit is configured to determine the start-end style attributes of the shared view element according to the start style attribute of the shared view element and the end style attribute of the shared view element.
[0054] In an optional embodiment, when the comparison result indicates that the at least one first view element is consistent with the at least one second view element, the start-end style attribute determination module includes:
[0055] The third start and end style attribute determining unit is configured to execute the start style attribute of the target view element and the end style attribute of the target view element as the start and end style attributes of the target view element.
[0056] In an optional embodiment, the data acquisition module includes:
[0057] a parsing and processing unit configured to perform parsing processing on the animation configuration information to obtain a starting view element tree corresponding to the animation starting view, an ending view element tree corresponding to the animation ending view, and the target animation duration; the starting view element tree is a structure tree with view elements in the animation starting view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation starting view as node hierarchy relationships; and the ending view element tree is a structure tree with view elements in the animation ending view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation ending view as node hierarchy relationships;
[0058] A starting style attribute acquisition unit, configured to acquire a starting style attribute of the at least one first view element from the starting view element tree;
[0059] The end style attribute acquisition unit is configured to acquire the end style attribute of the at least one second view element from the end view element tree.
[0060] In an optional embodiment, the initial style attribute obtaining unit includes:
[0061] A first node traversal unit, configured to traverse the nodes in the starting view element tree to obtain the at least one first view element;
[0062] A first style attribute acquisition unit is configured to acquire a style attribute corresponding to a first currently traversed node during the process of traversing the nodes in the starting view element tree;
[0063] The starting style attribute determining unit is configured to use the style attribute corresponding to the first currently traversed node as the starting style attribute of the view element corresponding to the first currently traversed node in the at least one first view element.
[0064] In an optional embodiment, the end style attribute obtaining unit includes:
[0065] A second node traversal unit is configured to traverse the nodes in the end view element tree to obtain the at least one second view element;
[0066] A second style attribute acquisition unit is configured to acquire a style attribute corresponding to a second currently traversed node during the process of traversing the nodes in the end view element tree;
[0067] The end style attribute determining unit is configured to use the style attribute corresponding to the second currently traversed node as the end style attribute of the view element corresponding to the second currently traversed node in the at least one second view element.
[0068] 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.
[0069] 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.
[0070] 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 one of the methods described in the first aspect of the embodiment of the present disclosure.
[0071] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0072] During the animation rendering process, the animation rendering is achieved by parsing the starting style attributes of at least one first view element in the animation starting view, the ending style attributes of at least one second view element in the animation ending view, and the target animation duration from the animation configuration information. This can effectively reduce the amount of data for animation configuration parsing and improve the convenience and efficiency of animation configuration parsing. The description of animation rendering data is performed in combination with the style attributes of the view elements in the animation starting and ending views, which can greatly improve the simplicity of the animation view description, thereby better improving the operational convenience, rendering efficiency, and animation fluency of animation rendering.
[0073] 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
[0074] 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.
[0075] Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment;
[0076] Figure 2 is a flowchart of an animation rendering method according to an exemplary embodiment;
[0077] Figure 3A flowchart of parsing a start style attribute of at least one first view element in an animation start view, an end style attribute of at least one second view element in an animation end view, and a target animation duration from animation configuration information according to an exemplary embodiment;
[0078] Figure 4 is a flowchart showing a method of determining the start and end style attributes of a target view element based on the start style attribute and the end style attribute according to an exemplary embodiment;
[0079] Figure 5 It is a flowchart showing a method of rendering a target animation based on the start and end style attributes and the target animation duration according to an exemplary embodiment;
[0080] Figure 6 is a schematic diagram of a partial view of a target animation provided according to an exemplary embodiment;
[0081] Figure 7 is a block diagram of an animation rendering device according to an exemplary embodiment;
[0082] Figure 8 It is a block diagram of an electronic device for animation rendering according to an exemplary embodiment. DETAILED DESCRIPTION
[0083] 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.
[0084] 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.
[0085] 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.
[0086] 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 .
[0087] The terminal 100 can be used to provide business services to any user and render animations related to the business services. Specifically, the terminal 100 may include but is not limited to mobile electronic devices such as smart phones, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, etc., and may also be software running on the above mobile 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, etc.
[0088] In an optional embodiment, the server 200 may provide background services for the terminal 100. Specifically, the server 200 may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers.
[0089] 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.
[0090] 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.
[0091] Figure 2 is a flowchart of an animation rendering method according to an exemplary embodiment. Figure 2 As shown, the animation rendering method is used in a terminal electronic device and includes the following steps.
[0092] In step S201, a start style attribute of at least one first view element in an animation start view, an end style attribute of at least one second view element in an animation end view, and a target animation duration are parsed from the animation configuration information;
[0093] In a specific embodiment, the animation configuration information may be rendering configuration information of the animation to be rendered. Optionally, the animation configuration information may be obtained from a server. Specifically, the animation configuration information may be configured based on a preset universal resolution protocol. Optionally, the preset universal resolution protocol may be a pre-set resolution protocol adapted to multiple operating systems. Specifically, the multiple operating systems may include Android system, IOS system, etc.
[0094] Specifically, at least one first view element may be a view element in the animation start view, and the start style attribute of at least one first view element may be a style attribute of at least one first view element in the animation start view. The at least one second view element may be a view element in the animation end view, and the end style attribute of at least one second view element may be a style attribute of at least one second view element in the animation end view. Specifically, the target animation duration may be a preset playback duration of the animation to be rendered.
[0095] In a specific embodiment, the style attribute of the view element may be an attribute that can characterize the display state of the view element in the page. Optionally, the style attribute may include multiple attributes, such as the width, height, transparency, and coordinates of the view element.
[0096] In an optional embodiment, if Figure 3 As shown, the above-mentioned parsing the starting style attribute of at least one first view element in the animation starting view, the ending style attribute of at least one second view element in the animation ending view, and the target animation duration from the animation configuration information may include:
[0097] In step S2011, the animation configuration information is parsed to obtain a start view element tree corresponding to the animation start view, an end view element tree corresponding to the animation end view, and a target animation duration.
[0098] In a specific embodiment, the start view element tree may be a structure tree with view elements in the animation start view mounted with style attributes as nodes and view hierarchical relationships between view elements in the animation start view as node hierarchical relationships. The end view element tree may be a structure tree with view elements in the animation end view mounted with style attributes as nodes and view hierarchical relationships between view elements in the animation end view as node hierarchical relationships.
[0099] In a specific embodiment, the terminal may be pre-set with a parser, which may be used to parse the animation configuration information in combination with a preset general parsing protocol to obtain a starting view element tree corresponding to the animation starting view, an ending view element tree corresponding to the animation ending view, and a target animation duration.
[0100] In step S2013, a starting style attribute of at least one first view element is obtained from the starting view element tree.
[0101] In an optional embodiment, the above-mentioned obtaining the starting style attributes of at least one first view element from the starting view element tree may include: traversing the nodes in the starting view element tree to obtain at least one first view element; in the process of traversing the nodes in the starting view element tree, obtaining the style attributes corresponding to the first currently traversed node; using the style attributes corresponding to the first currently traversed node as the starting style attributes of the view element corresponding to the first currently traversed node in at least one first view element.
[0102] In a specific embodiment, the first currently traversed node may be the node currently traversed from the starting view element tree. Specifically, the nodes in the starting view element tree may be traversed in order starting from the root node to determine the view element in the animation starting view, and during the traversal process, the style attribute corresponding to the currently traversed node may be used as the starting style attribute of the view element corresponding to the node.
[0103] In the above embodiment, by traversing the nodes in the starting view element tree, the starting style attributes of the view elements can be obtained while determining the view elements in the animation starting view, which greatly improves the efficiency and accuracy of obtaining the style attributes of the view elements in the animation starting view.
[0104] In step S2015, the end style attribute of at least one second view element is obtained from the end view element tree.
[0105] In an optional embodiment, the above-mentioned obtaining the ending style attributes of at least one second view element from the ending view element tree may include: traversing the nodes in the ending view element tree to obtain at least one second view element; in the process of traversing the nodes in the ending view element tree, obtaining the style attributes corresponding to the second currently traversed node; using the style attributes corresponding to the second currently traversed node as the ending style attributes of the view element corresponding to the second currently traversed node in at least one second view element.
[0106] In a specific embodiment, the second current traversal node may be the node currently traversed from the end view element tree. Specifically, the nodes in the end view element tree may be traversed in order starting from the root node to determine the view element in the animation end view, and during the traversal process, the style attribute corresponding to the currently traversed node may be used as the starting style attribute of the view element corresponding to the node.
[0107] In the above embodiment, by traversing the nodes in the end view element tree, the starting style attributes of the view elements can be obtained while determining the view elements in the animation end view, which greatly improves the efficiency and accuracy of obtaining the style attributes of the view elements in the animation end view.
[0108] In an optional embodiment, when the view elements in the animation start view and the animation end view are the same, at least one first view element and at least one second view element traversed in order can be placed in the corresponding stack structure in order, thereby improving the orderliness of the data.
[0109] In the above embodiment, the animation configuration information is parsed into a structure tree in which view elements with style attributes mounted on them are nodes and the view hierarchy relationship between view elements is the node hierarchy relationship. This can greatly improve the simplicity of the animation view description, thereby reducing the computing resource consumption during the animation rendering process and improving device performance.
[0110] In step S203, the start and end style attributes of the target view element are determined based on the start style attribute and the end style attribute.
[0111] In a specific embodiment, the above-mentioned target view element may be the union of at least one first view element and at least one second view element; the start and end style attributes of the above-mentioned target view element may include the style attributes of the target view element in the animation start view and the style attributes of the target view element in the animation end view.
[0112] In an optional embodiment, the view elements in the animation start view and the animation end view may be the same or different. Accordingly, the above method may further include:
[0113] Comparing at least one first view element and at least one second view element to obtain a comparison result;
[0114] Optionally, when the comparison result indicates that at least one first view element and at least one second view element are inconsistent, such as Figure 4 As shown, the above-mentioned determination of the start and end style attributes of the target view element based on the start style attribute and the end style attribute may include the following steps:
[0115] In step S2031, a shared view element and a non-shared view element in the target view element are determined;
[0116] In step S2033, based on the preset style attribute and the target style attribute of the non-shared view element, the start and end style attributes corresponding to the non-shared view element are determined;
[0117] In step S2035 , the start and end style attributes of the shared view element are determined according to the start style attribute of the shared view element and the end style attribute of the shared view element.
[0118] In a specific embodiment, the shared view element may be a view element included in both the animation start view and the animation end view; the non-shared view element may be a view element included in the animation start view or the animation end view. Specifically, the target style attribute may be a start style attribute or an end style attribute of the non-shared view element. Specifically, the preset style attribute may be a transparency of 0.
[0119] In a specific embodiment, the non-shared view element may include one or more view elements. Optionally, when any view element in the non-shared view elements is a view element in the animation start view, the target style attribute of the view element may be the start style attribute; accordingly, the preset style attribute may be used as the end style attribute of the view element. Optionally, when any view element in the non-shared view elements is a view element in the animation end view, the target style attribute of the view element may be the end style attribute; accordingly, the preset style attribute may be used as the start style attribute of the view element.
[0120] In an optional embodiment, when the comparison result indicates that at least one first view element and at least one second view element are consistent, the above-mentioned determination of the start and end style attributes of the target view element based on the start style attribute and the end style attribute includes: using the start style attribute of the target view element and the end style attribute of the target view element as the start and end style attributes of the target view element.
[0121] In a specific embodiment, when the comparison result indicates that at least one first view element and at least one second view element are consistent, it can be determined that the view elements in the animation start view and the animation end view are consistent. Accordingly, the start style attribute of the target view element and the end style attribute of the target view element can be used as the start and end style attributes of the target view element.
[0122] In the above embodiment, when the comparison result indicates that at least one first view element and at least one second view element are inconsistent, by determining the shared view elements and non-shared view elements in the target view element, the start and end style attributes of the target view element can be determined more specifically in combination with the preset style attributes, and when the comparison result indicates that at least one first view element and at least one second view element are consistent, the start style attribute of the target view element and the end style attribute of the target view element are directly used as the start and end style attributes of the target view element, thereby improving the accuracy and effectiveness of the determined start and end style attributes, and also better coping with different animation rendering scenarios.
[0123] In step S205, the target animation is rendered based on the start and end style attributes and the target animation duration.
[0124] In a specific embodiment, the target animation may be an animation that needs to be rendered.
[0125] In an optional embodiment, if Figure 5 As shown, based on the start and end style attributes and the target animation duration, rendering the target animation may include the following steps:
[0126] In step S2051, an animation rendering executor matching the local operating system is created;
[0127] In step S2053, the target animation is rendered based on the animation rendering executor, the start and end style attributes and the target animation duration.
[0128] In a specific embodiment, when an animation rendering executor matching the local operating system is created, the animation rendering executor can be called to render the target animation in combination with the start and end style attributes of the target view element and the target animation duration.
[0129] In the above embodiment, by creating an animation rendering executor that matches the local operating system to render the target animation, the local operating system can be better adapted, thereby improving the adaptability and efficiency of the animation rendering operation.
[0130] In an optional embodiment, the above-mentioned rendering of the target animation based on the animation rendering executor, the start and end style attributes and the target animation duration may include: controlling the animation rendering executor to generate style attribute change information of the target view element within the target animation duration based on the start and end style attributes; controlling the animation rendering executor to render the target animation based on the style attribute change information.
[0131] In an optional embodiment, the style attribute change information of the target view element within the target animation duration may be a style attribute change curve of the target view element within the target animation duration. The style attribute change curve may record the style attributes corresponding to the target view element at each moment.
[0132] In a specific embodiment, a linear relationship between time and style attributes can be set in the above-mentioned animation rendering executor. Accordingly, the linear relationship and the start and end attributes of the target view element can be combined to generate style attribute change information of the target view element within the target animation duration, and then the target animation can be rendered in combination with the style attribute change information.
[0133] In the above embodiment, the style attribute change information of the target view element within the target animation duration is generated in combination with the start and end style attributes, which can clearly and intuitively represent the style attributes of the target view element within the target animation duration, and then the target animation can be quickly rendered in combination with the style attribute change information.
[0134] In an optional embodiment, the style attributes may include multiple attributes, and accordingly, the change information of the multiple attributes within the target animation duration may be determined in combination with the linear relationship between the multiple attributes and time. Optionally, in the case where the above-mentioned style attribute change information includes the change information of the multiple attributes within the target animation duration, the above-mentioned control of the animation rendering executor to render the target animation based on the style attribute change information may include: controlling the animation rendering executor to render the view corresponding to the target view element within the target animation duration based on the change information of the multiple attributes within the target animation duration to obtain the target animation.
[0135] In a specific embodiment, the view corresponding to the target view element may be a view of the target view element in the page.
[0136] In the above embodiment, when the style attribute includes multiple attributes, combined with the change information of the multiple attributes within the target animation duration, the multiple attributes of the target view element within the target animation duration can be clearly and intuitively represented, and the target animation can be quickly rendered.
[0137] In a specific embodiment, Figure 6 As shown, Figure 6 is a schematic diagram of a partial view of a target animation provided according to an exemplary embodiment. Optionally, when an animation play instruction is triggered, the start style attribute of the view element in the animation start view, the end style attribute of the view element in the animation end view and the target animation duration can be parsed from the animation configuration information; optionally, combined with Figure 6 a, the animation start view of the target animation, the view elements in the animation start view may include a background element 601, an avatar element 602, a text element 603 and a button element 604; Figure 6c is the animation end view of the target animation, the view elements in the animation end view may include background element 601, avatar element 602, text element 603, button element 604 and text element 605, and accordingly, it can be determined that the target view elements may include background element 601, avatar element 602, text element 603, button element 604 and text element 605; optionally, since the animation end view adds text element 605 relative to the animation start view, the preset style attributes may be used as the style attributes of the text element 605 in the animation start view, and the start and end style attributes of the background element 601, avatar element 602, text element 603, button element 604 and text element 605 are generated. ; Next, the style attribute change information of the background element 601, the avatar element 602, the text element 603, the button element 604 and the text element 605 within the target animation duration can be determined by combining the respective start and end style attributes of the background element 601, the avatar element 602, the text element 603, the button element 604 and the text element 605; further, the view corresponding to the background element 601, the avatar element 602, the text element 603, the button element 604 and the text element 605 (target view element) within the target animation duration can be dyed in combination with the style attribute change information of the background element 601, the avatar element 602, the text element 603, the button element 604 and the text element 605 within the target animation duration; optionally, in combination with Figure 6 As shown in b, the view elements of the animation intermediate view (an animation view between the animation start view and the animation end view) of the target animation are consistent with the view elements in the animation start view, but the style attributes have changed.
[0138] It can be seen from the technical solutions provided in the above embodiments of this specification that, in the animation rendering process in this specification, the starting style attributes of at least one first view element in the animation starting view, the ending style attributes of at least one second view element in the animation ending view, and the target animation duration are parsed from the animation configuration information to achieve animation rendering, which can effectively reduce the amount of data for animation configuration parsing and improve the convenience and efficiency of animation configuration parsing; and the description of animation rendering data is performed in combination with the style attributes of the view elements in the animation starting and ending views, which can greatly improve the simplicity of the animation view description, thereby better improving the operational convenience, rendering efficiency and animation fluency of animation rendering.
[0139] Figure 7 is a block diagram of an animation rendering device according to an exemplary embodiment. Figure 7 , the device comprises:
[0140] The data acquisition module 710 is configured to parse the animation configuration information to obtain the starting style attribute of at least one first view element in the animation starting view, the ending style attribute of at least one second view element in the animation ending view, and the target animation duration;
[0141] The start and end style attribute determination module 720 is configured to determine the start and end style attributes of the target view element based on the start style attribute and the end style attribute, where the target view element is an element union of at least one first view element and at least one second view element; the start and end style attributes of the target view element include the style attributes of the target view element in the animation start view and the style attributes of the target view element in the animation end view;
[0142] The target animation rendering module 730 is configured to render the target animation based on the start and end style attributes and the target animation duration.
[0143] In an optional embodiment, the target animation rendering module 730 includes:
[0144] An animation rendering executor creation unit is configured to execute creation of an animation rendering executor matching a local operating system;
[0145] The target animation rendering unit is configured to render the target animation based on the animation rendering executor, the start and end style attributes and the target animation duration.
[0146] In an optional embodiment, the target animation rendering unit includes:
[0147] The style attribute change information generating unit is configured to execute the control animation rendering executor to generate style attribute change information of the target view element within the target animation duration based on the start and end style attributes;
[0148] The target animation rendering subunit is configured to execute the control animation rendering executor and render the target animation based on the style attribute change information.
[0149] In an optional embodiment, the style attribute change information includes change information of multiple attributes within the target animation duration; the target animation rendering subunit is specifically configured to execute: control the animation rendering executor, based on the change information of multiple attributes within the target animation duration, render the view corresponding to the target view element within the target animation duration, and obtain the target animation.
[0150] In an optional embodiment, the above device further includes:
[0151] A view element comparison module, configured to compare at least one first view element with at least one second view element to obtain a comparison result;
[0152] When the comparison result indicates that at least one first view element and at least one second view element are inconsistent, the start-end style attribute determination module 720 includes:
[0153] A view element determining unit, configured to determine shared view elements and non-shared view elements in the target view elements;
[0154] A first start and end style attribute determining unit is configured to determine the start and end style attributes corresponding to the non-shared view element based on the preset style attribute and the target style attribute of the non-shared view element, where the target style attribute is the start style attribute or the end style attribute of the non-shared view element;
[0155] The second start and end style attribute determining unit is configured to determine the start and end style attributes of the shared view element according to the start style attribute of the shared view element and the end style attribute of the shared view element.
[0156] In an optional embodiment, when the comparison result indicates that at least one first view element and at least one second view element are consistent, the start-end style attribute determination module 720 includes:
[0157] The third start and end style attribute determination unit is configured to execute the start style attribute of the target view element and the end style attribute of the target view element as the start and end style attributes of the target view element.
[0158] In an optional embodiment, the data acquisition module 710 includes:
[0159] The parsing processing unit is configured to perform parsing processing on the animation configuration information to obtain a starting view element tree corresponding to the animation starting view, an ending view element tree corresponding to the animation ending view, and a target animation duration; the starting view element tree is a structure tree with view elements in the animation starting view mounted with style attributes as nodes and view hierarchical relationships between view elements in the animation starting view as node hierarchical relationships; the ending view element tree is a structure tree with view elements in the animation ending view mounted with style attributes as nodes and view hierarchical relationships between view elements in the animation ending view as node hierarchical relationships;
[0160] A starting style attribute acquisition unit, configured to acquire a starting style attribute of at least one first view element from a starting view element tree;
[0161] The end style attribute acquisition unit is configured to acquire the end style attribute of at least one second view element from the end view element tree.
[0162] In an optional embodiment, the initial style attribute obtaining unit includes:
[0163] A first node traversal unit is configured to traverse the nodes in the starting view element tree to obtain at least one first view element;
[0164] A first style attribute acquisition unit is configured to acquire a style attribute corresponding to a first currently traversed node during the process of traversing the nodes in the starting view element tree;
[0165] The starting style attribute determining unit is configured to use the style attribute corresponding to the first currently traversed node as the starting style attribute of the view element corresponding to the first currently traversed node in at least one first view element.
[0166] In an optional embodiment, the end style attribute obtaining unit includes:
[0167] A second node traversal unit is configured to execute traversal of nodes in the end view element tree to obtain at least one second view element;
[0168] A second style attribute acquisition unit is configured to acquire a style attribute corresponding to a second currently traversed node during the process of traversing the nodes in the end view element tree;
[0169] The end style attribute determining unit is configured to use the style attribute corresponding to the second currently traversed node as the end style attribute of the view element corresponding to the second currently traversed node in at least one second view element.
[0170] 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.
[0171] Figure 8 is a block diagram of an electronic device for animation rendering 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, an animation rendering 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.
[0172] 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.
[0173] 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 animation rendering method as in the embodiment of the present disclosure.
[0174] 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 animation rendering method in the embodiment of the present disclosure.
[0175] 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 animation rendering method in the embodiment of the present disclosure.
[0176] 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).
[0177] 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.
[0178] 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. An animation rendering method, characterized in that: include: Parsing the start style attribute of at least one first view element in the animation start view, the end style attribute of at least one second view element in the animation end view, and the target animation duration from the animation configuration information; Determine, based on the start style attribute and the end style attribute, the start and end style attributes of a target view element, where the target view element is an element union of the at least one first view element and the at least one second view element; The start and end style attributes of the target view element include the style attributes of the target view element in the animation start view and the style attributes of the target view element in the animation end view; In a case where the comparison result between the at least one first view element and the at least one second view element indicates that the at least one first view element and the at least one second view element are inconsistent, the determining the start and end style attributes of the target view element based on the start style attribute and the end style attribute comprises: determining a shared view element and a non-shared view element in the target view element; Determine the start and end style attributes corresponding to the non-shared view element based on a preset style attribute and a target style attribute of the non-shared view element, wherein the target style attribute is a start style attribute or an end style attribute of the non-shared view element; determine the start and end style attributes of the shared view element according to the start style attribute of the shared view element and the end style attribute of the shared view element; Render the target animation based on the start and end style attributes and the target animation duration.
2. The animation rendering method according to claim 1, characterized in that: The rendering of the target animation based on the start and end style attributes and the target animation duration includes: Create an animation rendering executor that matches the local operating system; The target animation is rendered based on the animation rendering executor, the start and end style attributes and the target animation duration.
3. The animation rendering method according to claim 2, characterized in that: The rendering of the target animation based on the animation rendering executor, the start and end style attributes and the target animation duration comprises: Controlling the animation rendering executor to generate style attribute change information of the target view element within the target animation duration based on the start and end style attributes; The animation rendering executor is controlled to render the target animation based on the style attribute change information.
4. The animation rendering method according to claim 3, characterized in that: The style attribute change information includes change information of multiple attributes within the duration of the target animation; and the controlling the animation rendering executor to render the target animation based on the style attribute change information includes: The animation rendering executor is controlled to render the view corresponding to the target view element within the target animation duration based on the change information of the multiple attributes within the target animation duration to obtain the target animation.
5. The animation rendering method according to any one of claims 1 to 4, characterized in that: When the comparison result indicates that the at least one first view element is consistent with the at least one second view element, determining the start and end style attributes of the target view element based on the start style attribute and the end style attribute includes: The start style attribute of the target view element and the end style attribute of the target view element are used as the start and end style attributes of the target view element.
6. The animation rendering method according to any one of claims 1 to 4, characterized in that: The step of parsing the start style attribute of at least one first view element in the animation start view, the end style attribute of at least one second view element in the animation end view, and the target animation duration from the animation configuration information includes: The animation configuration information is parsed to obtain a starting view element tree corresponding to the animation starting view, an ending view element tree corresponding to the animation ending view, and the target animation duration; the starting view element tree is a structure tree with view elements in the animation starting view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation starting view as node hierarchy relationships; the ending view element tree is a structure tree with view elements in the animation ending view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation ending view as node hierarchy relationships; Acquire a starting style attribute of the at least one first view element from the starting view element tree; From the end view element tree, obtain the end style attribute of the at least one second view element.
7. The animation rendering method according to claim 6, characterized in that: The acquiring the starting style attribute of the at least one first view element from the starting view element tree comprises: Traversing the nodes in the starting view element tree to obtain the at least one first view element; In the process of traversing the nodes in the starting view element tree, obtaining a style attribute corresponding to the first currently traversed node; The style attribute corresponding to the first currently traversed node is used as the starting style attribute of the view element corresponding to the first currently traversed node in the at least one first view element.
8. The animation rendering method according to claim 6, characterized in that: The acquiring the end style attribute of the at least one second view element from the end view element tree comprises: Traversing the nodes in the end view element tree to obtain the at least one second view element; In the process of traversing the nodes in the end view element tree, obtaining a style attribute corresponding to the second currently traversed node; The style attribute corresponding to the second currently traversed node is used as the ending style attribute of the view element corresponding to the second currently traversed node in the at least one second view element.
9. An animation rendering device, characterized in that: include: A data acquisition module is configured to parse the animation configuration information to obtain a start style attribute of at least one first view element in the animation start view, an end style attribute of at least one second view element in the animation end view, and a target animation duration; a start-end style attribute determination module, configured to determine the start-end style attributes of a target view element based on the start style attribute and the end style attribute, wherein the target view element is an element union of the at least one first view element and the at least one second view element; The start and end style attributes of the target view element include the style attributes of the target view element in the animation start view and the style attributes of the target view element in the animation end view; In the case where the comparison result between the at least one first view element and the at least one second view element indicates that the at least one first view element and the at least one second view element are inconsistent, the start-end style attribute determination module includes: a view element determination unit, configured to determine the shared view element and the non-shared view element in the target view element; a first start-end style attribute determination unit, configured to determine the start-end style attributes corresponding to the non-shared view element based on a preset style attribute and a target style attribute of the non-shared view element, wherein the target style attribute is a start style attribute or an end style attribute of the non-shared view element; a second start-end style attribute determination unit, configured to determine the start-end style attributes of the shared view element according to the start style attribute of the shared view element and the end style attribute of the shared view element; The target animation rendering module is configured to render the target animation based on the start and end style attributes and the target animation duration.
10. The animation rendering device according to claim 9, characterized in that: The target animation rendering module includes: An animation rendering executor creation unit is configured to execute creation of an animation rendering executor matching a local operating system; The target animation rendering unit is configured to render the target animation based on the animation rendering executor, the start and end style attributes and the target animation duration.
11. The animation rendering device according to claim 10, characterized in that: The target animation rendering unit comprises: A style attribute change information generating unit is configured to execute and control the animation rendering executor to generate style attribute change information of the target view element within the target animation duration based on the start and end style attributes; The target animation rendering subunit is configured to execute and control the animation rendering executor to render the target animation based on the style attribute change information.
12. The animation rendering device according to claim 11, characterized in that: The style attribute change information includes change information of multiple attributes within the target animation duration; the target animation rendering sub-unit is specifically configured to execute: control the animation rendering executor, and based on the change information of the multiple attributes within the target animation duration, render the view corresponding to the target view element within the target animation duration to obtain the target animation.
13. The animation rendering device according to any one of claims 9 to 12, characterized in that: When the comparison result indicates that the at least one first view element is consistent with the at least one second view element, the start-end style attribute determination module includes: The third start and end style attribute determining unit is configured to execute the start style attribute of the target view element and the end style attribute of the target view element as the start and end style attributes of the target view element.
14. The animation rendering device according to any one of claims 9 to 12, characterized in that: The data acquisition module comprises: a parsing and processing unit configured to perform parsing processing on the animation configuration information to obtain a starting view element tree corresponding to the animation starting view, an ending view element tree corresponding to the animation ending view, and the target animation duration; the starting view element tree is a structure tree with view elements in the animation starting view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation starting view as node hierarchy relationships; and the ending view element tree is a structure tree with view elements in the animation ending view mounted with style attributes as nodes and view hierarchy relationships between view elements in the animation ending view as node hierarchy relationships; A starting style attribute acquisition unit, configured to acquire a starting style attribute of the at least one first view element from the starting view element tree; The end style attribute acquisition unit is configured to acquire the end style attribute of the at least one second view element from the end view element tree.
15. The animation rendering device according to claim 14, characterized in that: The starting style attribute acquisition unit includes: A first node traversal unit, configured to traverse the nodes in the starting view element tree to obtain the at least one first view element; A first style attribute acquisition unit is configured to acquire a style attribute corresponding to a first currently traversed node during the process of traversing the nodes in the starting view element tree; The starting style attribute determining unit is configured to use the style attribute corresponding to the first currently traversed node as the starting style attribute of the view element corresponding to the first currently traversed node in the at least one first view element.
16. The animation rendering device according to claim 14, characterized in that: The end style attribute acquisition unit includes: A second node traversal unit is configured to traverse the nodes in the end view element tree to obtain the at least one second view element; A second style attribute acquisition unit is configured to acquire a style attribute corresponding to a second currently traversed node during the process of traversing the nodes in the end view element tree; The end style attribute determining unit is configured to use the style attribute corresponding to the second currently traversed node as the end style attribute of the view element corresponding to the second currently traversed node in the at least one second view element.
17. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the animation rendering method according to any one of claims 1 to 8.
18. 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 animation rendering method as claimed in any one of claims 1 to 8.
19. A computer program product comprising computer instructions, characterized in that When the method is executed on a computer, the computer is enabled to execute the animation rendering method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Webpage rendering method and device and electronic equipment
CN114139083A
Coordinating animations and media in computer display output
US20060103655A1