Animation effect display method and electronic device

By separating animation effect display tasks between the UI and rendering threads, the method prevents frame freezes and enhances user experience by reducing the UI thread's workload.

JP2024541862AActive Publication Date: 2024-11-13HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
JP2024523250
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-12-14
Filing Date
2022-10-17
Publication Date
2024-11-13
Estimated Expiration
2042-10-17

AI Technical Summary

Technical Problem

Existing electronic devices experience frame freezes or janks due to the UI thread handling computational load for animation effects, leading to a poor user experience.

Method used

The method involves setting properties for animation effects before display, with the UI thread determining control changes and the rendering thread generating bitmaps, reducing the UI thread's workload and preventing frame freezes by measuring, laying out, and drawing the interface independently.

Benefits of technology

This approach ensures smooth animation effects by offloading computational tasks from the UI thread, preventing frame freezes and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024541862000001_ABST
    Figure 2024541862000001_ABST
Patent Text Reader

Abstract

The embodiment of this application provides an animation effect display method and an electronic device, which relate to the field of electronic technology. According to the animation effect display method provided in one embodiment of this application, before the animation effect is displayed, the UI thread of the application or the rendering thread or rendering process of the application determines the control whose property changes during the duration of the animation effect and determines the property of the control on the interface of each frame, and then the rendering thread or rendering process of the application generates a bitmap corresponding to the interface of the frame based on the property of the control on the interface of each frame. Since the properties such as the size and location of the control on the interface of each frame are determined before the animation effect is displayed, the UI thread does not need to measure, layout, and draw and record on the interface of each frame, and therefore the display of the animation effect is not affected by the blocking of the UI thread.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority to Chinese Patent Application No. 202111209898.X, entitled "METHOD FOR SEPARATING ANIMATION FROM UI", filed with the State Intellectual Property Office of the People's Republic of China on October 18, 2021, and to Chinese Patent Application No. 202111526945.3, entitled "ANIMATION EFFECT DISPLAY METHOD AND ELECTRONIC DEVICE", filed with the State Intellectual Property Office of the People's Republic of China on December 14, 2021, both of which are incorporated by reference in their entirety herein.

[0002] This application relates to the field of electronic technology, and in particular to an animation effect display method and electronic device. [Background technology]

[0003] With the development of electronic technology, more and more electronic devices are involved in users' daily lives. Additionally, as the display resolution, size and other parameters of electronic devices become higher, more and more content can be displayed on the electronic devices.

[0004] An application may display animation effects to a user by adjusting properties such as size, width, height, transparency, etc. of controls displayed in the interface.

[0005] However, in the conventional technology, the UI thread needs to take on the computational load and other tasks required to display the animation effect, which can result in frame freezes or jank in applications on electronic devices, resulting in a poor user experience. Summary of the Invention

[0006] The embodiment of this application provides an animation effect display method and an electronic device, which relate to the field of electronic technology. According to the animation effect display method provided in one embodiment of this application, before the animation effect is displayed, the UI thread of the application or the rendering thread or rendering process of the application determines the control whose property changes during the duration of the animation effect and determines the property of the control on the interface of each frame, and then the rendering thread or rendering process of the application generates a bitmap corresponding to the interface of the frame based on the property of the control on the interface of each frame. Since the properties such as the size and location of the control on the interface of each frame are determined before the animation effect is displayed, the UI thread does not need to measure, layout, and draw and record on the interface of each frame, and therefore the display of the animation effect is not affected by the blocking of the UI thread.

[0007] According to a first aspect, an embodiment of the present application provides an animation effect display method, the method includes: after a UI thread of an application receives an animation trigger event, determining descriptive information regarding a duration of the first animation effect, a start time of the first animation effect, and an end frame of the first animation effect based on information regarding a first animation effect of a first group of controls set by the application, the first group of controls including one or more controls, and the animation trigger event is used to trigger display of the first animation effect; when generating display data of a target frame during the duration of the first animation effect, determining descriptive information regarding a target frame based on the descriptive information regarding the start time of the first animation effect, the duration of the first animation effect, a time corresponding to the target frame, and the end frame of the first animation effect; and generating display data of the target frame based on the descriptive information regarding the target frame by a rendering thread or a rendering process of the application.

[0008] In the aforementioned embodiment, during the duration of the animation, the application's rendering thread or rendering process generates an interface based on the descriptive information about the target frame, which is used to determine properties of the controls in the target frame, such as size, location, transparency, etc. During the duration of the animation, the application's rendering thread or rendering process generates the display data for the target frame, and the UI thread does not need to generate the display data for the target frame through measurement, layout, and drawing and recording, which further prevents frame freezes of the animation effect caused by blocking the UI thread.

[0009] With respect to some embodiments of the first aspect, in some embodiments, information regarding the first animation effect is set by the application via an animation interface provided by the system.

[0010] In the above-described embodiment, an application developer can set animation effects for any one or more controls through the animation interface, making it easy for the application developer to set the animation effects.

[0011] With respect to some embodiments of the first aspect, in some embodiments, when generating display data for a target frame during the duration of the first animation effect, determining the descriptive information for the target frame based on the descriptive information for a start time of the first animation effect, the duration of the first animation effect, the time corresponding to the target frame, and the end frame of the first animation effect specifically includes a UI thread or a rendering thread or a rendering process determining the descriptive information for the target frame based on the descriptive information for the start time of the first animation effect, the duration of the first animation effect, the time corresponding to the target frame, and the end frame of the first animation effect.

[0012] In the above embodiment, the description information about the target frame may be determined by the UI thread, or may be determined by the rendering thread or the rendering process. When the description information about the target frame is determined by the rendering thread or the rendering process, the load on the UI thread can be further reduced, and the possibility of frame freezing of the animation effect can be reduced.

[0013] Regarding some embodiments of the first aspect, in some embodiments, the method further includes: a UI thread determining, based on the descriptive information for the end frame of the first animation effect, properties of the controls at the end frame of the first animation effect; and a UI thread, or a rendering thread or a rendering process, comparing the properties of the controls at the end frame of the first animation effect with properties of controls shown before the first animation effect begins to determine a second set of controls, the second set of controls being controls whose properties change during a duration of the first animation effect, the second set of controls including the first set of controls; the first set of controls being displayed by the first animation effect, and the second controls other than the first set of controls being displayed by the second animation effect, and the animation trigger event being further used to trigger display of the second animation effect.

[0014] In the above embodiment, the UI thread determines the control whose property changes during the duration of the animation effect by comparing the property of the control at the end frame of the animation effect with the property of the control on the interface of one frame shown before the animation effect starts, determines the property of the control on the interface of each frame during the duration of the animation effect, and then determines the display data of the target frame. This can reduce the amount of calculation compared to determining the property of all the controls on the interface of each frame during the duration of the animation effect.

[0015] With respect to some embodiments of the first aspect, in some embodiments, the descriptive information about the target frame is further used to determine properties of a control in a second group of controls in the target frame, the properties of the control including at least one of a size of the control, a location of the control, and a transparency of the control.

[0016] In the above embodiment, the properties of the control directly affect the display effect of the control. By determining the properties of the control, the descriptive information about the target frame may be determined.

[0017] With respect to some embodiments of the first aspect, in some embodiments, generating display data for the target frame by a rendering thread or rendering process of the application based on descriptive information about the target frame specifically includes updating, by the rendering thread or rendering process, a first render tree based on the descriptive information about the target frame, and generating, by the rendering thread or rendering process, display data for the target frame based on the updated first render tree.

[0018] In the above embodiment, the UI thread of the application updates the render tree and then synchronizes the render tree with the rendering thread or rendering process of the application. In this embodiment, the rendering process or rendering thread of the application updates the render tree based on the description information about the target frame, and generates display data for the target frame based on the updated render tree. In this case, when the UI thread is blocked, the animation effect can still be displayed normally.

[0019] With respect to some embodiments of the first aspect, in some embodiments, updating, by the rendering thread or rendering process, the first render tree based on descriptive information about the target frame specifically includes the rendering thread or rendering process updating the first render tree based on properties of a control in the second set of controls in the target frame.

[0020] In such an embodiment, the application's rendering process or rendering thread may update the render tree to generate display data for the target frame based only on the properties of controls whose properties change in the target frame.

[0021] With respect to some embodiments of the first aspect, in some embodiments, the second group of controls includes a third control, and the rendering thread or process adjusts a size of content held in the third control based on a size of the third control and a preset policy, the policy being used to crop or scale the held content, and the held content includes at least one of an image and text.

[0022] In the above embodiment, if the size of the control changes during the duration of the animation effect, the electronic device may further crop or scale the content of the control.

[0023] For some embodiments of the first aspect, in some embodiments, the third control is an image control ImageView, and the content held in the third control is the first image. The policy includes comparing a size of the third control to a size of the first image and cropping or scaling the first image.

[0024] In the above embodiment, if the size of the control changes during the duration of the animation effect, the electronic device may further crop or scale the image on the control.

[0025] For some embodiments of the first aspect, in some embodiments, the third control is a text control, TextView, and the content held in the third control is the first text. The policy includes comparing a width of the third control to a width of the first text, and performing line breaking or merging on the first text.

[0026] In the above embodiment, if the size of the control changes during the duration of the animation effect, the electronic device further performs line breaking or merging on the text on the control.

[0027] With respect to some embodiments of the first aspect, in some embodiments, the first render tree is a render tree that corresponds to an end frame of the first animation effect, or the first render tree is a render tree that corresponds to an interface that is shown before the first animation effect is started.

[0028] In addition, in the above embodiments, the render tree updated by the application's rendering thread or rendering process based on the description information of the target frame may be a render tree corresponding to the end interface of the animation effect, or a render tree corresponding to the interface shown before the animation effect is started.

[0029] With respect to some embodiments of the first aspect, in some embodiments, after the UI thread of the application receives the animation trigger event and after determining descriptive information regarding a duration of the first animation effect, a start time of the first animation effect, and an end frame of the first animation effect based on information about the first animation effect of the first group of controls set by the application, the method further includes the UI thread unregistering an animation callback CALLBACK_ANIMATION of the first animation effect, where the animation callback is used to trigger the UI thread to modify a property of a control of the first group of controls.

[0030] In such an embodiment, the electronic device determines descriptive information about the target frame from the animation effect and unregisters the callback so that the application's UI thread no longer measures, lays out, and draws and records, thereby preventing frame freezes of the animation effect caused by blocking the UI thread.

[0031] With respect to some embodiments of the first aspect, in some embodiments, during a duration of a first animation effect, a UI thread receives a vertical synchronization signal at a first instant in time, and a rendering thread or rendering process generates display data for a target frame at a second instant in time based on description information of the target frame, the second instant in time being a first duration after the first instant in time, the one duration being preset.

[0032] In the above embodiment, the application's rendering process or rendering thread may independently request a vertical synchronization signal to generate an interface for each frame during the duration of the animation effect. Alternatively, the interface for each frame during the duration of the animation effect may be generated some time after the UI thread receives the vertical synchronization signal. In this case, the UI thread may be triggered by a non-animation effect to modify a property of a control and synchronize the modified property of the control with the application's rendering process or rendering thread.

[0033] With respect to some embodiments of the first aspect, in some embodiments, the rendering thread or rendering process determines second parameters during the duration of the first animation effect, the second parameters including both a size and a location of the control in the second group of controls, the rendering thread or rendering process sends the second parameters to the UI thread, and the UI thread determines the size and location of the control in the second group of controls based on the second parameters.

[0034] In the above embodiment, the rendering thread or rendering process synchronizes the location and size of the control on the interface to the UI thread for the duration of the animation effect, so that the UI thread knows the actual location and size of the control.

[0035] With respect to some embodiments of the first aspect, in some embodiments the animation trigger event includes at least one of a user interaction, a network condition change, and a message sent to the application by another application on the electronic device.

[0036] In the above embodiment, the animation effect may be triggered in several ways.

[0037] According to a second aspect, an embodiment of the present application provides an electronic device, the electronic device including one or more processors and a memory, the memory coupled to the one or more processors, the memory configured to store computer program code, the computer program code including computer instructions. The one or more processors invoke computer instructions to enable the electronic device to perform the following steps: after a UI thread of the application receives an animation trigger event, determining descriptive information about a duration of the first animation effect, a start time of the first animation effect, and an end frame of the first animation effect based on information about a first animation effect of a first group of controls set by the application, where the first group of controls includes one or more controls, and the animation trigger event is used to trigger display of the first animation effect; when generating display data for a target frame during the duration of the first animation effect, determining descriptive information about the target frame based on the descriptive information about the start time of the first animation effect, the duration of the first animation effect, a time corresponding to the target frame, and the end frame of the first animation effect; and generating, by a rendering thread or rendering process of the application, the display data for the target frame based on the descriptive information about the target frame.

[0038] In the aforementioned embodiment, during the duration of the animation, the application's rendering thread or rendering process generates an interface based on the descriptive information about the target frame, which is used to determine properties of the controls in the target frame, such as size, location, transparency, etc. During the duration of the animation, the application's rendering thread or rendering process generates the display data for the target frame, and the UI thread does not need to generate the display data for the target frame through measurement, layout, and drawing and recording, which further prevents frame freezes of the animation effect caused by blocking the UI thread.

[0039] With respect to some embodiments of the first aspect, in some embodiments the first animation effect is set by the application via an animation interface.

[0040] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are specifically configured to invoke computer instructions to enable the electronic device to perform the following steps: determining descriptive information for a target frame based on a start time of the first animation effect, a duration of the first animation effect, a time corresponding to the target frame, and descriptive information for an end frame of the first animation effect.

[0041] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are further configured to invoke computer instructions to enable the electronic device to perform the following steps: a UI thread determines, based on the descriptive information for the end frame of the first animation effect, properties of the controls at the end frame of the first animation effect; a UI thread, or a rendering thread or a rendering process, compares the properties of the controls at the end frame of the first animation effect with properties of controls shown before the first animation effect begins to determine a second set of controls, the second set of controls being controls whose properties change during the duration of the first animation effect, the second set of controls including the first set of controls; the first set of controls are displayed by the first animation effect, and the second set of controls other than the first set of controls are displayed by the second animation effect, and the animation trigger event is further used to trigger display of the second animation effect.

[0042] With respect to some embodiments of the second aspect, in some embodiments, the descriptive information about the target frame is further used to determine properties of a control in a second group of controls in the target frame, the properties of the control including at least one of a size of the control, a location of the control, and a transparency of the control.

[0043] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are specifically configured to invoke computer instructions to enable the electronic device to perform the following steps: a rendering thread or rendering process updates a first render tree based on descriptive information about a target frame; and the rendering thread or rendering process generates display data for the target frame based on the updated first render tree.

[0044] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are specifically configured to invoke computer instructions to enable the electronic device to perform the following steps: causing a rendering thread or rendering process to update the first render tree based on properties of a control of the second set of controls in the target frame.

[0045] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are further configured to invoke computer instructions to enable the electronic device to perform the following steps: the first group of controls includes a third control; and the rendering thread or rendering process adjusts a size of content held in the third control based on a size of the third control and a preset policy, the policy being used to crop or scale the held content, and the held content includes at least one of an image and text.

[0046] For some embodiments of the second aspect, in some embodiments, the third control is an image control ImageView, and the content held in the third control is the first image. The policy includes comparing a size of the third control to a size of the first image and cropping or scaling the first image.

[0047] For some embodiments of the second aspect, in some embodiments, the third control is a text control, TextView, and the content held in the third control is the first text. The policy includes comparing a width of the third control to a width of the first text, and performing line breaking or merging on the first text.

[0048] With respect to some embodiments of the second aspect, in some embodiments, the first render tree is a render tree that corresponds to an end frame of the first animation effect, or the first render tree is a render tree that corresponds to an interface that is shown before the first animation effect is started.

[0049] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are specifically configured to invoke computer instructions to enable the electronic device to perform the following steps:

[0050] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are further configured to invoke computer instructions to enable the electronic device to perform the following steps: causing the UI thread to unregister an animation callback CALLBACK_ANIMATION of the first animation effect, where the animation callback is used to trigger the UI thread to modify a property of a control in the first group of controls.

[0051] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are further configured to invoke computer instructions to enable the electronic device to perform the following steps: during a duration of the first animation effect, the UI thread receives a vertical synchronization signal at a first instant in time, and the rendering thread or process generates display data for the target frame at a second instant in time based on descriptive information of the target frame, where the second instant is a first duration after the first instant in time, and the first duration is preset.

[0052] With respect to some embodiments of the second aspect, in some embodiments, the one or more processors are further configured to invoke computer instructions to enable the electronic device to perform the following steps: a rendering thread or rendering process determines a second parameter during a duration of the first animation effect, the second parameter including both a size and a location of a control in the second group of controls; the rendering thread or rendering process sends the second parameter to a UI thread; and the UI thread determines a size and a location of the control in the second group of controls based on the second parameter.

[0053] With reference to some embodiments of the second aspect, in some embodiments the animation trigger event includes at least one of a user interaction, a network condition change, and a message sent to the application by another application on the electronic device.

[0054] According to a third aspect, an embodiment of the present application provides a chip system for application in an electronic device, the chip system including one or more processors, the processors being configured to invoke computer instructions to enable the electronic device to perform a method according to the first aspect or any one of the possible implementations of the first aspect.

[0055] According to a fourth aspect, an embodiment of the present application provides a computer program product comprising instructions, which when operating on an electronic device, enable the electronic device to perform a method according to the first aspect or any possible implementation of the first aspect.

[0056] According to a fifth aspect, an embodiment of the present application provides a computer-readable storage medium comprising instructions which, when run on an electronic device, enable the electronic device to perform a method according to the first aspect or any possible implementation of the first aspect.

[0057] It should be understood that the electronic device according to the second aspect, the chip system according to the third aspect, the computer program product according to the fourth aspect, and the computer storage medium according to the fifth aspect are all configured to perform the methods provided in the embodiments of this application. Therefore, for the beneficial effects that can be achieved by the methods, please refer to the beneficial effects in the corresponding methods. The details will not be described again here. [Brief description of the drawings]

[0058] [Figure 1A] FIG. 2 is a schematic diagram of an example of an interface according to an embodiment of the present application. [Figure 1B] FIG. 2 is a schematic diagram of an example of an interface according to an embodiment of the present application.

[0059] [Figure 2A] FIG. 2 is a schematic diagram of another example of an interface according to an embodiment of the present application. [Figure 2B] FIG. 2 is a schematic diagram of another example of an interface according to an embodiment of the present application.

[0060] [Diagram 3] FIG. 2 is a schematic diagram of an example of an animation effect display method according to an embodiment of this application.

[0061] [Figure 4A] FIG. 13 is a schematic diagram of an example of another animation effect display method according to an embodiment of the present application. [Figure 4B] FIG. 13 is a schematic diagram of an example of another animation effect display method according to an embodiment of the present application.

[0062] [Diagram 5] 2 is a schematic diagram of an example of an animation effect conflict according to an embodiment of the present application;

[0063] [Figure 6A] 1 is a schematic diagram of an example of interface changes in a multi-animation conflict according to an embodiment of the present application; [Figure 6B] 1 is a schematic diagram of an example of interface changes in a multi-animation conflict according to an embodiment of the present application; [Figure 6C] 1 is a schematic diagram of an example of interface changes in a multi-animation conflict according to an embodiment of the present application; [Figure 6D] 1 is a schematic diagram of an example of interface changes in a multi-animation conflict according to an embodiment of the present application; [Figure 6E] 1 is a schematic diagram of an example of interface changes in a multi-animation conflict according to an embodiment of the present application; [Figure 6F] 1 is a schematic diagram of an example of interface changes in a multi-animation conflict according to an embodiment of the present application;

[0064] [Figure 7A]FIG. 2 is a schematic diagram of an example of view property changes in a multi-animation scenario according to an embodiment of the present application. [Figure 7B] FIG. 2 is a schematic diagram of an example of view property changes in a multi-animation scenario according to an embodiment of the present application. [Figure 7C] FIG. 2 is a schematic diagram of an example of view property changes in a multi-animation scenario according to an embodiment of the present application.

[0065] [Figure 8] FIG. 2 is a schematic diagram of an example of a process of an animation effect display method according to an embodiment of this application;

[0066] [Figure 9] 1 is a schematic diagram of an example of determining an animation object according to an embodiment of the present application.

[0067] [Figure 10] FIG. 2 is a schematic diagram of an example of determining properties of a view on an interface for each frame according to an embodiment of the present application;

[0068] [Figure 11A] 1 is a schematic diagram of an example of animation parameter change according to an embodiment of the present application. [Figure 11B] 1 is a schematic diagram of an example of animation parameter change according to an embodiment of the present application. [Figure 11C] 1 is a schematic diagram of an example of animation parameter change according to an embodiment of the present application. [Figure 11D] 1 is a schematic diagram of an example of animation parameter change according to an embodiment of the present application.

[0069] [Figure 12A] 1 is a schematic diagram of an example of interface changes in a multi-animation scenario according to an embodiment of the present application. [Figure 12B]1 is a schematic diagram of an example of interface changes in a multi-animation scenario according to an embodiment of the present application.

[0070] [Figure 13A] 2 is a schematic diagram of an example of an opportunity for a rendering thread or rendering process to update a render tree, according to an embodiment of the present application. [Figure 13B] 2 is a schematic diagram of an example of an opportunity for a rendering thread or rendering process to update a render tree, according to an embodiment of the present application. [Figure 13C] 2 is a schematic diagram of an example of an opportunity for a rendering thread or rendering process to update a render tree, according to an embodiment of the present application.

[0071] [Figure 14] FIG. 13 is a schematic diagram of another example of an opportunity for the rendering thread to update animation parameters, according to an embodiment of the present application.

[0072] [Figure 15A] FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application. [Figure 15B] FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application.

[0073] [Figure 16A] FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application. [Figure 16B] FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application. [Figure 16C] FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application. [Figure 16D] FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application. [Figure 16E]FIG. 2 is a schematic diagram of an example of an animation effect process according to an embodiment of the present application.

[0074] [Figure 17] 1 is a schematic diagram of an example of using UI thread data to determine view properties according to an embodiment of the present application.

[0075] [Figure 18A] FIG. 4 is a schematic diagram of an example of a render tree change in the process of performing the method shown in FIG. 3 according to an embodiment of the present application.

[0076] [Figure 18B] FIG. 5 is a schematic diagram of an example of a render tree change in the process of performing the method shown in FIG. 4A and FIG. 4B according to an embodiment of the present application. [Figure 18C] FIG. 5 is a schematic diagram of an example of a render tree change in the process of performing the method shown in FIG. 4A and FIG. 4B according to an embodiment of the present application.

[0077] [Figure 19] 1 is a schematic diagram of an example of a hardware configuration of an electronic device according to an embodiment of the present application.

[0078] [Figure 20] 1 is a schematic diagram of an example of a software architecture of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0079] The terms used in the following embodiments of this application are used only to describe certain embodiments of this application and are not intended to limit this application. The singular terms "one", "a", "the", "the foregoing", "this" and "the one" used in this specification of this application are also intended to include the plural, unless otherwise clearly specified in the context. The term "and / or" used in this application is further understood to indicate and include any or all possible combinations of one or more of the associated listed items.

[0080] The terms "first" and "second" below are intended for descriptive purposes only and should not be understood as an indication or implication of relative importance or an implicit indication of the number of technical features depicted. Thus, a feature qualified by "first" or "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.

[0081] In the following embodiments of this application, the term "user interface (UI)" refers to a medium interface for interaction and information exchange between an application or an operating system and a user, which implements the conversion between the internal form of information and a form that the user can accept. A user interface is a source code written in a specific computer language, such as Java or extensible markup language (XML). The interface source code is parsed, rendered on an electronic device, and finally presented as content that the user can identify. A user interface is generally expressed in the form of a graphical user interface (GUI), which is a user interface related to computer operation and displayed in a graphical manner. A user interface may be visual interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc., displayed on the display of an electronic device.

[0082] This interface is used as a medium interface for interaction and information exchange between applications and users. Whenever a vertical synchronization signal (Vsync-APP) arrives, the electronic device needs to generate an application interface for the foreground application. The frequency of the vertical synchronization signal is related to the refresh rate of the screen of the electronic device. For example, the frequency of the vertical synchronization signal is the same as the refresh rate of the screen of the electronic device.

[0083] Specifically, before the content displayed on the screen is refreshed, the electronic device must generate an application interface for the foreground application, in which case the newly generated application interface is displayed to the user when the screen is refreshed.

[0084] Animation effects are applied to animation objects. An animation object may be the interface (or window) of an application, or it may be one or more controls (sometimes called views, or views) of an application. From the user's perspective, an animation object contains one or more controls. From the application's perspective, an animation object contains one or more views. Views are the basic building blocks of an application interface, and one control visible to the user in the application interface may correspond to one or more views.

[0085] In the embodiments of this application, unless otherwise specified, the meaning of a control and a view may be the same.

[0086] From the perspective of the time dimension, an animation effect is the process of continuous and smooth change of an animated object over a period of time (at least the duration of the interval between two vertical synchronization pulses).

[0087] (1) An interface with animation effects and a method for displaying animation effects provided in an embodiment of the present application

[0088] (1.1) Interface with circle animation effect

[0089] In an embodiment of this application, animations can include animation effects applied to appearance, animation effects applied to position, transformation-based animation effects, and animation effects applied to content. Animation effects applied to appearance include transparency, corner radius, border color, border line width, background color, shadow, etc. Animation effects applied to location include width / height settings, x / y / z coordinates, x / y / z pivot. Transformation-based animation effects include translation, rotation, scaling, and 3D transformation. Animation effects applied to content include filter effects such as blur, color enhancement, grayscale change, noise addition, etc.

[0090] All animations may be used as settable properties of a control. The properties of a control are used to determine the display style of the control. Display styles include the animation effects applied to appearance, animation effects applied to location, transformation-based animation effects, animation effects applied to content, etc., as mentioned above.

[0091] Below, an example will be used to explain an interface with animation effects.

[0092] 1A and 1B are schematic diagrams of an example of an interface according to an embodiment of the present application.

[0093] As shown in Figure 1A, the interface displayed on the screen of the electronic device is a desktop application interface, and the desktop application interface includes a control 1A01. The control 1A01 includes an icon of a book application.

[0094] The desktop application may further include icons of other applications, such as a gallery application icon, a dial-up application icon, a messaging application icon, and a contacts application icon.

[0095] In response to a long press on control 1A01 by a user, control 1A01 is scaled up.

[0096] In the process of enlarging control 1A01, control 1A02 appears in the interface. The process of enlarging control 1A01 is an animation. Also, if control 1A02 is uncovered step by step (e.g., its transparency changes), the process of uncovering control 1A02 step by step is also an animation.

[0097] 2A and 2B are schematic diagrams of another example of an interface according to an embodiment of the present application.

[0098] As shown in FIG 2A, the interface displayed on the screen of the electronic device is a desktop application interface, and the desktop application interface includes a control 2A01. The control 2A01 is a folder 1 and includes a control 2A02, a control 2A03, and a control 2A04. The control 2A02 is an icon of a game application, the control 2A03 is an icon of a flashlight application, and the control 2A04 is an icon of a gallery application.

[0099] In response to a user tapping on control 2A02, control 2A01 is zoomed in and control 2A02, control 2A03, and control 2A04 are zoomed in.

[0100] The process of enlarging and moving the control 2A01, the control 2A02, the control 2A03, and the control 2A04 is also animated.

[0101] (1.2) Animation effect display method

[0102] To implement the interface shown in Figures 1A and 1B, animation events need to be set for control 1A01. To implement the interface shown in Figures 2A and 2B, animation events need to be set for control 2A01, control 2A02, control 2A03, and control 2A04.

[0103] FIG. 3 is a schematic diagram of an example of an animation effect display method according to an embodiment of this application.

[0104] As shown in FIG. 3, the animation effect display method may include four steps: Step S301: Create animation event 1. Step S302: After receiving a vertical synchronization signal, trigger a callback of animation event 1, and modify the view properties according to the logic of animation event 1. Step S303: Perform measurement, layout, drawing (sometimes called drawing in software rendering) and generate a render tree. Step S304: Receive the render tree and draw a bitmap according to the render tree. The UI thread needs to perform steps S301, S302, and S303. The rendering thread needs to perform step S304. For the first frame of the animation effect, the electronic device needs to perform steps S301, S302, S303, and S304. For each frame during the duration of the animation effect, the electronic device needs to perform steps S302, S303, and S304.

[0105] Step S301: Animation event 1 is created.

[0106] Animation events may be created at any moment and are related to the logic of an application. For example, an animation event may be created after user input is received, a message event sent to the application by another thread or process is received, or network data requests an update. Animation events contain the internal logic for implementing animation effects, such as the end condition of the animation effect and the amount of modification of the view's properties for each frame during the duration of the animation effect.

[0107] After an animation event is created, a callback is registered on the UI thread (equivalent to registering an animation event). For example, a callback is registered on the Choregrapher in the UI thread. The callback is used to process the animation event every time the UI thread receives a vertical sync signal (Vsync-APP) and trigger the UI thread to modify the view properties based on the animation event logic.

[0108] When the animation effect ends, the UI thread actively unregisters any animation event callbacks that were registered on the UI thread based on the animation event's logic.

[0109] Step S302: After receiving a vertical synchronization signal, trigger a callback of animation event 1, and modify the properties of the view according to the logic of animation event 1.

[0110] After receiving a vertical synchronization signal (Vsync-APP) signal, such as vertical synchronization signal 1, vertical synchronization signal 2, and vertical synchronization signal 3 shown in FIG. 3, the UI thread of the application processes an input event (CALLBACK_INPUT), an animation event (CALLBACK_ANIMATION), a traversal event (CALLBACK_TRAVERSAL), and a commitment event (CALLBACK_COMMIT) in sequence.

[0111] In the process of handling an animation event (e.g., doCallbacks(CALLBACK_ANIMATION)), the application's UI thread modifies the view's properties based on the animation event logic.

[0112] For example, on the interface shown in Figures 1A and 1B, the size of control 1A02 is expanded from a rectangle with a width and height of 200px to a rectangle with a width and height of 300px, and the duration is 20 frames. In this case, the size of control 1A02 needs to be modified for each frame. Specifically, in the first frame of the animation, the view corresponding to control 1A02 is modified to a rectangle with a width and height of 205px, and in the second frame of the animation, the view corresponding to control 1A02 is modified to a rectangle with a width and height of 210px.

[0113] Step S303: Measure, layout, draw, and record to generate a render tree.

[0114] Property changes on a view trigger the UI thread to measure, layout, draw, and record on the application interface. The measures are used to determine the size of each view, the layout is used to determine the layout of each view, and the draw and record methods are used to determine one or more drawing operations to draw the application's bitmaps and store the drawing operations in a list of drawing instructions for the render tree.

[0115] Both input and animation events can affect the content of one or more views on the application interface. Therefore, the application's main thread must first handle input and animation events, and then handle traversal events. In the process of the application's main thread handling the traversal event, the application's UI thread performs measurement, layout, and drawing and recording on the application interface, determines the properties of each view, determines the rendering node corresponding to each view, and generates a render tree. The rendering node contains the rendering property and the display list.

[0116] A render tree is a data structure generated by the UI thread and used to generate the application interface. In other words, the render tree records all the information to generate the interface for one frame of the application. A render tree may contain multiple rendering nodes, each of which contains rendering properties and a drawing instruction list, which contains one or more drawing operations.

[0117] A drawing operation is a data structure used to draw a graph, e.g., draw a line, draw a variable width, draw a rectangle, draw text. When the rendering thread runs, the drawing operation is translated into an API call of an image processing library, e.g., an interface call of OpenGL. For example, DrawLineOp is a data structure. The data structure contains drawing data such as the line length, width, etc., and may further contain an interface call corresponding to DrawLineOP of the underlying graphic processing library.

[0118] The drawing instruction list may be a buffer. The buffer records all drawing operations included in one frame of the application interface, or identifiers of all drawing operations, such as addresses, sequence numbers, etc. When an application has multiple windows or is displayed in different display areas, multiple render trees need to be generated independently. Multiple drawing instruction lists corresponding to different windows and display areas are generated independently. In this embodiment of the application, the display area may be a display, a virtual display, etc. The virtual display may be an area in which the electronic device holds the content displayed on the display during screen recording.

[0119] Step S304: Receive the render tree, and draw a bitmap based on the render tree.

[0120] After the UI thread generates the render tree and transfers it to the rendering thread, the rendering thread generates a bitmap based on the render tree. The rendering thread gets a Hardware Canvas and performs drawing operations on the render tree on the Hardware Canvas to generate a bitmap. The bitmap is transferred to the Surface Flinger and Hardware Composer (HWC) for retrieval and generates an interface for display.

[0121] Different from the method of FIG. 3, another animation effect display method is provided as shown in FIG. 4A and FIG. 4B according to an embodiment of this application.

[0122] 4A and 4B are schematic diagrams of an example of another animation effect display method according to an embodiment of the present application.

[0123] As shown in FIG. 4A and FIG. 4B, the animation effect display method may include five steps. Step S401: Create an animation event 2. Step S402: After receiving a vertical synchronization signal, obtain description information on the end interface of the animation effect (which may also be referred to as description information on the end frame) and description information on the duration of the animation effect from the animation event 2. Step S403: Measure, layout, and draw on the end interface of the animation effect to determine a render tree 1. Step S404: Receive the render tree 1, the description information on the end interface of the animation effect, and the description information on the duration of the animation effect. S405: Update the render tree 1 according to the description information on the end interface of the animation effect and the description information on the duration of the animation effect, and generate a bitmap based on the updated render tree 1.

[0124] The UI thread must perform steps S401, S402, and S403. The rendering thread or rendering process must perform steps S404 and S405. For the first frame of the animation effect, the electronic device must perform steps S401, S402, S403, S404, and S405. For each frame during the duration of the animation effect, the electronic device must perform step S405. The rendering process may be an application independent process.

[0125] Step S401: Animation event 2 is created.

[0126] The UI thread of the application creates animation event 2 through the animation interface. For a description of the animation interface, see the following description of step S802. The details will not be described again here.

[0127] Unlike animation-event 1, callbacks cannot be registered on the UI thread during the duration of the animation effect for animation-event 2.

[0128] See the text description of step S301 for the opportunity to create animation event 2. The details will not be explained again here.

[0129] Step S402: After receiving a vertical synchronization signal, obtain description information about the end interface of the animation effect and description information about the duration of the animation effect from animation event 2.

[0130] Different from step S302, after the UI thread receives a vertical synchronization signal, for example, vertical synchronization signal 1, vertical synchronization signal 2, and vertical synchronization signal 3 in the figure, it obtains description information about the end interface of the animation effect and description information about the duration of the animation effect from animation event 2. Additionally, the UI thread does not modify the property of the view and does not trigger step S303.

[0131] Optionally, in some embodiments of this application, the UI thread may obtain descriptive information regarding the step size of the animation effect and descriptive information regarding the duration of the animation effect from animation event 2. Alternatively, the UI thread may obtain descriptive information regarding the end interface, descriptive information regarding the step size of the animation effect, etc. from animation event 2. This is not limited in this specification.

[0132] Note that the UI thread may obtain the animation effect end interface directly from animation event 2, or may determine the animation effect end interface indirectly from animation event 2.

[0133] S403: Measure, layout, and draw on the end interface of the animation effect and determine render tree 1.

[0134] The UI thread actively measures, lays out, draws and records on the animation effect's final interface and also generates the render tree 1. The UI thread synchronizes the render tree 1, the description information about the animation effect's final interface, and the description information about the animation effect's duration to the rendering thread.

[0135] Optionally, in some embodiments of this application, the UI thread synchronizes the render tree 1, the descriptive information regarding the duration of the animation effect, and the descriptive information regarding the step size of the animation effect to a rendering thread or rendering process.

[0136] Optionally, in some embodiments of this application, the UI thread synchronizes the render tree 1, descriptive information regarding the end interface of the animation effect, and descriptive information regarding the step size of the animation effect to a rendering thread or rendering process.

[0137] Optionally, in some embodiments of the present application, the UI thread synchronizes at least two of the descriptive information of the animation effect end interface, the descriptive information of the animation effect step size, and the descriptive information of the animation effect step size to the rendering thread, but not to Render Tree 1. In this case, in step S405, the rendering thread updates Render Tree 0 based on the descriptive information of the animation effect end interface and the descriptive information of the animation effect duration. Render Tree 0 corresponds to the interface shown before the animation effect is started.

[0138] Optionally, in an embodiment of the present invention, the UI thread may determine properties of a view on the interface for each frame during the duration of the animation effect based on at least two of the description information of the end interface of the animation effect, the description information of the step size of the animation effect, and the description information of the step size of the animation effect, and further synchronize the property values ​​of the view on the interface for each frame during the duration of the animation effect and the render tree 1 to a rendering thread or a rendering process.

[0139] Step S404: Receive the render tree 1, description information about the end interface of the animation effect, and description information about the duration of the animation effect.

[0140] The application's rendering thread may receive data sent by the UI thread via a message queue. The rendering process may receive data sent by the UI thread via inter-process communication. The rendering process may request and retrieve data from the UI thread after independently requesting and receiving a vertical sync signal.

[0141] S405: Update render tree 1 based on description information regarding the end interface of the animation effect and description information regarding the duration of the animation effect, and generate a bitmap based on the updated render tree 1.

[0142] The application's rendering thread or process determines which views' properties will change based on the description information about the end interface of the animation effect and the interface that was shown before the animation effect began. The rendering thread determines the step size of the property based on the duration of the animation effect and further determines the property of the view on the interface for each frame during the duration of the animation effect.

[0143] For the process of generating an interface for one frame of an animation effect, the rendering thread or rendering process of the application first determines the rank of the frame in the animation effect, i.e., the specific number of the frame in the animation effect, and then the properties of the view on the interface of the frame, i.e., descriptive information about the animation effect of the frame, may be determined.

[0144] The specific number of frames in the animation effect may be determined based on the frame time, the frequency of the vertical synchronization signal, and the start time of the animation effect. The start time of the animation effect is the time of the vertical synchronization signal corresponding to the interface of the first frame of the animation effect, such as vertical synchronization signal 1 in FIG. 4A and FIG. 4b. Alternatively, the start time of the animation effect may be the moment of an animation trigger event, etc. This is not limited in this specification.

[0145] The rendering thread may determine the view properties on the interface for each frame during the duration of the animation effect, and after receiving a vertical synchronization signal, such as vertical synchronization signal 2 and vertical synchronization signal 3 in FIG. 4B, update the parameters corresponding to the view properties in render tree 1, and generate a bitmap based on the updated render tree 1.

[0146] For each frame other than the first frame during the duration of the animation, only the application's rendering thread or rendering process needs to perform step S405 to draw the interface for each frame during the animation effect and to display the animation effect.

[0147] The execution of the UI thread and the rendering thread or rendering process may be triggered separately by different vertical synchronization signals. For example, the vertical synchronization signal received by the UI thread and the vertical synchronization signal received by the rendering thread may be vertical synchronization signals with the same period but different phases (fixed time difference).

[0148] Obviously, according to the animation effect display method shown in FIG. 3, when the UI thread is blocked by other tasks or takes a relatively long time to perform step S303, the rendering thread cannot generate a bitmap before the vertical synchronization signal 2 arrives. Frame freeze or jank occurs. However, in the animation effect display method shown in FIG. 4 and FIG. 4B, in the process of generating an interface for each frame other than the first frame during the duration of the animation, the rendering thread or rendering process mainly updates the render tree to generate a multi-frame interface for the duration of the animation, but the UI thread is not involved in the process, or the UI thread takes on a relatively small amount of calculation or task. When the UI thread is blocked by another task, frame freeze or jank may not occur.

[0149] In addition, in the animation effect display method shown in Figure 3, when there are multiple animation events, different animation effects will compete with each other. In this case, only one animation effect can be displayed, resulting in a jumping interface, which is not good for the user experience.

[0150] Below, we use an example to explain why multiple animation effects conflict with each other and the interface jumps that result from multiple animation effects.

[0151] (1.3) Animation effect conflicts

[0152] FIG. 5 is a schematic diagram of an example of animation effect competition according to an embodiment of this application.

[0153] As shown in FIG. 5, the process in which the electronic device performs the animation effect display method shown in FIG. 3 includes the following steps.

[0154] S501: Create animation event 4

[0155] During the duration of animation effect 3, in response to user input, another message, etc., the UI thread creates animation event 4 and registers a callback on the UI thread that corresponds to animation event 4.

[0156] S502: After receiving a vertical synchronization signal, trigger a callback for animation event 3 and a callback for animation event 4, modify the properties of the view based on the logic of animation event 3, and then modify the properties of the view based on the logic of animation event 4.

[0157] After receiving vertical sync signal 1, the callback for animation event 3 and the callback for animation event 4 are triggered. The UI thread separately modifies the view's properties based on the logic of animation event 3, and modifies the view's properties based on the logic of animation event 4. In this case, the logic of animation event 4 may overwrite the view's property modifications made by animation event 3.

[0158] For example, a view modified by animation event 3 contains view 1, and a view modified by animation event 4 contains view 1. Before the modification, view 1 is a 20px square. View 1 is modified to be 30px square based on the logic of animation event 3, and view 1 is modified to be 15px square based on the logic of animation event 4. The UI thread separately modifies the view properties based on the logic of animation event 3, and modifies view 1's properties based on the logic of animation event 4. View 1 finally becomes 15px square.

[0159] In this case, the UI thread does not actually execute the logic of animation event 3, and the animation effect corresponding to animation effect event 3 is not displayed correctly. As a result, the interface jumps. The interface jumps as shown in Figures 6A to 6F.

[0160] Then, steps S303 and S304 are performed. For the contents of steps S303 and S304, please refer to the above description corresponding to Fig. 3. The details will not be described again here.

[0161] 6A-6F are schematic diagrams of an example of interface changes in a multi-animation conflict according to an embodiment of the present application.

[0162] As shown in Fig. 6A, a desktop application interface is displayed on a screen of an electronic device. The desktop application interface includes a control 2A01. As a parent control, the control 2A01 may further include some child controls, such as a control 2A02, a control 2A03, and a control 2A04.

[0163] Control 2A01 may be a folder or card within a desktop application. For example, in Figures 6-6E, control 2A01 is Folder 1, control 2A02 contains an icon for a games application, control 2A03 contains an icon for a flashlight application, and control 2A04 contains an icon for a gallery application.

[0164] The interface shown in FIG. 6A may be considered the interface shown before animation effect 1 begins.

[0165] In response to tapping on control 2A01 by a user, this interaction may trigger animation effect 1. Animation effect 1 is applied to control 2A01, control 2A02, control 2A03, and control 2A04, i.e., control 2A01, control 2A02, control 2A03, and control 2A04 are animation objects of animation effect 1. Animation effect 1 gradually increases the size of the animation object and moves the location of the animation object towards the center of the interface.

[0166] As shown in Fig. 6B, the size of the control 2A02 gradually increases, for example, the height and / or width increases, and the location of the control 2A02 changes. The interface shown in Fig. 6B includes a start interface of the animation effect 1 and an intermediate interface of the animation effect 1.

[0167] As shown in FIG. 6C, as the size of the control 2A02 increases continuously, the change of the interface displayed on the electronic device is a process in which the middle interface of animation effect 1 changes to the end interface of animation effect 1.

[0168] As shown in FIG. 6D, before animation effect 1 ends, the user taps on a part of the desktop that does not belong to control 2A01 or uses another interaction method, such as a "back" interaction gesture, to return to the interface shown in FIG. 6A. In this case, the interaction triggers animation effect 2. Animation effect 2 is applied to control 2A01, control 2A02, control 2A03, and control 2A04, i.e., control 2A01, control 2A02, control 2A03, and control 2A04 are animation objects of animation effect 2. The effect of animation effect 2 is that the size of the animation object gradually decreases and the location of the animation object moves toward the location of control 2A01 in FIG. 1A.

[0169] Animation effect 1 has not yet finished and animation effect 2 is occurring. The animation objects to which animation effect 1 and animation effect 2 are applied intersect, and both animation effect 1 and animation effect 2 need to modify the size and location of the view corresponding to the animation object. This causes a conflict between animation effect 1 and animation effect 2. In this case, the interface may change in two ways: the interface shown in FIG. 6E and the interface shown in FIG. 6F.

[0170] 6E, in response to a user tapping on a portion of the desktop that does not belong to control 2A01 or using another interaction method, such as a "back" interaction gesture, the intermediate interface of animation effect 1 is used as the starting interface of animation effect 2, and the modification of the view's properties begins based on the logic of animation effect 2. For example, starting from the intermediate interface of animation effect 1, and changing to the ending interface of animation effect 2.

[0171] Alternatively, as shown in FIG. 6F, in response to a user tapping on a part of the desktop that does not belong to control 2A01 or using other interaction methods, such as a “back” interaction gesture, the change in the interface displayed by the electronic device is split into two steps.

[0172] (1) In FIG. 6F, the content displayed by the electronic device jumps directly from the middle interface of animation effect 1 to the end interface of animation effect 1.

[0173] (2) In FIG. 6F, in the next frame, the ending interface of animation effect 1 is used as the starting interface of animation effect 2, and gradually changes to the ending interface of animation effect 2 based on the logic of animation effect 2. Specifically, in FIG. 6F, control 2A01 gradually becomes smaller until it changes to the size shown in FIG. 6A, and the location of control 2A01 returns to the location of control 2A01 shown in FIG. 6A.

[0174] Obviously, when multiple animation effects compete, the interface change will jump or the interface change speed will jump. As a result, as shown in Figures 7A, 7B, and 7C, the interface change will not be continuous, which does not fit the visual habits of users. This will reduce the user experience.

[0175] 7A, 7B, and 7C are schematic diagrams of an example of view property changes in a multi-animation scenario according to an embodiment of the present application.

[0176] As shown in FIG. 7A, the estimated duration of animation effect 1 is T1 to T3, and the estimated duration of animation effect 2 is T2 to T4. T1 is less than T2, T2 is less than T3, and T3 is less than T4. The estimated durations are periods set by the application for the animation effects. Animation effect 1 increases the height of the view, and animation effect 2 decreases the height of the view.

[0177] In the case shown in FIG. 7A, the properties of the view change as shown in FIG. 7B or FIG. 7C.

[0178] As shown in FIG. 7B, from T1 to T2, based on the logic of animation effect 1, the view property changes, for example, the view height increases linearly, and at T2, the view property such as the height jumps because animation effect 1 and animation effect 2 compete with each other. From T2 to T4, based on the logic of animation effect 2, the view property changes, for example, the view height decreases linearly.

[0179] Obviously, at moment T2, a property of the view, e.g. height, jumps at the transition point between animation effect 1 and animation effect 2.

[0180] As shown in FIG. 7C, from T1 to T2, the properties of the view change based on the logic of animation effect 1, for example, the height of the view increases linearly, and at T2, because animation effect 1 and animation effect 2 conflict, the properties of the view start to change based on the logic of animation effect 2, for example, the height of the view decreases linearly.

[0181] Obviously, at the moment T2, the view's property, e.g., the height change rate, jumps at the transition point between animation effect 1 and animation effect 2. In Figures 7B and 7C, the actual duration of animation effect 1 is from T2 to T1. The duration of animation effect 2 is from T2 to T4.

[0182] In addition to the contents shown in Figures 7A, 7B, and C, if animation effects of different lights compete with each other, the interface may be displayed incorrectly or may jump.

[0183] (2) Animation effect display method provided in the embodiment of the present application

[0184] According to the animation effect display method provided in an embodiment of this application, this embodiment of this application first provides an animation interface for implementing an animation effect. The animation interface may be one or more functions, methods, and methods. An application sets information such as a property of a control, an animation effect, etc. through the animation interface, so that an animation framework provided by this application generates a corresponding animation interface based on the information. Information that can be set in the animation interface includes an end interface of an animation effect and a duration of the animation effect, descriptive information on a step size of the animation effect and a duration of the animation effect, or descriptive information on a step size of the animation effect and a descriptive information on an end interface of the animation effect. The animation interface helps to reduce the workload of an application developer. Additionally, an application developer does not need to set an interface for each frame in the animation effect process, and a rendering thread or a rendering process independently determines an interface for each frame in the animation effect process.

[0185] According to the animation effect display method provided in an embodiment of this application, in the process of displaying the animation effect, the properties of the view are not modified, but the animation parameters in the rendering properties of the render tree are added and modified to draw the interface of each frame in the continuous process of the animation effect. Specifically, the animation parameters may be parameters used to update the render tree, and may include the changed properties of the controls on the interface of one frame in the animation effect process.

[0186] According to the animation effect display method provided in one embodiment of this application, the UI thread does not need to respond to animation events, nor perform measurement, layout, drawing and recording, because only the parameters of the rendering properties of the render tree, not the properties of the view, need to be modified during the animation process again. This helps to avoid jank. The rendering thread or rendering process is responsible for modifying the rendering properties of the render tree.

[0187] Finally, according to the animation effect display method provided in this embodiment of the present application, when multiple animation effects compete with each other, the animation effect display method provided in this embodiment of the present application modifies the display content according to the end interface of the animation effect, so that a continuous interface change (or a continuous interface change speed) can be implemented, thereby implementing a smoother interface and improving the user experience.

[0188] Hereinafter, the animation effect display method provided in one embodiment of this application will be described using an example.

[0189] (2.1) Animation effect display process

[0190] FIG. 8 is a schematic diagram of an example of a process of an animation effect display method according to an embodiment of this application.

[0191] As shown in FIG. 8, the procedure of the animation effect display method provided in this embodiment of this application includes the following steps:

[0192] S801: The application UI thread creates an animation event.

[0193] Animation events may be created at any moment and are related to the logic of the application. For example, an animation event may be created after user input is received, a message event sent to the application by another thread or process is received, or network data requests an update. Animation events contain the internal logic to implement animation effects. For ease of explanation, a message that triggers the application's UI thread to create an animation event is called an animation trigger event.

[0194] In this embodiment of the application, after an animation event is created, a callback is registered with the choreographer on the application's UI thread once. This callback is used to trigger the application's UI thread to process the animation event when the first vertical sync signal arrives after the animation event is created.

[0195] To distinguish between the animation events in the methods shown in Figures 3, 4A, and 4B, hereinafter, the animation events in the method shown in Figure 3 are non-implicit animations, and the animation events in Figures 4A and 4B are implicit animations. Animation events created by an application developer through the animation interface provided in this embodiment are implicit animations.

[0196] Please note that for ease of comparison and explanation of the contents of Figures 3, 4A, and 4B, the animation events are simply referred to as implicit animations and non-implicit animations, and this does not impose any restrictions on the animation events created through the animation interface in this embodiment of the application.

[0197] Optionally, in some embodiments of the present application, the implicit animations may be converted to non-implicit animations, and the conversion process may occur during the process of installing or starting the application for the first time, or the conversion process may occur during the compilation process, but this is not a limitation of the present application.

[0198] For example, a non-implicit animation determines the animation object, a VSync callback for each frame, a property modification of the view, and an animation end condition. The VSync callback for each frame is used to always trigger the UI thread to process the animation event when the animation does not meet the end condition. In this case, the process of converting an animation event to an implicit animation may include the following two steps:

[0199] First, the vertical sync callback for each frame of a non-implicit animation is blocked or intercepted, so that a non-implicit animation does not modify view properties or trigger the application's UI thread to perform measurements, layout, and drawing and recording.

[0200] Then, the parameters required for the implicit animation are determined, for example, the end interface and duration of the animation are determined by modifying the time information of the vertical synchronization signal (Vsync-APP). Alternatively, for some non-implicit animations, the animation objects of the animation, the step size of each property of each animation object, the animation duration, the end interface of the animation, etc. may be determined directly.

[0201] S802: After the UI thread of the application receives a vertical synchronization signal, it determines an end interface of the animation effect and a duration of the animation effect from the animation event.

[0202] The UI thread of the application processes the animation event after receiving the vertical synchronization signal. The animation event is set by the animation interface. The format of the animation interface is as follows: Name of the animation interface (duration, description information on the end interface) Name of the animation interface (duration, change curve, description information on the end interface) Name of the animation interface (descriptive information on the step size, description information on the end interface) Name of the animation interface (duration, description information on the end interface), etc., but this is not limited in this specification.

[0203] In addition to the view location, size, transparency, etc., the description of the ending interface may include a theme (style). The description of the ending interface may also be an increment compared to the interface shown before the animation effect begins, e.g., a width increase in view 1.

[0204] The descriptive information about the step size may include the variation of a property of a control on the interface currently being rendered compared to a property of the control on the interface in a previous frame.

[0205] If the format of the animation interface is the name of the animation interface (duration, transition curve and final interface), the animation interface may be as follows:

number

[0206] animateTo is the name of the animation interface. duration:3000 indicates that the duration is 3000ms, cure:Curve.Linear indicates that the curve is a linear curve. view1.Height=800 view1.Width=400 indicates that view 1 on the animation end interface has a height of 800 and a width of 400, i.e., this is descriptive information about the end frame of the animation.

[0207] An animation interface is one or more functions and methods provided to a system. An application developer may set animation effects for controls on the interface by invoking the animation interface and set information about the animation effect. The information about the animation effect may include descriptive information about the duration of the animation effect, the end frame of the animation effect, etc.

[0208] In the process of running an application, after the application receives an animation trigger event, the application may provide information about the animation effect to the system through an animation interface, and the system may generate an interface for each frame in the animation process based on the information.

[0209] In this format, an electronic device may determine the animation object based on the difference between the ending interface of the animation and the interface shown before the animation begins.

[0210] Note that an animation event may only be registered with the Choreographer once on the UI thread.

[0211] S803: A rendering process or rendering thread of the application updates a render tree based on the end interface of the animation effect and the duration of the animation effect, and generates a bitmap based on the updated render tree.

[0212] After the UI thread determines the animation effect end interface and the animation effect duration, it may forward the animation effect end interface and the animation effect duration to the application's rendering process or rendering thread, which may then determine the properties of the view on the interface for each frame during the animation effect duration, directly update the render tree, and generate a bitmap based on the updated render tree.

[0213] In the process of generating a frame interface, the rendering process or rendering thread of the application needs to determine the number of the current frame in the animation effect and further determine the properties of the view on the frame interface. The rendering process or rendering thread of the application may determine the number of the current frame in the animation effect in multiple ways, such as using the number of vertical synchronization signals received, the moment of the vertical synchronization signal, etc. This is not limited in this specification. The number of the current frame in the animation effect may also be called the rank of the frame in the animation effect. In other words, the descriptive information about the frame includes the properties of the view on the frame interface.

[0214] The interface displayed by an application is formed by nesting multiple views, and different views have parent-child relationships. Therefore, the parent-child relationships between rendering nodes generated by traversing the render tree of a view are the same as the parent-child relationships of views. In other words, the parent-child relationships between views determine the nesting relationships between rendering nodes, so that the rendering thread can correctly render the application interface when generating a bitmap based on the render tree.

[0215] A view may correspond to one or more rendering nodes. The root view (DecorView) corresponds to the root rendering node (Root Render Node). In other words, the nesting relationship between rendering nodes corresponds to the parent-child relationship of views.

[0216] For example, the structure of an application interface is as follows: the root view is carried by the PhoneWindow of the application, the subviews of the root view are view 1 and view 2, and the subview of view 2 is view 3. In this case, the structure of the render tree generated by the UI thread of the application is as follows: the root rendering node corresponding to the PhoneWindow is the root node of the render tree, the child node of the root rendering node is rendering node 0 corresponding to the root view, the child nodes of rendering node 0 are rendering node 1 corresponding to view 1 and rendering node 2 corresponding to view 2, and the child node of rendering node 2 is rendering node 3 corresponding to view 3. The correspondence between views and rendering nodes means that a rendering node contains all the drawing operations that are performed on the corresponding view. One view may correspond to one or more rendering nodes.

[0217] 9 and 10, a method for determining the properties of a view on an interface of each frame during the duration of an animation effect will be described using an example. The properties of a view on an interface of one frame may also be referred to as description information about the interface of one frame.

[0218] FIG. 9 is a schematic diagram of an example of determining an animation object according to an embodiment of the present application.

[0219] As shown in FIG. 9, the application interface has view 1, view 2, and view 3, and the horizontal (the width direction of the views is horizontal) intervals between view 1, view 2, and view 3 are fixed.

[0220] When view 2 has an animation effect that changes its width from B1 to B2, B2 is greater than B1 and greater than 0. Obviously, view 2 is the animation object of the non-implicit animation. However, if we compare the interface shown before the animation effect starts with the end interface of the animation effect, the location of view 3 changes because of the change in width of view 2. Therefore, in the method shown in Figure 3, after modifying the view properties based on the logic of the non-implicit animation, the application's UI thread needs to measure, layout, and draw and record to ensure the accuracy of the interface after the animation.

[0221] Obviously, in the method of FIG. 9, compared with the methods shown in FIG. 4A, FIG. 4B, and FIG. 8, the properties of view 2 and view 3 change, so the animation objects may be determined to be view 2 and view 3.

[0222] Optionally, in some embodiments of the application, the animation object changes only on intermediate interfaces of the animation effect, and does not change on the end interface of the animation or on interfaces shown before the animation begins. The UI thread of the application may determine that the set of changed views for each frame in the animation process is an animation object by adjusting the time information of the vertical synchronization signal.

[0223] FIG. 10 is a schematic diagram of an example of determining properties of views on an interface of each frame according to an embodiment of the present application.

[0224] As shown in Figure 10, an animation event is an implicit animation, and there is an interface shown before the animation starts and an end interface for the animation. The main thread and the rendering thread or rendering process of the application may compare the interface shown before the animation starts with the end interface for the animation to determine that the changed control is an animation object associated with the animation. For example, the animation object includes the control 2A01.

[0225] The location of control 2A01 changes from (x0,y0) to (x1,y1), i.e., control 2A01 is the animation object associated with the animation event. Additionally, the height / width of control 2A01 changes to S times its original height / width, and the animation duration is 30 frames. Furthermore, the location and size of control 2A01 on the interface for each frame may be further determined. The Qth frame of control 2A01 (Q is calculated from the interface shown before the animation starts) is (x0+Q*δX,y0+Q*δY), where δX=(x1-x0) / 30, and δY=(y1-y0) / 30.

[0226] The value of the animation parameter for each frame is (x0+Q*δX, y0+Q*δY). The descriptive information on the step size of the animation parameter may be δX=(x1-x0) / 30, δY=(y1-y0) / 30. Specifically, the animation parameter is information used to determine the properties of a view on an interface in one frame of the animation effect, such as descriptive information on the end interface of the aforementioned animation effect, descriptive information on the duration of the aforementioned animation effect, etc. Alternatively, the animation parameter is information on the properties of a view on an interface in one frame of the animation effect.

[0227] In the following, for ease of explanation, animation parameters are used to represent properties of a view on an interface of one frame or are used to determine properties of a view on an interface of one frame, in other words, animation parameters represent descriptive information about an interface of one frame or are parameters used to determine descriptive information about an interface of one frame.

[0228] The process of determining animation parameters for a single animation event described above. Below, we will mainly explain the process of determining animation parameters for multiple animation events.

[0229] Optionally, in some embodiments of the application, if the animation parameters of an animation object are modified by multiple animation events, in step S1002, vector superposition is performed based on the animation parameters determined independently by each animation event to determine the final animation parameters used to update the render tree.

[0230] Optionally, in some embodiments of the application, when an animation parameter of an animation object is modified by multiple animation effects, for example, when an animation parameter of an animation object is modified by animation effect 1 and animation effect 2 (animation effect 2 occurs during the duration of animation effect 1), animation effect 3 is generated based on animation effect 1 and animation event 2, and the amount of modification of the animation parameter is determined based on the logic of animation effect 3. The logic of animation effect 3 is determined by the logic of animation effect 1 and the effect of animation event 2.

[0231] Animation effect 3 modifies animation parameters so that the property of the view is continuous during the duration of the animation effect, or further, the animation parameters are first differentiable, or further, the animation parameters are second differentiable, etc. The duration of animation effect 3 may be the intersection of the duration of animation effect 1 and the duration of animation effect 2, or it may be from the start of the intersection of animation effect 1 and animation effect 2 to the end of animation effect 1 or the end of animation effect 2.

[0232] Note that because the end interface of the animation effect and the interface shown before the animation effect begins are known, an interpolator may be used to determine the properties of the view for each frame during the duration of the animation effect, such that the properties of the view for each frame are continuous over time, and are first and second differentiable.

[0233] The animation parameters may be determined by the rendering thread or rendering process. Alternatively, the animation parameters may be determined by the UI thread, and the animation parameter values ​​for each frame are forwarded to the rendering thread or rendering process. Data used to communicate between the UI thread and the rendering thread, to hold animation parameter changes, or to hold the final interface for computing animation parameter changes is sometimes called a staging render tree.

[0234] The process of determining animation parameters in a multi-animation scenario will now be described with reference to an example shown in FIG.

[0235] 11A-11D are schematic diagrams of an example of animation parameter changes according to one embodiment of the present application.

[0236] For the contents shown in Figure 11A, please refer to the contents shown in Figure 7A, and the details will not be described again here.

[0237] As shown in FIG. 11B, at T2, the application receives an animation trigger event corresponding to animation effect 2, determines that animation effect 2 involves modifying the height of the view, and generates animation effect 3 to smooth the transition point between animation effect 1 and animation effect 1.

[0238] The duration of animation effect 3 is the intersection of the duration of animation effect 1 and the duration of animation effect 2, i.e., T2 to T3. The start interface and the end interface of animation effect 3 are known. Therefore, animation effect 3 is used as an animation effect that connects animation effect 1 and animation effect 2, and can modify the properties of the view to make the properties of the view continuous, or first-order differentiable, or second-order differentiable between T2 and T3. The animation effect from T2 to T3 is sometimes called a transition process.

[0239] As shown in FIG. 11C, at T2, the application receives an animation trigger event corresponding to animation effect 2, determines that animation effect 2 involves a height modification, and generates animation effect 3 to smooth the transition point between animation 1 and animation 2.

[0240] The duration of animation effect 3 is from T2 to T4. The start interface of animation effect 3 is the interface corresponding to animation effect 1 at T2, and the end interface of animation effect 3 is the end interface of animation effect 2. Therefore, animation effect 3 is used as an animation effect connecting animation effect 1 and animation effect 2, and by modifying the property of the view, the property of the view can be made continuous, or first-order differentiable, or second-order differentiable between T2 and T4.

[0241] As shown in FIG. 11D, at T2, the application receives an animation trigger event corresponding to animation effect 2, determines that animation effect 2 involves a height modification, and generates animation effect 3 to smooth the transition point between animation 1 and animation 2.

[0242] The duration of animation effect 3 is from T3 to T4. The start interface of animation effect 3 is the end interface of animation effect 1, and the end interface of animation effect 3 is the end interface of animation effect 2. Therefore, animation effect 3 is used as an animation effect that connects animation effect 1 and animation effect 2, and by modifying the property of the view, the property of the view can be made continuous, or first-order differentiable, or second-order differentiable between T3 and T4.

[0243] The application interface changes will be described below with reference to the animation parameter changes shown in Figure 11B, and are shown in Figures 12A and 12B.

[0244] 12A and 12B are schematic diagrams of an example of interface changes in a multi-animation scenario according to one embodiment of the present application.

[0245] 6A-6D and 12A-12B are a group of schematic diagrams of example interface changes after an electronic device executes a method for displaying animation effects according to an embodiment of the present application.

[0246] 6A and 6D have been correspondingly described above and will not be described again here.

[0247] As shown in FIG. 12A, after a user receives an interaction in another interactive manner, such as tapping on a part of the desktop that does not belong to control 2A01 or using a “back” interaction gesture, the zooming and movement speed of control 2A01 slows down, which corresponds to “slow zooming speed” in FIG. 7B.

[0248] The animation parameters actually change in a discrete manner, so optionally, in some embodiments of this application, the "stop changing" in FIG. 7B does not occur.

[0249] After T3 and before T4, the enlargement speed of the control 2A01 slows down, and then the reduction of the control 2A01 starts. The reduction process of the control 2A01 is shown in Fig. 12B, which states "increase the reduction speed", and the speed of the control 2A01 increases continuously until the speed does not change.

[0250] Changes to control 2A01 may be the same as changes to a child control of control 2A01.

[0251] The display processes of "zoom in at a shrinking rate" in FIG. 12A and "zoom in at an unchanged rate and then shrink" in FIG. 12(b) are transition processes.

[0252] It will be appreciated that the interface changes shown in Figures 6A-6D, 12A and 12B are continuous and first-order differentiable, which implements a smoother interface and improves the user experience.

[0253] There are many ways to implement step S803. Hereinafter, step S8031, step S8032 and step S8033 are used as an example to describe one embodiment of implementing step S803.

[0254] S8031: The application UI thread performs measurements, layout, drawing, and recording on the animation effect end interface to generate the first render tree.

[0255] The application's UI thread actively measures, lays out, draws and records on the animation effect's final interface to generate the primary render tree. The interface that corresponds to the primary render tree is the final interface.

[0256] S8032: A rendering process, an application's UI thread, or an application's rendering thread determines animation parameters that correspond to an interface for each frame during the duration of the animation effect based on the end interface of the animation effect and the duration of the animation effect.

[0257] The rendering process, the application's UI thread, or the application's rendering thread, determines the animation parameters of the render tree that correspond to the interface for each frame during the duration of the animation effect based on the end interface of the animation effect, the duration of the animation effect, and the start time of the animation effect. The animation parameters may be located in the rendering properties of the render tree, and the animation parameters are used to modify the way the views on the interface are displayed.

[0258] Optionally, in some embodiments of this application, animation parameters may replace animation effects that can be implemented only by modifying the drawing instruction list, in which case the drawing instruction list does not need to be changed for the duration of the animation effect, and the UI thread does not need to perform measurement, layout, drawing and recording to update the render tree.

[0259] Added animation parameters are width (BOUD_WIDTH), height (BOUNDS_HEIGHT), location (BOUNDS_POSITION), pivot (PIVOT), rounded corners (Roundcorner), 2D transform (TRANSLATE), 3D These include the translation (ROTATION_3D), Z coordinate (POSITION_Z), background color (BACKGROUND_COLOR), foreground color (FOREGROUND_COLOR), border color (BORDER_COLOR), border width (BORDER_WIDTH), transparency (ALPHA), content rectangle (FRAME_WIDTH and FRAME_HEIGHT), content adaptation mode (Gravity), background filter (BACKGROUND_FILTER), content filter (CONTENT_FILTER), background and content filter (Filter), shadow color (SHADOW_COLOR), shadow offset (SHADOW_OFFSET_X and SHADOW_OFFSET_Y), shadow transparency (SHADOW_ALPHA), shadow radius (SHADOW_RADIUS), shadow path (SHADOW_PATH), and mask (MASK).

[0260] Optionally, in some embodiments of the present application, step S8032 may be performed by the UI thread.

[0261] Animation parameters are located in the rendering properties of the render tree and directly affect the way the view is displayed on the interface. Therefore, animation parameters may be continuous, or one or two differentiable, so that the view properties are continuous, or one or two differentiable in the animation process. For determining animation parameters, see the above text description corresponding to Figures 9 and 10. The details will not be described again here.

[0262] By modifying the animation parameters, the interface can be changed, and the UI thread of the application does not need to perform measurement, layout, drawing, and recording. Therefore, in the animation process, the UI thread of the application does not need to process animation-related operations such as processing animation events, updating view properties, measurement, layout, drawing, and recording. For the division of work between the UI thread and the rendering thread and the rendering process, see the contents of the procedure for determining the data of the animation parameters in (a) below. The details will not be described again here.

[0263] In the animation process, the UI thread and the rendering thread of the application are independent of each other in the animation implementation process. Therefore, after the UI thread of the application receives the vertical synchronization signal (Vsync-APP), it notifies the rendering thread to update the animation parameters, or the rendering process independently requests the vertical synchronization signal (Vsync-Render), and the frequency of the vertical synchronization signal (Vsync-Render) may be different from the frequency of the vertical synchronization signal (Vsync-APP), or the opportunity for the rendering thread or the rendering process to start updating the animation parameters, see the content of the opportunity for the rendering thread or the rendering process to update the animation parameters in (b) below. The details will not be described again here. In order to distinguish the vertical synchronization signals received by different threads or processes, the vertical synchronization signal (Vsync-APP) signal is used to represent the vertical synchronization signal received by the UI thread, and the vertical synchronization signal (Vsync-Render) signal is used to represent the vertical synchronization signal received by the rendering thread or the rendering process.

[0264] Below, we separately discuss (a) the opportunities for the rendering thread or rendering process to update the render tree, and (b) the modification of the drawing instruction list.

[0265] (a) An opportunity for the rendering thread or rendering process to update the render tree.

[0266] 13A, 13B, and 13C are schematic diagrams of an example of an opportunity for a rendering thread or a rendering process to update a render tree, according to one embodiment of the present application.

[0267] The opportunities for a rendering thread or rendering process to update the render tree may be illustrated in Figures 13A, 13B, and 13C.

[0268] As shown in FIG. 13A, first, the UI thread processes an animation event after receiving a vertical synchronization signal (Vsync-APP) (step S1301). Then, the UI thread determines the final interface of the animation effect and the duration of the animation effect (step S1302). Then, the UI thread sends the final interface of the animation effect and the duration of the animation effect (step S1303). Finally, the rendering process or rendering thread of the application updates the render tree (step S1304).

[0269] As shown in FIG. 13B, first, the UI thread receives a vertical synchronization signal (Vsync-APP) (step S1305), then the UI thread forwards the vertical synchronization signal or another parameter indicating a trigger opportunity (step S1306), and finally, the application's rendering process or rendering thread updates the render tree (S1304).

[0270] As shown in FIG. 13C, the rendering process or rendering thread of the application receives a vertical synchronization signal (Vsync-Render) (step S1307), and then the rendering process or rendering thread of the application updates the render tree (S1304).

[0271] In the process of generating an interface for the first frame of an animation effect, the rendering thread or rendering process may have opportunities to update the render tree as shown in Figure 13A. In the process of generating an interface for a non-first frame of an animation effect, the rendering thread or rendering process may have opportunities to update the render tree as shown in Figure 13A, Figure 13B, or Figure 13C.

[0272] Please note that when an application's UI thread transfers data to a rendering process, the data exchange must be completed through InterProcess Communication (IPC). Applications may implement IPC communication via Binder, AIDL, shared memory, sockets, etc. This is not limited to the methods described herein.

[0273] FIG. 14 is a schematic diagram of another example of an opportunity for the rendering thread to update animation parameters, according to one embodiment of the present application.

[0274] As shown in Figure 14, in the animation process, the rendering thread may independently request a vertical synchronization signal (Vsync-APP). In the T-Delay when the vertical synchronization signal (Vsync-APP) is received, the UI thread does not forward the information about the render tree update to the rendering thread due to blocking or another reason. After the T-Delay, the rendering thread starts to update the render tree and generates the interface. In the T-Delay when the vertical synchronization signal (Vsync-APP) is received, the UI thread may process input events or other logic (which may not include processing animation events) and forward the information about the render tree update to the rendering thread. After receiving the information about the render tree update, the rendering thread updates the render tree and generates the interface.

[0275] It will be appreciated that a single delay, T-Delay, is set on the rendering thread to help implement animations and quickly generate interfaces that change due to non-animation logic.

[0276] The value of T-Delay may be smaller than the period of the vertical synchronization signal, or may be equal to or greater than the period of the vertical synchronization signal.

[0277] Optionally, in some embodiments of the present application, the rendering thread may delay one or more vertical synchronization signals (Vsync-APP) after the UI thread when updating animation parameters and generating the interface. In this case, it will be understood that when the rendering thread delays one or more vertical synchronization signals (Vsync-APP) after the UI thread when updating animation parameters, the start of the animation may be delayed. However, this helps to increase the maximum processing duration for generating a single frame interface and reduce the probability of jank.

[0278] The rendering process updates animation parameters at a different time than the rendering thread updates animation parameters. The rendering process requires an independent vertical synchronization (Vsync-Render) signal. The frequency and time of the vertical synchronization signal (Vsync-Render) and the vertical synchronization signal (Vsync-APP) may be the same or different.

[0279] (b) Modifying the drawing instruction list

[0280] Optionally, in some embodiments of the present application, when the drawing instruction list of the interface shown before the animation effect is started is different from the drawing instruction list of the end interface of the animation effect, the interface is generated by modifying the animation parameters of the render tree using the render tree corresponding to the end interface of the animation effect as a reference from the start of the interface of the first frame of the animation effect to the end interface of the animation effect, which is an animation effect process in which the drawing instruction list is not modified as follows (i).

[0281] Optionally, in some embodiments of the present application, when the drawing instruction list of the interface shown before the animation effect starts and the drawing instruction list of the end interface of the animation effect are different, the interface is generated by modifying the animation parameters of the render tree using the render tree corresponding to the interface shown before the animation effect as a reference from the start of the interface of the first frame of the animation effect to the end interface of the animation effect, which is an animation effect process in which the drawing instruction list is not modified as in (i) below.

[0282] Optionally, in some embodiments of the present application, if the drawing instruction list of the interface shown before the animation effect is started is different from the drawing instruction list of the end interface of the animation effect, the rendering thread or rendering process may modify the drawing operations in the drawing instruction list and the animation effect parameters in the render tree to generate the interface, which is the animation effect process in which the drawing instruction list is modified as follows (i):

[0283] In some embodiments of this application, when an application interface includes a textview or an imageview, the drawing instruction list of the interface shown before an animation effect begins may be different from the drawing instruction list of the interface at the end of the animation effect.

[0284] (i) Animation effect process where the drawing command list is not modified

[0285] The drawing content of the end interface of the animation effect is different from the drawing content of the interface displayed before the animation effect is started, resulting in a different drawing instruction list. In an embodiment of the animation effect display method provided in this application, as shown in Figures 15A and 15B, the drawing instruction list of the render tree of the final interface is used as a reference, and the animation parameters are modified to update the render tree to generate the interface.

[0286] 15A and 15B are schematic diagrams of an example of an animation effect process according to one embodiment of the present application.

[0287] As shown in FIGURE 15A, before the animation effect begins, the interface includes a control 1501, which holds the text "input an account." In this case, the control may include a text view 1 and a rectangle view, where text view 1 holds the text "input an account" and the size of text view 1 is the same as the size of control 1501.

[0288] The drawing action corresponding to text view 1 in the drawing command list is drawText(input an account).

[0289] After the animation effect is set for control 1501, on the end interface of the animation effect, the width of control 1501 is shortened and the text "input an account" becomes two lines, with "input" on the first line and "an account" on the second line. In other words, control 1501 contains text view 1, and text view 1 holds "input" and "account."

[0290] The drawing operations corresponding to text view 1 in the drawing command list are drawText(enter) and drawText(account).

[0291] For the drawing command list, the UI thread needs to perform real-time measurement, layout, and drawing and recording on the interface. Therefore, in order to avoid updating the drawing command list in the animation effect process, from the start of the interface of the first frame of the animation effect to the end interface of the animation effect, the render tree of the interface is updated and generated by using the render tree corresponding to the end interface as the animation effect parameter, as specifically shown in Figure 15B.

[0292] As shown in Figure 15B, even if the width of control 1501 is robust enough to fit the text "input an account" on a single line during the duration of the animation effect, "input an account" is still presented on two lines: "input" and "an account." In this case, the rendering node corresponding to control 1501 during the duration of the animation effect is rendering node 2, and the drawing actions included in the drawing instruction list of rendering node 2 are "drawText(enter) and drawText(an account)."

[0293] Specifically, in the animation effect process, the drawing instruction list does not change, and the rendering thread or rendering process modifies the animation effect parameters to generate the interface shown in FIG. 15B, in which the width of the control 1501 gradually decreases and the text is always displayed in two lines.

[0294] (ii) An animation effect process in which the drawing instruction list is modified

[0295] The drawing content of the interface at the end of the animation effect is different from the drawing content of the interface displayed before the animation effect is started, resulting in a different drawing command list. According to the animation effect display method provided in an embodiment of this application, as shown in Figures 16A and 16B, in the process of generating the interface, the drawing operations in the drawing command list are continuously modified, and the animation effect parameters are modified to generate the interface.

[0296] 16A, 16B, 16C, 16D, and 16E are schematic diagrams of an example of an animation effect process according to one embodiment of the present application.

[0297] As shown in Figure 16A, the interface shown before the animation effect begins includes a control 1601, which holds Picture 1. Control 1601 may be an image view.

[0298] The drawing operation corresponding to displaying picture 1 in the control 1601 is drawBitmap(picture 1, src, dst 1) in the drawing command list. picture 1 is the source image, scr indicates the area to be displayed in the source image, and dst 1 indicates the area where scr of picture 1 is drawn in the control 1601.

[0299] After the animation effect is set to the control 1601, on the end interface of the animation effect, the width of the control 1601 is reduced and the width of the image view 1 is reduced proportionately. The drawing operation corresponding to the image view 1 in the drawing command list is drawBitmap(picture 1, src, dst N).

[0300] For example, dst 1 = Rect(10, 20, 150, 200), where (10, 20) is the coordinate of the top left corner of the rectangle, and (150, 100) is the coordinate of the bottom right corner of the rectangle, and dst N = Rect(10, 20, 150, 100).

[0301] In the animation effect process, the rendering thread or process updates the drawing operations corresponding to the control 1601 to implement the interface shown in FIG. 16B.

[0302] As shown in Figure 16B, in the animation effect process, the rendering thread or rendering process modifies the drawing operations and animation effect parameters in the render tree for each frame, so that the width of the image view 1 becomes smaller successively in the animation effect process. The rendering thread or rendering process modifies the drawing operations, for example, drawBitmap(picture 1, src, dst 2),...,drawBitmap(picture 1, src, dst N).

[0303] A rendering handling policy affects the manner in which a rendering thread or rendering process modifies drawing operations. Picture handling policies may include, but are not limited to, the following: CENTER (the picture is displayed in the center and the picture is cropped if the picture size exceeds the size of the view that holds the picture), CENTER_INSIDE (the picture size is adjusted proportionally so that the picture is complete and centered in the view that holds the picture), FIT_CENTER (the picture size is adjusted proportionally so that the picture is no larger than the size of the view that holds the picture and is displayed in the center), FIT_END (the picture size is adjusted proportionally so that the picture is no larger than the size of the view that holds the picture and is displayed at the bottom), FIT_START (the picture size is adjusted proportionally so that the picture is no larger than the size of the view that holds the picture and is displayed at the top), FIT_XY (the picture size is not adjusted proportionally so that the picture is no larger than the size of the view that holds the picture), etc.

[0304] CENTER, CENTER_INSIDE, FIT_CENTER, FIT_END, FIT_START, and FIT_XY may be modified by modifying the parameters dst and src in the drawing operation drawBitmap.

[0305] As shown in Figures 16C and 16D, the drawing operations in the drawing instruction list are modified to scale or crop the picture held on the control to accommodate the resize of the control.

[0306] As shown in Figure 16C, control 1602 holds image 1. When the size of the control is reduced, the picture may be scaled based on the rate of change of the size of the control, for example, CENTER_INSIDE as discussed above.

[0307] Alternatively, as shown in Figure 16D, when the size of the control decreases, the picture may be cropped based on the rate of change of the size of the control. Alternatively, as shown in Figure 16E, when the size of the control increases, Image 1 may first be enlarged to the size of the end interface of the animation effect, and then cropped based on the size of the control to implement the animation effect shown in Figure 16F.

[0308] In conclusion, a rendering thread or process may implement continuous interface changes by cropping images or other content held by a control by modifying drawing operations in the drawing instruction list based on changes in the size of the control.

[0309] S8033: The application's rendering process or rendering thread updates the render tree based on the animation parameters and generates a bitmap based on the updated render tree.

[0310] After obtaining the render tree with the updated animation parameters, the rendering thread or rendering process may traverse the render tree and traverse and execute the drawing operations in the drawing instruction list on the canvas. For each drawing operation, the rendering thread or rendering process may refer to the rendering properties of the rendering node to adjust the parameters of the drawing operation or the graphics processing library calls corresponding to the drawing operation to generate a bitmap.

[0311] In some embodiments of the present application, a rendering process or rendering thread may call the GPU to draw and generate bitmaps. Alternatively, in some embodiments of the present application, a rendering process or rendering thread may call the CPU to draw and generate bitmaps.

[0312] The bitmaps are obtained by the rendering process or surface synthesizer (SurfaceFlinger), and the interface is generated after layer compositing.

[0313] S804: Optionally, the application's rendering process or rendering thread synchronizes the view's properties with the application's UI thread.

[0314] After the interface is generated, the UI thread is unaware of the actual location and size of the controls on the interface during the animation process. Therefore, optionally, in some embodiments of this application, the rendering thread or rendering process may send the location and size of the controls to the UI thread of the application. The location and size of the controls may be transferred using a data structure such as a render tree, which is not limited herein.

[0315] FIG. 17 is a schematic diagram of an example of using UI thread data to determine properties of a view according to an embodiment of the present application.

[0316] As shown in Figure 17, determining view properties using UI thread data involves the following steps:

[0317] S1701: Determine and transfer the information used to update the render tree.

[0318] After the application's UI thread has determined the information used to update the render tree, it may transfer the information used to update the render tree, e.g., animation parameters of the interface's render tree, for each frame during the duration of an animation effect, to the application's rendering process or rendering thread.

[0319] For the first frame of an animation effect, the application's UI thread transfers information to the rendering thread or process that is used to update the animation parameters, such as the animation effect's duration, the animation object, and the animation effect's end interface.

[0320] In the process of displaying an animation effect other than the first frame of the animation, the application's UI thread does not need to transfer the information used to update the animation parameters to the rendering thread or rendering process.

[0321] In the process of displaying an animation effect other than the first frame of an animation, the application's UI thread may forward the render tree, modified by input events or logic (except animation events) from other UI threads, to a rendering thread or rendering process.

[0322] S1702: The properties of the view are determined and transferred.

[0323] In the process of displaying an animation effect, the rendering thread or rendering process determines the view properties such as size and location based on the render tree and forwards the view size and properties to the application's UI thread so that the application's UI thread can determine the view's size and location.

[0324] Optionally, in some embodiments of this application, the rendering thread or rendering process may transfer the view's location and size, as well as other properties, to the application's UI thread in response to a request from the application's UI thread.

[0325] It will be appreciated that in the process of displaying an animation effect, the application's UI thread does not need to measure, layout, and draw to determine the properties of the view, thereby reducing the load on the application's UI thread.

[0326] Finally, the differences between the two animation effect display methods shown in FIGS. 3, 4A, and 4B will be described below by using the contents shown in FIGS. 18A, 18B, and 18C as an example.

[0327] FIG. 18A is a schematic diagram of an example of a render tree change in the process of performing the method shown in FIG. 3 according to one embodiment of the present application.

[0328] As shown in FIG. 18A, before animation effect 1 begins, the application's rendering thread stores render tree 1, and control 1A01 in the application interface is a 20px square.

[0329] After animation effect 1 is started, the UI thread of the application receives vertical synchronization signal 1, determines that the size of control 1A01 on the interface of the first frame of animation effect 1 is 25px*25px, generates render tree 2 corresponding to the interface of the first frame of animation effect 1, and synchronizes render tree 2 to the rendering thread of the application. The rendering thread generates a bitmap based on render tree 2, and the size of control 1A01 in the bitmap is 25px*25px.

[0330] Then, after receiving the vertical synchronization signal 2, the UI thread determines that the size of the control 1A01 on the interface of the first frame of the animation effect 1 is 30px*30px, generates a render tree 3 corresponding to the interface of the second frame of the animation effect 1, and synchronizes the render tree 3 to the rendering thread of the application. The rendering thread generates a bitmap based on the render tree 2, and the size of the control 1A01 in the bitmap is 30px*30px.

[0331] 18B and 18C are schematic diagrams of an example of a render tree change in the process of performing the method shown in FIG. 4A and FIG. 4B according to one embodiment of the present application.

[0332] As shown in Figure 18B, before the animation effect, the application's rendering thread stores render tree 1, and control 1A01 in the application interface is a 20px square.

[0333] After animation effect 1 is started, the UI thread of the application receives vertical sync signal 1, and the logic of animation effect 1 determines that control 1A01 should be scaled by 5px every frame, eventually changing to 100px*px, and based on the end interface of animation effect 1, render tree 2 is generated. Then, the logic of animation effect 1 and render tree 2 are transferred to the rendering process or rendering thread of the application. The rendering process or rendering thread of the application updates render tree 2 based on the logic of animation effect 1, and generates a bitmap based on the updated render tree 2. The size of control 1A01 in the bitmap is 25px*25px.

[0334] Then, the rendering process or rendering thread of the application updates the render tree 2 based on the logic of the animation effect 1 after receiving the vertical sync signal 2, and generates a bitmap based on the updated render tree 2. The size of the control 1A01 in the bitmap is 30px*30px.

[0335] As shown in Figure 18C, unlike Figure 18B, the rendering process or rendering thread of the application updates Render Tree 1 based on the logic of Animation Effect 1. The size of Control 1A01 on the interface corresponding to Render Tree 1 is 20px*20px.

[0336] (3) An electronic device according to an embodiment of this application

[0337] First, the hardware architecture of the electronic device provided in this embodiment of the application is described.

[0338] FIG. 19 is a schematic diagram of an example of a hardware architecture of an electronic device according to one embodiment of the present application.

[0339] The electronic device may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device, and / or a smart city device. In this embodiment of this application, the specific type of electronic device is not limited.

[0340] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) port 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, a sensor module 180, buttons 190, a motor 191, indicators 192, a camera 193, a display 194, a subscriber identification module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, an optical proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.

[0341] It will be understood that the structure illustrated in this embodiment of the invention does not constitute a particular limitation on the electronic device. In some other embodiments, the electronic device may include more or fewer components than those shown in the figures, some components may be combined, some components may be split, or different component arrangements may be used. The components shown in the figures may be implemented in hardware, software, or a combination of software and hardware.

[0342] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be separate components or may be integrated into one or more processors.

[0343] The controller may generate operation control signals based on the instruction operation codes and the time sequence signals to complete the control of instruction fetching and instruction execution.

[0344] The memory may be disposed within the processor 110 and configured to store instructions and data. In some embodiments, the memory within the processor 110 is a cache memory. The memory may store instructions or data that have been recently or periodically used by the processor 110. When the processor 110 needs to use the instructions or data again, the processor may retrieve the instructions or data directly from the memory. This avoids repeated accesses, reduces the latency of the processor 110, and improves the efficiency of the system.

[0345] In some embodiments, the processor 110 may include one or more interfaces, which may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM), a universal serial bus (USB) interface, or the like.

[0346] The I2C interface is a bidirectional synchronous serial bus including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include a group of multiple I2C buses. The processor 110 may be separately coupled to the touch sensor 180K, the charger, the flashlight, the camera 193, etc. through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through an I2C interface, such that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to implement a touch function of the electronic device.

[0347] The I2S interface may be configured for audio communication. In some embodiments, the processor 110 may include a group of multiple I2S buses. The processor 110 may be coupled to the audio module 170 via the I2S bus to implement communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transfer audio signals to the wireless communication module 160 via the I2S interface to implement the functionality of receiving a call via a Bluetooth headset.

[0348] The PCM interface may be configured for audio communication, sampling, quantization, and encoding of analog signals. In some embodiments, audio module 170 and wireless communication module 160 may be coupled via a PCM bus interface. In some embodiments, audio module 170 may alternatively transfer audio signals to wireless communication module 160 via the PCM interface and implement the functionality of receiving a call via a Bluetooth headset. Both the I2S interface and the PCM interface may be configured for audio communication.

[0349] The UART interface is a universal serial data bus configured for asynchronous communication. The bus may be a bidirectional communication bus. The bus converts transmitted data between serial and parallel communication. In some embodiments, the UART interface is generally configured to connect the processor 110 to the wireless communication module 160. For example, the processor 110 communicates with a Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 may transfer audio signals to the wireless communication module 160 via the UART interface to implement functionality for playing music via a Bluetooth headset.

[0350] The MIPI interface may be configured to connect to the processor 110 and peripheral components such as a display 194, a camera 193, etc. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 communicates with the camera 193 via the CSI interface to implement a picture taking function of the electronic device. The processor 110 communicates with the display 194 via the DSI interface to implement a display function of the electronic device.

[0351] The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or a data signal. In some embodiments, the GPIO interface may be configured to connect the processor 110 to the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0352] The USB port 130 is an interface conforming to the USB standard, and may be specifically a Mini USB port, a Micro USB port, a USB Type-C interface, etc. The USB port 130 may be configured to connect to a charger to charge the electronic device, may be configured to transmit data between the electronic device and a peripheral device, or may be configured to connect to a headset to play audio through the headset. The interface may be further configured to connect to another electronic device, such as an AR device.

[0353] It will be understood that the interface connection relationships between modules shown in this embodiment of the present invention are merely illustrative examples and do not constitute limitations on the structure of the electronic device. In some other embodiments of this application, the electronic device may alternatively use a different interface connection scheme than the aforementioned embodiment or a combination of multiple interface connection schemes.

[0354] The charging management module 140 is configured to receive a charging input from a charger. The charger may be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 may receive the charging input of the wired charger via the USB port 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through a wireless charging coil of the electronic device. The charging management module 140 may further provide power to the electronic device by using the power management module 141 while charging the battery 142.

[0355] The power management module 141 is configured to couple to the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, the wireless communication module 160, etc. The power management module 141 may be further configured to monitor parameters such as battery capacity, battery cycle count, battery health (leakage or impedance), etc. In some other implementations, the power management module 141 may alternatively be disposed within the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may alternatively be disposed within the same device.

[0356] The wireless communication function of the electronic device may be implemented using antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, a baseband processor, and the like.

[0357] Antenna 1 and Antenna 2 are configured to transmit and receive electromagnetic signals. Each antenna of the electronic device may be configured to cover one or more communication frequency bands. Different antennas may be further multiplexed to improve antenna utilization. For example, Antenna 1 may be multiplexed as a diversity antenna in a wireless local area network. In some other embodiments, the antennas may be used in combination with tuning switches.

[0358] The mobile communication module 150 may provide a solution including wireless communication such as 2G / 3G / 4G / 5G and applied to electronic devices. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves via the antenna 1, filter, amplify, etc., and transmit the electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 may further amplify the signal modulated by the modem processor and convert the signal to electromagnetic waves for emission via the antenna 1. In some embodiments, at least some of the functional modules in the mobile communication module 150 may be disposed within the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed within the same device as at least some of the modules of the processor 110.

[0359] The modem processor may include a modulator and a demodulator. The modulator is configured to modulate a low-frequency baseband signal to be transmitted into a medium / high-frequency signal. The demodulator is configured to demodulate a received electromagnetic signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal is processed by the baseband processor and then transmitted to the application processor. The application processor outputs an audio signal via an audio device (such as, but not limited to, speaker 170A, receiver 170B, etc.) or displays an image or video via display 194. In some embodiments, the modem processor may be an independent device. In some other embodiments, the modem processor may be independent from the processor 110 and may be disposed in the same device as the mobile communication module 150 or another functional module.

[0360] The wireless communication module 160 may be applied to electronic devices and provide wireless communication solutions including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC) technology, infrared (IR) technology, etc. The wireless communication module 160 may be one or more components integrating at least one communication processor module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering on the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may further receive signals to be transmitted from the processor 110, perform frequency modulation and amplification on the signals, and convert the signals into electromagnetic waves for emission via the antenna 2.

[0361] In some embodiments, in an electronic device, antenna 1 and mobile communication module 150 are coupled, and antenna 2 and wireless communication module 160 are coupled, and the electronic device can communicate with a network and other devices by using wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, IR technologies, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a BeiDou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and / or a satellite based augmentation system (SBAS).

[0362] The electronic device implements display functions using a GPU, a display 194, an application processor, etc. The GPU is a microprocessor for image processing and is connected to the display 194 and the application processor. The GPU is configured to perform mathematical and geometric calculations for graphic rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0363] The display 194 is configured to display images, videos, and the like. The display 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel may be made from organic light-emitting diodes (OLEDs), active-matrix organic light emitting diodes (AMOLEDs), flexible light-emitting diodes (FLEDs), mini-LEDs, micro-LEDs, micro-OLEDs, quantum dot light emitting diodes (QLEDs), and the like. In some embodiments, the electronic device may include one or N displays 194, where N is a positive integer greater than 1.

[0364] The electronic device may implement imaging functionality using an ISP, a camera 193, a video codec, a GPU, a display 194, an application processor, and the like.

[0365] The ISP may be configured to process data fed back by the camera 193. For example, during shooting, the shutter is opened and light is transmitted to the camera's photoreceptor through the lens. The light signal is converted to an electrical signal, which in turn transmits the electrical signal to the ISP for processing and converts the electrical signal into a visible image. The ISP may further perform algorithmic optimization on image noise, brightness, and color. The ISP may further optimize parameters such as exposure and color temperature for the shooting scenario. In some embodiments, the ISP may be disposed within the camera 193.

[0366] The camera 193 is configured to capture still images or videos. An optical image of an object is generated through a lens and projected onto a photoreceptor. The photoreceptor may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photoreceptor converts the optical signal into an electrical signal, and then transmits the electrical signal to an ISP for converting the electrical signal into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into an image signal in a standard format, such as an RGB format, a YUV format, etc. In some embodiments, the electronic device may include one or N cameras 193, where N is a positive integer greater than 1.

[0367] The digital signal processor is configured to process digital signals, and may process other digital signals in addition to the digital image signal, for example, when the electronic device selects a frequency, the digital signal processor is configured to perform a Fourier transform on the frequency energy.

[0368] A video codec is configured to compress or decompress digital video. An electronic device may support one or more video codecs. Thus, an electronic device may play or record video in multiple coding formats, e.g., moving picture experts group (MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.

[0369] The NPU is a neural-network (NN) calculation processor. The NPU can rapidly process input information by referring to the structure of biological neural networks, such as the transmission mode between human brain neurons, and can also perform self-learning continuously. Applications such as intelligent perception of electronic devices can be implemented through the NPU, such as image recognition, face recognition, speech recognition, and text understanding.

[0370] The internal memory 121 may include one or more random access memories (RAMs) and one or more non-volatile memories (NVMs).

[0371] The random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, e.g., fifth generation DDR SDRAM, commonly referred to as DDR5 SDRAM), and the like.

[0372] Non-volatile memory may include magnetic disk storage devices and flash memory.

[0373] Flash memory may be classified into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to its operating principle; into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the number of potential levels of the cell; and into universal flash storage (UFS), embedded multimedia card (eMMC), etc. according to its memory specifications.

[0374] The random access memory may be directly read by and written to by the processor 110, or may be configured to store executable programs (e.g., machine instructions) for an operating system or other operating programs, and may be further configured to store user data, application data, etc.

[0375] The non-volatile memory may also store executable programs, user data, application data, etc. that may be previously loaded into the random access memory for direct reading and writing by the processor 110.

[0376] The external memory interface 120 may be used to connect to an external non-volatile memory to expand the storage capabilities of the electronic device. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, music, video, and other files may be stored in the external non-volatile memory.

[0377] The electronic device may implement audio functions, such as playing and recording music, using an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, an application processor, etc.

[0378] Audio module 170 is configured to convert digital audio information to an analog audio signal output, and is further configured to convert an analog audio input to a digital audio signal. Audio module 170 may be further configured to code and decode audio signals. In some embodiments, audio module 170 may be disposed within processor 110, or some functional modules of audio module 170 may be disposed within processor 110.

[0379] Speaker 170A, also called a "loudspeaker," is configured to convert audio electrical signals into voice signals. Electronic device 100 may use speaker 170A to listen to music or to receive hands-free calls.

[0380] Receiver 170B, also referred to as an "earpiece," is configured to convert electrical audio signals into sound signals and may be placed near a human ear to receive voice when using an electronic device to answer a call or receive voice information.

[0381] The microphone 170C, also referred to as a "microphone" or "microphone", is configured to convert a voice signal into an electrical signal. When a user makes a call or transmits voice information, the user may emit a sound near the microphone 170C through the user's mouth to input a sound signal into the microphone 170C. At least one microphone 170C may be disposed in the electronic device. In some other embodiments, two microphones 170C may be disposed in the electronic device to implement a noise reduction function in addition to capturing a voice signal. In some other embodiments, three, four, or more microphones 170C may alternatively be disposed in the electronic device to collect a sound signal, reduce noise, identify a sound source, implement a directional recording function, and the like.

[0382] Headset jack 170D is configured to connect to a wired headset and may be a USB port 130, a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0383] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display 194. There are multiple types of pressure sensor 180A, such as resistive pressure sensor, inductive pressure sensor, and capacitive pressure sensor. The capacitive pressure sensor may include at least two parallel plates made of a conductive material. When a force is applied to the pressure sensor 180A, a capacitance between the electrodes changes. The electronic device determines the pressure intensity based on the change in capacitance. When a touch operation is performed on the display 194, the electronic device detects the intensity of the touch operation by using the pressure sensor 180A. The electronic device may also calculate a touch location based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations performed at the same touch location but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation with an intensity of the touch operation less than a first pressure threshold is performed on a message application icon, an instruction to view SMS messages is executed. Instructions are executed to create a new SMS message when a touch action is made on the messages application icon, the touch action having an intensity equal to or greater than a first pressure threshold.

[0384] The gyro sensor 180B may be configured to determine the motion attitude of the electronic device. In some embodiments, the angular velocity of the electronic device about three axes (i.e., axes x, y, and z) may be determined by using the gyro sensor 180B. The gyro sensor 180B may be configured to implement camera shake correction during shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the jitter angle of the electronic device and calculates the distance that the lens module should correct based on the angle, allowing the lens to offset the jitter of the electronic device through the inversion motion to implement camera shake correction. The gyro sensor 180B may further be used in navigation scenarios and physical gaming scenarios.

[0385] The air pressure sensor 180C is configured to measure air pressure. In some embodiments, the electronic device calculates an altitude based on the air pressure values ​​measured by the air pressure sensor 180C to assist in positioning and navigation.

[0386] The magnetic sensor 180D includes a Hall sensor. The electronic device may use the magnetic sensor 180D to detect the opening and closing of the leather case of the flip cover. In some embodiments, when the electronic device is a flip phone, the electronic device may use the magnetic sensor 180D to detect the opening and closing of the flip cover. Further, features such as automatic unlocking when the cover is flipped open are set based on the detected opening and closing state of the leather case or the detected opening and closing state of the flip cover.

[0387] The acceleration sensor 180E may detect acceleration in various directions (usually three axes) of the electronic device. The magnitude and direction of gravity may be detected when the electronic device is stationary. The acceleration sensor 180E may be further configured to identify the orientation of the electronic device, which is used in applications such as switching between landscape and portrait modes, pedometers, etc.

[0388] The distance sensor 180F is configured to measure distance. The electronic device may measure distance via infrared or laser. In some embodiments, in a photography scenario, the electronic device may use the distance sensor 180F to measure distance and implement fast focusing.

[0389] The optical proximity sensor 180G may include optical detectors such as, for example, a light emitting diode (LED) and a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device uses the light emitting diode to emit infrared light. The electronic device uses the photodiode to detect infrared reflected light from nearby objects. The electronic device may determine that an object is present in the vicinity of the electronic device when it detects that there is a lot of reflected light. The electronic device may determine that there is no object present in the vicinity of the electronic device when it detects that there is not a lot of reflected light. By using the optical proximity sensor 180G, the electronic device may detect that a user holds the electronic device close to the ear for a call and automatically turn off the display to conserve power. The optical proximity sensor 180G may also be used in leather case mode or pocket mode to automatically unlock or lock the screen.

[0390] The ambient light sensor 180L is configured to sense the brightness of the ambient light. The electronic device may adaptively adjust the brightness of the display 194 based on the sensed brightness of the ambient light. The ambient light sensor 180L may also be configured to automatically adjust the white balance during capture. The ambient light sensor 180L may further cooperate with the optical proximity sensor 180G to detect whether the electronic device is in a pocket to avoid unintentional touches.

[0391] The fingerprint sensor 180H is configured to collect a fingerprint, and the electronic device may use collected fingerprint characteristics to implement fingerprint-based unlocking, application lock access, fingerprint-based photography, fingerprint-based call answering, and the like.

[0392] The temperature sensor 180J is configured to detect temperature. In some embodiments, the electronic device executes a temperature processing policy by using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device slows down the execution of the processor near the temperature sensor 180J to reduce power consumption and implement thermal protection. In some other embodiments, when the temperature is lower than another threshold, the electronic device boosts the heat of the battery 142 to avoid abnormal shutdown of the electronic device caused by low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0393] The touch sensor 180K may also be referred to as a "touch device." The touch sensor 180K may be disposed on the display 194, and the touch sensor 180K and the display 194 may comprise a touch screen, also referred to as a "touch screen." The touch sensor 180K is configured to detect a touch action at or near the touch sensor. The touch sensor may forward the detected touch action to an application processor to determine a type of touch event. A visual output associated with the touch action may be provided on the display 194. In some other embodiments, the touch sensor 180K may alternatively be disposed on the electronic device surface and located at a different location than the display 194.

[0394] The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, the bone conduction sensor 180M may acquire a vibration signal of the vibrating bone of the human vocal cords. The bone conduction sensor 180M may further communicate with a human pulse to receive a blood pressure pulsation signal. In some embodiments, the bone conduction sensor 180M may alternatively be disposed in a headset to acquire a bone conduction headset. The audio module 170 may analyze a voice signal based on the vibration signal of the vibrating bone of the vocal cords and acquired by the bone conduction sensor 180M to implement a voice function. The application processor may analyze heart rate information based on the blood pressure pulsation signal acquired by the bone conduction sensor 180M to implement a heart rate detection function.

[0395] The buttons 190 include a power button, a volume button, etc. The buttons 190 may be mechanical buttons or touch buttons. The electronic device may receive the button input and generate button signal inputs associated with user settings and function control of the electronic device.

[0396] The motor 191 may generate a vibration prompt. The motor 191 may be configured to generate an incoming call vibration prompt and a touch vibration feedback. For example, touch actions performed on different applications (e.g., taking pictures and playing audio) may correspond to different vibration feedback effects. For touch actions performed on different areas of the display 194, the motor 191 may correspond to different vibration feedback effects. Different application scenarios (e.g., time reminders, information reception, alarm clocks, and games) may also correspond to different vibration feedback effects. The touch vibration feedback effects may be further customized.

[0397] Indicator 192 may be an indicator light and may be configured to indicate charging status and power changes, or may be configured to indicate messages, missed calls, notifications, and the like.

[0398] The SIM card interface 195 is configured to connect to a SIM card. The SIM card may be inserted into or removed from the SIM card interface 195 to implement contact with or separation from the electronic device. The electronic device may support one or N SIM card interfaces, where N is a positive integer greater than one. The SIM card interface 195 may support nano-SIM cards, micro-SIM cards, SIM cards, etc. Multiple cards may be inserted into the same SIM card interface 195 at the same time. The multiple cards may be of the same type or of different types. The SIM card interface 195 is compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with an external storage card. The electronic device uses the SIM card to interact with the network and implement functions such as calling and data communication. In some embodiments, the electronic device uses an eSIM, i.e., an embedded SIM card. The eSIM card may be embedded in the electronic device and cannot be separated from the electronic device.

[0399] Then, the software architecture of the electronic device according to one embodiment of this application is described.

[0400] FIG. 20 is a schematic diagram of an example of a software architecture of an electronic device according to one embodiment of the present application.

[0401] Using a layered architecture, the software is divided into several layers, each with a distinct role and task, as shown in Figure 20. These layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers from top to bottom: application layer, application framework layer, system library, and kernel layer.

[0402] The application layer may include a set of application packages, which may include applications (or referred to as applications) such as camera, gallery, calendar, phone, map, navigation, WLAN, Bluetooth, music, video, messaging, etc., as shown in FIG.

[0403] The application framework layer provides the application programming interface (API) and programming framework for the applications in the application layer. The application framework layer contains some predefined functionality.

[0404] As shown in FIG. 20, the application framework layer may include a window management service, a display management service, a content provider, a view system, a telephone manager, a resource manager, a notification manager, a local profile assistant (LPA), etc.

[0405] The window management service is responsible for starting, adding, and removing windows, determining which application is displayed in a window, creating, destroying, and changing the properties of application layers, determining whether there is a status bar, locking the screen, capturing the screen, etc.

[0406] The display management service can get the number of display areas and the size of the display areas, and is responsible for starting, adding, and removing display areas.

[0407] Content providers are configured to store and retrieve data and make the data accessible by applications. Data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0408] The telephone manager is configured to provide communication functions for the electronic device, such as, for example, managing call status (including answering calls, blocking calls, etc.).

[0409] The resource manager provides various resources to an application, such as localized strings, icons, pictures, layout files, video files, etc.

[0410] A notification manager may be configured to allow an application to display notification information in the status bar and to convey notification messages that may disappear automatically after a short pause without requiring user interaction. For example, a notification manager may be used to notify of download completion, provide message notifications, etc. A notification manager may alternatively be a notification that appears in the system's top-level status bar in the form of a graph or scroll bar text, e.g., a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog interface. For example, text information may be displayed in the status bar, a prompt tone may be produced, the electronic device may vibrate, or an indicator light may flash.

[0411] A view system includes visual controls, such as a control for displaying text, a control for displaying a picture, etc. The view system may be configured to build an application. A display interface may include one or more views. For example, a display interface that includes an SMS message notification icon may include a view for displaying text and a view for displaying a picture.

[0412] The application framework layer may further include an animation system.

[0413] As shown in FIG. 20, the animation system for performing the animation effect display method provided in one embodiment of this application includes the following steps:

[0414] S2001: Set animation effects via the animation interface.

[0415] The animation system provides an animation interface to application developers. Application developers may set animation effects for any one or more controls by invoking the animation interface.

[0416] S2002: The duration of the animation effect, description information of the end frame of the animation effect, etc. are determined.

[0417] After an application initiates an operation and receives an animation trigger event, the animation system may determine the duration of the animation effect, descriptive information about the end frame of the animation effect, and the like.

[0418] S2003: Determine descriptive information for each frame during the duration of the animation effect.

[0419] The animation system may then determine descriptive information for the currently being rendered frame based on the duration of the animation effect, the descriptive information for the end frame of the animation effect, the start time of the animation effect, and the time of the currently being rendered frame, where the descriptive information for the currently being rendered frame includes properties of the controls for that frame.

[0420] S2004: Update the render tree based on descriptive information about each frame.

[0421] The animation system then updates the render tree based on the descriptive information about the frame currently being rendered.

[0422] Finally, the updated render tree is forwarded to the underlying graphics processing library, which calls the GPU or CPU to perform certain drawing operations to produce a bitmap, which is received by the display driver and then sent for display.

[0423] The runtime includes the kernel library and the virtual machine. The runtime is responsible for scheduling and managing the operating system.

[0424] The kernel library includes two parts: the functions called in the Java language and the kernel library.

[0425] The application layer and application framework layer run on a virtual machine. The virtual machine executes the Java files in the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, garbage collection, etc.

[0426] The system library may include multiple functional modules, such as a surface manager, a media library, and a graphics processing library, which may include a three-dimensional graphics processing library (e.g., OpenGL ES) and a two-dimensional graphics engine (e.g., SGL).

[0427] The Surface Manager is configured to manage the display subsystem and provide a blend of two-dimensional (2D) and three-dimensional (3D) layers for multiple applications.

[0428] The media library supports playback and recording in multiple commonly used audio and video formats, as well as still image files, etc. The media library may support multiple audio and video encoding formats, including MPEG-4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0429] The 3D graphics processing library is configured to implement 3D graphics drawing, image rendering, layer compositing, layer processing, etc.

[0430] The 2D Graphics Engine is a drawing engine for 2D drawing.

[0431] The kernel layer is the layer between the hardware and the software. The kernel layer includes at least the display driver, the camera driver, the audio driver, the sensor driver, and the virtual card driver.

[0432] Depending on the context, the term "when" used in the above embodiments may be interpreted as "if," "after," "in response to determining," or "in response to detecting." Similarly, depending on the context, the phrase "when it is determined that," or "when (the stated condition or event) is detected," may be interpreted as "when it is determined that," "in response to determining," "when (the stated condition or event) is detected," or "in response to detecting (the stated condition or event)."

[0433] All or part of the above-mentioned embodiments may be implemented by software, hardware, firmware, or any combination thereof. When software is used to implement the above-mentioned embodiments, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of this application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (e.g., coaxial cable, optical fiber, or digital subscriber line) or wireless (e.g., infrared, radio, or microwave) manner. The computer-readable storage medium may be any available medium accessible by a computer, or a data storage device such as a server or data center that incorporates one or more available media. The usable media may be magnetic media (e.g., floppy disk, hard disk, or magnetic tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state drive), and the like.

[0434] Those skilled in the art may understand that all or part of the steps of the method in the embodiment may be implemented by a computer program that instructs relevant hardware. The program may be stored in a computer-readable storage medium. When the program is run, the steps of the method in the embodiment are performed. The aforementioned storage medium includes any medium that can store program code, such as a ROM, a random access memory RAM, a magnetic disk, or an optical disk.

Claims

1. An animation effect display method applied to an electronic device, comprising: determining, after receiving an animation trigger event by a UI thread of an application, descriptive information regarding a duration of the first animation effect, a start time of the first animation effect, and an end frame of the first animation effect based on information regarding a first animation effect of a first group of controls set by the application, the first group of controls including one or more controls, the animation trigger event being used to trigger display of the first animation effect; determining descriptive information for a target frame based on descriptive information for the start time of the first animation effect, the duration of the first animation effect, a time corresponding to the target frame, and an end frame of the first animation effect when generating display data for the target frame during the duration of the first animation effect; generating, by a rendering thread or process of the application, the display data for the target frame based on the descriptive information for the target frame.

2. The method of claim 1 , wherein information regarding the first animation effect is set by the application through an animation interface provided by a system.

3. Specifically, when generating display data for a target frame during the duration of the first animation effect, determining descriptive information for the target frame based on descriptive information for a start time of the first animation effect, the duration of the first animation effect, a time corresponding to the target frame, and an end frame of the first animation effect includes:

3. The method of claim 1 or 2, comprising determining, by the UI thread or the rendering thread or the rendering process, the description information for the target frame based on description information for the start time of the first animation effect, the duration of the first animation effect, the time corresponding to the target frame, and the end frame of the first animation effect.

4. The method comprises: determining, by the UI thread, a property of a control at the end frame of the first animation effect based on the description information for the end frame of the first animation effect; determining, by the UI thread, a second set of controls that have properties that change during the duration of the first animation effect by comparing the properties of the controls at the end frame of the first animation effect with properties of controls that were shown before the first animation effect began, the second set of controls being controls whose properties change during the duration of the first animation effect, the second set of controls including the first set of controls; 4. The method of claim 1, further comprising: displaying the first group of controls with a first animation effect; displaying the second group of controls other than the first group of controls with a second animation effect; and further using the animation trigger event to trigger display of the second animation effect.

5. 5. The method of claim 4, wherein the descriptive information about the target frame is further used to determine properties of the control in the second group of controls in the target frame, the properties of the control including at least one of a size of the control, a location of the control, and a transparency of the control.

6. Specifically, generating the display data of the target frame based on the description information of the target frame by a rendering thread or a rendering process includes:

6. The method of claim 1, further comprising: updating, by the rendering thread or the rendering process, a first render tree based on the description information for the target frame; and generating, by the rendering thread or the rendering process, the display data for the target frame based on the updated first render tree.

7. Specifically, updating a first render tree based on the description information about the target frame by the rendering thread or the rendering process includes:

7. The method of claim 6, further comprising updating, by the rendering thread or the rendering process, the first render tree based on properties of the controls in the second group of controls in the target frame.

8. The method comprises: the second control group includes a third control; and 8. The method of claim 7, comprising: adjusting, by the rendering thread or the rendering process, a size of content held in the third control based on a size of the third control and a preset policy, the held content including at least one of an image and text.

9. the third control is an image control ImageView, and the content held in the third control is a first image; The method of claim 8 , wherein the policy includes comparing a size of the third control to a size of the first image and cropping or scaling the first image.

10. the third control is a text control, TextView, and the content held in the third control is a first text; The method of claim 8 , wherein the policy includes comparing a width of the third control to a width of the first text and performing line breaking or joining on the first text.

11. the first render tree is a render tree corresponding to the end frame of the first animation effect; or The method of any one of claims 6 to 10, wherein the first render tree is a render tree corresponding to an interface shown before the first animation effect is started.

12. after receiving an animation trigger event by a UI thread of an application, determining, based on information about a first animation effect of a first group of controls set by the application, descriptive information about a duration of the first animation effect, a start time of the first animation effect, and an end frame of the first animation effect; 12. The method of claim 1, further comprising: unregistering, by the UI thread, an animation callback CALLBACK_ANIMATION of the first animation effect, the animation callback being used to trigger the UI thread to modify a property of the control in the first set of controls.

13. The method comprises: receiving, by the UI thread, a vertical synchronization signal at a first instant during the duration of the first animation effect, and generating, by the rendering thread or the rendering process, the display data for the target frame at a second instant based on descriptive information about the target frame; The method according to any one of claims 1 to 12, wherein the second instant is after a first duration of the first instant, the first duration being preset.

14. The method comprises: determining, by the rendering thread or the rendering process, second parameters during the duration of the first animation effect, the second parameters including both a size and a location of the control in the first group of controls; sending, by the rendering thread or the rendering process, the second parameter to the UI thread; The method of any one of claims 1 to 13, further comprising determining, by the UI thread, the size and the location of the control in the first group of controls based on the second parameter.

15. The method of any one of claims 1 to 14, wherein the animation trigger event comprises at least one of a user interaction, a network status change, and a message sent to the application by another application on the electronic device.

16. 1. An electronic device, the electronic device comprising one or more processors and a memory; 16. An electronic device, wherein the memory is coupled to the one or more processors, the memory being configured to store computer program code, the computer program code comprising computer instructions, and the one or more processors calling the computer instructions to enable the electronic device to perform the method of any one of claims 1 to 15.

17. A chip system applied to an electronic device, the chip system including one or more processors, the processors calling computer instructions to enable the electronic device to perform the method according to any one of claims 1 to 15.

18. A computer readable storage medium comprising instructions which, when run on an electronic device, enable the electronic device to perform the method of any one of claims 1 to 15.

19. A computer program product comprising computer readable instructions, which when executed by one or more processors implements the method of any one of claims 1 to 15.

Citation Information

Patent Citations

  • Animation rendering method and device, computer readable storage medium and computer equipment

    CN112070864A

  • Multiple level graphics processing system and its method

    JP2003157443A

  • Smooth transitions between animations

    JP2009501388A

  • Multiple-level graphics processing system and method

    US20070057943A1