WO2022083326A1 - Method and apparatus for displaying scroll bar, and electronic device and readable storage medium - Google Patents

Method and apparatus for displaying scroll bar, and electronic device and readable storage medium Download PDF

Info

Publication number
WO2022083326A1
WO2022083326A1 PCT/CN2021/116840 CN2021116840W WO2022083326A1 WO 2022083326 A1 WO2022083326 A1 WO 2022083326A1 CN 2021116840 W CN2021116840 W CN 2021116840W WO 2022083326 A1 WO2022083326 A1 WO 2022083326A1
Authority
WO
WIPO (PCT)
Prior art keywords
scroll bar
animation
page
disappearing
frame rate
Prior art date
Application number
PCT/CN2021/116840
Other languages
French (fr)
Chinese (zh)
Inventor
郭晨
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022083326A1 publication Critical patent/WO2022083326A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/0485Scrolling or panning
    • G06F3/04855Interaction with scrollbars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/802D [Two Dimensional] animation, e.g. using sprites

Definitions

  • the embodiments of the present application relate to terminal display technologies, and in particular, to a scroll bar display method, apparatus, electronic device, and readable storage medium.
  • a scroll bar When the page cannot display all the content, a scroll bar will be displayed on the page to represent the position of the content displayed on the page among all the content.
  • the scroll bar When the user slides the page, the scroll bar will change position according to the slide of the page, and when the sliding page is stationary, the scroll bar will also be stationary and gradually disappear.
  • the process of changing the position of the scroll bar on the page and the process of gradually disappearing the scroll bar are both processes in which the terminal device displays the animation of the scroll bar.
  • the terminal device may draw the disappearing animation of the scroll bar according to the system frame rate, and display the disappearing animation of the scroll bar when the scroll bar is stationary, and then the scroll bar on the page will gradually disappear.
  • the terminal device consumes a lot of power to draw the disappearing animation of the scroll bar according to the system frame rate.
  • Embodiments of the present application provide a scroll bar display method, apparatus, electronic device, and readable storage medium, which can reduce the power consumption of the scroll bar and the power consumption of the system-on-chip SOC of the browsing scene to which the scroll bar belongs.
  • an embodiment of the present application provides a method for displaying a scroll bar, and the method can be applied to a terminal device or a chip in the terminal device.
  • the following description takes the terminal device as an example.
  • the scroll bar display method when the scroll bar on the page slides, a sliding animation is displayed on the page, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the elements on the page
  • the scroll bar on the page is static, the disappearing animation of the scroll bar is displayed on the page, and the frame number of the disappearing animation of the scroll bar is the same as that of the scroll bar.
  • the preset frame rate is related, and the preset frame rate is smaller than the system frame rate.
  • the frame rate is the number of frames displayed in a unit time
  • the meaning of "correlation" is that the number of frames can be calculated from the frame rate.
  • the number of frames of the animation can be obtained by calculating the frame rate.
  • the number of frames per unit time can be determined according to the frame rate, and then the number of frames of the animation can be obtained according to the duration of the animation and the number of frames per unit time.
  • the number of frames of the disappearing animation of the scroll bar is related to the preset frame rate, which means that the number of frames of the disappearing animation of the scroll bar is calculated by the preset frame rate.
  • the number of frames per unit time can be determined according to the preset frame rate, and then According to the duration of the disappearing animation of the scroll bar and the number of frames per unit time, the frame number of the disappearing animation of the scroll bar is obtained.
  • the frame number of the sliding animation is related to the system frame rate, which means that the frame number of the sliding animation is calculated by the system frame rate.
  • the sliding animation of the scroll bar when the scroll bar on the page slides, the sliding animation of the scroll bar can be displayed on the page, and the number of frames of the sliding animation of the scroll bar is related to the system frame rate; when the scroll bar on the page is stationary , to display the disappearing animation of the scroll bar on the page.
  • the number of frames of the disappearing animation of the scroll bar is related to the system frame rate. That is to say, in the current technical solution, the animation of the scroll bar is displayed at the system frame rate when displaying the animation of the scroll bar on the page, wherein the animation of the scroll bar includes the sliding animation of the scroll bar and the disappearing animation of the scroll bar.
  • the disappearing animation of the scroll bar when the disappearing animation of the scroll bar is displayed on the page, it can be displayed at a preset frame rate lower than the system frame rate, thereby reducing the number of frames of the disappearing animation of the scroll bar displayed on the terminal device.
  • the terminal device uses the system frame rate to draw the sliding animation and the disappearing animation of the scroll bar, while in the embodiment of the present application, the terminal device uses the system frame rate to draw the sliding animation, but uses the preset frame rate to draw the scrolling animation.
  • the disappearing animation of the bar the preset frame rate is lower than the system frame rate.
  • the terminal device can detect the motion state of the scroll bar on the page in real time to determine whether the scroll bar on the page is stationary.
  • the terminal device may detect and detect the position of the scroll bar on the page to determine whether the scroll bar on the page is stationary. Wherein, if the position does not change within a preset time period, it is determined that the scroll bar on the page is stationary. If the position changes within a preset time period, it is determined that the scroll bar on the page is not stationary, and the scroll bar slides.
  • the terminal device when the terminal device detects the sliding of the scroll bar on the page, it can draw the sliding animation of the scroll bar at the system frame rate, and then display the sliding animation of the scroll bar on the page.
  • the terminal device When the terminal device detects that the scroll bar on the page is still, it can draw the disappearing animation of the scroll bar at a preset frame rate, and then display the disappearing animation of the scroll bar on the page.
  • the number of frames of the disappearing animation of the scroll bar is smaller than the number of frames of the disappearing animation of the scroll bar currently drawn at the system frame rate.
  • the dynamic elements when the scroll bar on the page is static, there are still dynamic elements on the page, such as dynamic pictures or videos, the dynamic elements do not include the scroll bar.
  • the terminal device may display the disappearing animation of the scroll bar and the dynamic element on the page, and the frame number of the dynamic element is related to the system frame rate.
  • the relationship between the frame number of the dynamic element and the system frame rate means that the terminal device draws the dynamic element at the system frame rate, and the frame number of the dynamic element is obtained by calculating the system frame rate.
  • the dynamic elements in order to enable the user to see continuous and smooth dynamic elements on the page, the dynamic elements may be drawn at the system frame rate, and in order to reduce the power consumption of the scroll bar, the scroll bar may be drawn at the preset frame rate. disappearing animation.
  • the process for the terminal device to draw the dynamic element at the system frame rate is similar to the process for the terminal device to draw the disappearing animation of the scroll bar at the preset frame rate. process.
  • the manner in which the terminal device uses a preset frame rate to draw the disappearing animation of the scroll bar may be as follows: Scrollbar disappearing animation.
  • the terminal device may store first preset brightness change information, where the first preset brightness change information is used to indicate the brightness of the scroll bar in the disappearance animation of the scroll bar.
  • the first preset brightness change information is a brightness change curve of the scroll bar.
  • the process of invoking the drawing code of the disappearing animation of the scroll bar by the terminal device is to draw the scroll bar at the preset frame rate according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary.
  • the disappearing animation of the bar is to draw the scroll bar at the preset frame rate according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary.
  • the terminal device can obtain the brightness of the scroll bar, and then obtain the brightness value of the scroll bar from the first preset brightness change information according to the preset frame rate, and then obtain the brightness value of the scroll bar according to the brightness value of the scroll bar.
  • the animation frame of the scroll bar and then draw the disappearing animation of the scroll bar.
  • the frame rate of the disappearing animation of the scroll bar can be modified by modifying the drawing code of the disappearing animation of the scroll bar in advance, so as to achieve the purpose of reducing the number of frames of the disappearing animation of the scroll bar, and the drawing speed can be improved. Fast, there is no delay in the disappearing animation of the scroll bar displayed on the page.
  • the terminal device may store second preset brightness change information, where the second preset brightness change is used to indicate a preset number of the scroll bar in the disappearance animation of the scroll bar Brightness value, the preset number is equal to the frame number of the disappearing animation of the scroll bar. That is, the number of brightness values of the scroll bar indicated by the second preset brightness change information is related to the preset frame rate.
  • the terminal device may generate a disappearing animation of the scroll bar according to the second preset brightness change information.
  • the terminal device may generate a corresponding animation frame of the scroll bar according to the brightness value of the scroll bar indicated by the second preset brightness change information, and then obtain the disappearance animation of the scroll bar.
  • the frame rate of drawing the disappearing animation of the scroll bar can be modified by modifying the generation function of the disappearing animation of the scroll bar in advance, so as to achieve the purpose of reducing the number of frames of the disappearing animation of the scroll bar, and on the page There is no delay in the disappearing animation of the displayed scroll bar.
  • the terminal device detects that the scroll bar on the page is stationary, and may display the first animation frame of the preset disappearance animation of the scroll bar on the page.
  • the number of frames of the preset disappearing animation is related to the system frame rate.
  • the preset disappearing animation can be The animation is processed by frame extraction to obtain the disappearing animation of the scroll bar.
  • a preset frame rate may be pre-stored in the terminal device, so as to determine the number of frames of the disappearing animation of the scroll bar, and perform frame extraction processing with the preset disappearing animation, so as to obtain the scrolling of the frame number corresponding to the preset frame rate.
  • the terminal device can detect the first frame of the disappearing animation.
  • frame extraction processing is performed on the preset disappearing animation of the scroll bar, so as to obtain the disappearing animation of the scroll bar.
  • the relationship between the frame number of the preset disappearing animation and the system frame rate means that the terminal device draws the preset disappearing animation at the system frame rate, and the frame number of the preset disappearing animation is calculated by the system frame rate.
  • an embodiment of the present application provides a display device for a scroll bar.
  • the display device for the scroll bar is the terminal device or the chip in the terminal device according to the first aspect.
  • the display device for the scroll bar includes:
  • a display module configured to display a sliding animation on the page when the scroll bar on the page slides, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the sliding animation of the elements on the page , the element on the page includes the scroll bar.
  • the display module is also used to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary.
  • the number of frames of the disappearing animation of the scroll bar is related to the preset frame rate, and the preset frame rate is smaller than the system frame rate.
  • the processing module is configured to detect the position of the scroll bar on the page; and if the position does not change within a preset time period, it is determined that the scroll bar on the page is stationary.
  • the processing module is further configured to use a preset frame rate to draw the disappearing animation of the scroll bar.
  • the display module is specifically configured to display the disappearing animation of the scroll bar and the dynamic elements on the page if there are dynamic elements on the page, and the frame number of the dynamic elements is related to the system frame rate.
  • the processing module is further configured to use a preset frame rate to draw a scroll bar disappearing animation, and use a system frame rate to draw dynamic elements.
  • the sliding animation of the scroll bar is displayed on the page, and the frame number of the sliding animation of the scroll bar is related to the system frame rate.
  • the display module is further configured to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary, and the frame number of the disappearing animation of the scroll bar is related to the preset frame rate, and the The preset frame rate is smaller than the system frame rate.
  • the processing module is configured to detect the position of the scroll bar on the page; and if the position does not change within a preset time period, determine that the scroll bar on the page is stationary.
  • the processing module is further configured to use the preset frame rate to draw the disappearing animation of the scroll bar.
  • the processing module is specifically configured to use the preset frame rate to draw the scroll bar according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary
  • the disappearing animation of the scroll bar the first preset brightness change information is used to indicate the brightness of the scroll bar in the disappearing animation of the scroll bar.
  • the first preset brightness change information is a brightness change curve of the scroll bar.
  • the processing module is further configured to generate a disappearing animation of the scroll bar according to second preset brightness change information, where the second preset brightness change information is used to indicate the A preset number of brightness values of the scroll bar in the disappearing animation, where the preset number is equal to the frame number of the disappearing animation of the scroll bar.
  • the processing module is further configured to perform frame extraction processing on the preset disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar, the number of frames of the preset disappearing animation being the same as the number of frames of the preset disappearing animation.
  • the system frame rate is related.
  • the processing module is further configured to extract the preset disappearing animation when the first animation frame in the preset disappearing animation of the scroll bar is detected on the page.
  • the frame processing is performed to obtain the disappearing animation of the scroll bar, and the frame number of the preset disappearing animation is related to the system frame rate.
  • the scroll bar display device provided in the embodiment of the present application can perform the actions of the terminal device in the foregoing method embodiments, and the implementation principle and technical effect thereof are similar, and are not repeated here.
  • an embodiment of the present application provides an electronic device, where the electronic device includes: a processor and a memory;
  • the memory is used to store computer-executable program codes, and the program codes include instructions; when the processor executes the instructions, the instructions cause the electronic device to perform the method provided by the first aspect or each possible implementation manner of the first aspect.
  • an embodiment of the present application provides a scroll bar display device, including a unit, a module, or a circuit for executing the method provided by the first aspect or each possible implementation manner of the first aspect.
  • the display device of the scroll bar may be the object to be positioned, or a module applied to the object to be positioned, for example, a chip applied to the object to be positioned.
  • embodiments of the present application provide a computer program product containing instructions, which, when run on a computer, cause the computer to execute the method in the first aspect or various possible implementations of the first aspect.
  • Embodiments of the present application provide a scroll bar display method, device, electronic device, and readable storage medium.
  • the method includes, when a scroll bar on a page slides, displaying a sliding animation on the page, and the frame number of the sliding animation is the same as the system frame.
  • the sliding animation includes the sliding animation of the elements on the page, and the elements on the page include the scroll bar; when the scroll bar on the page is stationary, the disappearing animation of the scroll bar is displayed on the page, and the number of frames of the disappearing animation of the scroll bar is the same as that of the scroll bar.
  • the preset frame rate is related, and the preset frame rate is less than the system frame rate. In this embodiment of the present application, the disappearing animation of the scroll bar can be displayed at a preset frame rate.
  • the number of frames of the disappearing animation of the scroll bar is smaller than the number of frames of the disappearing animation of the scroll bar obtained at the system frame rate, which can reduce the power consumption of the scroll bar. , it can also reduce the power consumption of the system-on-chip SOC of the browsing scene to which the scroll bar belongs.
  • Fig. 1 is the display schematic diagram of a kind of scroll bar
  • Fig. 2 is the schematic diagram showing the animation of scroll bar on the current page
  • FIG. 3 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at the system frame rate;
  • FIG. 4 is a schematic flowchart of an embodiment of a method for displaying a scroll bar according to an embodiment of the present application
  • FIG. 5 is a schematic diagram 1 of an animation displaying a scroll bar on a page according to an embodiment of the present application
  • FIG. 6 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at a preset frame rate
  • FIG. 7 is a schematic diagram 2 of an animation displaying a scroll bar on a page according to an embodiment of the present application
  • Fig. 8 is the code schematic diagram that draws the disappearance animation of the scroll bar with the system frame rate
  • FIG. 9 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a brightness change curve of a scroll bar
  • FIG. 11 is a schematic diagram of a brightness change value of a scroll bar
  • FIG. 12 is a schematic flowchart of another embodiment of a method for displaying a scroll bar provided by an embodiment of the present application.
  • FIG. 13 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application.
  • FIG. 14 is a schematic diagram 3 of an animation displaying a scroll bar on a page according to an embodiment of the present application.
  • FIG. 15 is a schematic structural diagram of a display device for scroll bars according to an embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 1 is a schematic diagram of a display of a scroll bar.
  • the page displayed on the interface 101 includes a scroll bar, and the scroll bar may be located on the right side of the page.
  • the position of the scroll bar will change with the position of the content presented on the page in all the content.
  • the position of the scroll bar changes from the position in interface 101 to that in interface 102. s position.
  • the scroll bar is also stationary, and the scroll bar will gradually disappear, as shown in interface 103 . After the scroll bar disappears, the scroll bar will reappear until the user manipulates the page again.
  • the scroll bar in the interface 102 is static as an example, wherein the time for the interface 102 to be transformed into the interface 103 is very short, such as 280 ms. It should be understood that the scroll bar display manner in FIG. 1 may be applied to a terminal device, and the terminal device is a mobile phone as an example for description in FIG. 1 .
  • the terminal device usually performs two scroll bar drawing, and the power consumption of the scroll bar is consumed in the two scroll bar drawing.
  • the drawing of the two scroll bars may be performed by a graphics processing unit (graphics processing unit, GPU) in the terminal device.
  • graphics processing unit graphics processing unit, GPU
  • the GPU performs the first scroll bar drawing.
  • the GPU performs the second scroll bar drawing.
  • the first time the GPU performs the drawing of the scroll bar means that the GPU obtains the sliding animation of the scroll bar, so that the terminal device displays the sliding animation of the scroll bar on the page.
  • the GPU may draw sliding animations of other elements on the page when the first scroll bar is drawn.
  • the second time the GPU performs the drawing of the scroll bar refers to: the GPU obtains the drawing of the disappearing animation of the scroll bar, so that the terminal device displays the disappearing animation of the scroll bar on the page.
  • the drawing frame rate of the animation (sliding animation or disappearing animation) of the GPU for drawing the scroll bar can be the same as the display frame rate of the animation for displaying the scroll bar of the terminal device, that is, what is the animation of the GPU for drawing the scroll bar? If the frame rate is set, the animation of the scroll bar will be displayed according to the frame rate.
  • the GPU executes the first scroll bar drawing process
  • the entire page is sliding, and other elements in the page (such as text, pictures, etc. in Figure 1) also need to be Synchronized drawing.
  • the GPU will call rendering code, UI display code, etc. to draw scroll bars and other elements on the page. Therefore, when the GPU performs the first scroll bar drawing, the power consumption used by the GPU to call the rendering code, UI display code, etc. is allocated to the drawing of other elements in the page and the drawing of the scroll bar, and the drawing of the scroll bar occupies the GPU calling code. part of the power consumption used.
  • the drawing of the scroll bar In the process of drawing the second scroll bar by the GPU, except for the scroll bar, other elements in the page are static, and the drawing of the scroll bar also requires the GPU to call the rendering code, UI display code, etc., so the GPU calling code uses
  • the power consumption is all caused by the drawing of the scroll bar.
  • the power consumption used by the GPU to call the rendering code, UI display code, etc. is the same, by comparing the two scroll bar drawing, it can be determined that the power consumption of the scroll bar mainly comes from the GPU executing the second scroll bar drawing, that is, the terminal device. Get the action of the scroll bar disappearing animation.
  • the sliding animation of the scroll bar can be obtained.
  • the sliding animation of the scroll bar may include multiple frames of animation frames, and the number of frames of the animation frames is related to the system frame rate. If the system frame rate is 60Hz, the sliding animation of the scroll bar can include 17 animation frames.
  • the terminal device will display the 17 animation frames, and the user can see the scroll bar sliding on the page through the 17 animation frames.
  • the disappearing animation of the scroll bar may be obtained, wherein the disappearing animation of the scroll bar may include multiple frames of animation frames, and the number of animation frames is related to the system frame rate.
  • the disappearing animation of the scroll bar can include 17 animation frames.
  • the terminal device will display the 17 animation frames, and the user can see the scroll bar disappearing on the page through the 17 animation frames. (Because the time is very short, the user does not perceive it).
  • FIG. 2 is a schematic diagram of an animation displaying a scroll bar on a current page.
  • the system frame rate is 60 Hz as an example, and the animation process of drawing a scroll bar is used for description.
  • the GPU draws the sliding animation of the scroll bar at the system frame rate of 60Hz, and calls eglswapbuffer for display (that is, the sliding animation of the scroll bar is sent to the graphics card in the terminal device for display), so that the terminal The sliding animation of the scroll bar is displayed on the page of the device.
  • the current display frame rate and the drawing frame rate are the same, and both are 60 Hz.
  • the sliding animation of the scroll bar can be displayed on the page of the terminal device at 60 Hz.
  • the GPU draws the disappearing animation of the scroll bar at the system frame rate of 60Hz, and calls eglswapbuffer to send it for display, so that the disappearing animation of the scroll bar is displayed on the page of the terminal device, such as the disappearing animation of the scroll bar on the terminal device.
  • the sliding animation of the scroll bar can be displayed on the page at 60Hz, that is, 17 animation frames are displayed.
  • eglswapbuffer is a function that is called when the animation drawn by the GPU is sent to display
  • the animation drawn by the GPU may include the animation of the scroll bar drawn by the GPU, and the animation of other elements on the page drawn by the GPU.
  • FIG. 3 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at the system frame rate.
  • the transparency of the scroll bar may gradually decrease until the transparency becomes 0 and the scroll bar disappears.
  • FIG. 3 takes an example of displaying the disappearing animation of the scroll bar at a system frame rate of 60 Hz, wherein the terminal device displays 17 animation frames to display the disappearing animation of the scroll bar.
  • the scroll bar can also disappear in the form of a sudden change.
  • the first 10 animation frames are animation frames with scroll bars
  • the last 7 animation frames are animation frames without scroll bars.
  • the scroll bars disappear. method is not limited.
  • the main purpose of FIG. 3 is to reflect the problem of a large number of frames of the disappearing animation when the GPU draws the disappearing animation of the scroll bar at the system frame rate at present.
  • the system frame rate may also be referred to as the refresh frame rate of the terminal device.
  • the higher the system frame rate the more coherent the picture the user sees, and the better the user experience.
  • the system frame rate of the terminal device is 30 Hz.
  • the current system frame rate of the terminal device is very high, usually higher than 60 Hz.
  • the GPU performs the second scroll bar drawing, the GPU draws the scroll bar disappearing animation at the system frame rate, and correspondingly, the terminal device displays the scroll bar disappearing animation at the system frame rate.
  • the duration of the disappearing animation of the scroll bar is fixed at about 280ms.
  • the number of frames of the disappearing animation displayed by the terminal device is about 17 frames.
  • the number of frames of the disappearing animation displayed by the terminal device is about 25 frames.
  • the number of frames of the disappearing animation displayed by the terminal device is about 34 frames. That is to say, the higher the system frame rate, the more frames the GPU draws the disappearing animation of the scroll bar, and the higher the power consumption of the GPU to perform the second drawing, resulting in the greater power consumption of the scroll bar.
  • the power consumption of the scroll bar can be reduced by reducing the power consumption of the GPU performing the second scroll bar drawing, and the Because the power consumption of the GPU for the second scroll bar drawing comes from the excessive number of frames of the disappearing animation, in order to reduce the power consumption of the scroll bar, the embodiment of the present application provides a scroll bar display method, which can By reducing the number of frames of the disappearance animation of the scroll bar performed by the GPU for the second time, the power consumption of the GPU to perform the drawing of the scroll bar for the second time is reduced, that is, the number of frames of the disappearance animation of the scroll bar displayed by the terminal device is reduced, thereby reducing the power consumption of the scroll bar.
  • the frame rate of the disappearing animation of the scroll bar can be obtained by reducing the method. Reduce the power consumption of scroll bars.
  • the execution subject of the scroll bar display method in the embodiment of the present application may be a terminal device, or a GPU or other processing chip in the terminal device, or the like.
  • the terminal device is used as an example for illustration. It should be understood that the terminal device in this embodiment of the present application may be referred to as a user equipment (user equipment, UE), a mobile terminal (mobile terminal), a terminal (terminal), and the like.
  • the terminal device can be a personal digital assistant (PDA), a handheld device with wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (virtual reality, VR) terminal device, an augmented reality (augmented reality, AR) terminal equipment, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, Wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc.
  • PDA personal digital assistant
  • a handheld device with wireless communication function a computing device, a vehicle-mounted device or a wearable device
  • a virtual reality (virtual reality, VR) terminal device an augmented reality (augmented reality, AR) terminal equipment
  • wireless terminals in industrial control wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, Wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc.
  • the form of the terminal device is not specifically limited in the embodiments of the present application
  • the display method for executing the scroll bar in the embodiment of the present application may be applicable to a vertical scroll bar, a horizontal scroll bar, or a scroll bar displayed obliquely, and the form of the scroll bar is not limited in the embodiment of the present application .
  • FIG. 4 is a schematic flowchart of an embodiment of a method for displaying a scroll bar according to an embodiment of the present application. As shown in FIG. 4 , the display method of the scroll bar provided by the embodiment of the present application may include:
  • each time the user slides the page two animations of the scroll bar are displayed on the page.
  • the scroll bar on the page also slides, and a sliding animation can be displayed on the page at this time.
  • the sliding animation includes the sliding animation of the element on the page, and the element on the page may include the scroll bar .
  • a text sliding animation and a scroll bar sliding animation can be displayed on the page.
  • the sliding animation of the scroll bar may include an animation of changing the position of the scroll bar, or may also include an animation of changing the size and position of the scroll bar.
  • the terminal device may detect that the scroll bar on the page slides or is still, and determine to display the animation of the scroll bar on the page.
  • the terminal device can detect whether the scroll bar on the page is still, and if the scroll bar on the page is not still (sliding), a sliding animation of the scroll bar is displayed on the page, and if the scroll bar is still on the page, the scroll bar is displayed on the page. The disappearing animation of the bar.
  • One way for the terminal device to detect whether the scroll bar sliding on the page is stationary is: because the scroll bar is stationary when the page is stationary, in this embodiment of the present application, whether the scroll bar is stationary can be determined by detecting whether the page is stationary. Detecting if a page is stationary You can determine if a page is stationary by detecting the positions of elements on the page. Wherein, if the position of an element on the page does not change within the preset time period, it can be determined that the page is stationary, otherwise, the page is not stationary. Wherein, if it is detected that the page is stationary, it can be determined that the sliding scroll bar is stationary, and if the page is not stationary, it can be determined that the sliding scroll bar is not stationary. It should be understood that, in the process of page sliding, the elements on the page detected by the terminal device may be different.
  • the above method can detect whether the sliding scroll bar is still, it is necessary to detect whether the page is still, that is, to detect whether the scroll bar is still in an indirect way, which has low detection efficiency.
  • This embodiment of the present application can detect whether the scroll bar is stationary by detecting the position of the scroll bar, which can improve the detection efficiency.
  • Another way for the terminal device to detect whether the scroll bar sliding on the page is static is: in the process of page sliding, the length and position of the scroll bar are adaptively changed with the change of the position of the content on the page in all the content. of.
  • the terminal device may detect, update and record the position of the scroll bar during the sliding process and the size of the scroll bar in real time.
  • the terminal device can determine whether the scroll bar is stationary by querying the position of the scroll bar recorded in real time. If the position of the scroll bar does not change within the preset time period, it can be determined that the scroll bar sliding on the page is stationary; if the position of the scroll bar changes within the preset time period, it can be determined that the scroll bar sliding on the page is not stationary.
  • FIG. 5 is a schematic diagram 1 of an animation displaying a scroll bar on a page according to an embodiment of the present application.
  • the system frame rate is used to draw the sliding animation of the scroll bar as an example. It is the same as the above Figure 2. If the system frame rate is 60 Hz, the terminal device draws the sliding animation of the scroll bar at the system frame rate of 60 Hz, and calls eglswapbuffer to send the display.
  • the animation frame of the sliding animation of the 17-frame scroll bar is displayed on the page of the terminal device.
  • the frame rate is the number of frames displayed in a unit time, and the meaning of "related" is that the frame rate can be calculated by the frame rate.
  • the number of frames in a unit time eg, 1 s
  • the number of frames of the animation may be obtained according to the duration and the number of frames in the unit time.
  • the number of frames of the sliding animation is related to the system frame rate, which means that the number of frames of the sliding animation is calculated by the system frame rate.
  • the terminal device can determine the number of frames per unit time according to the frame rate set by the system, and then obtain the number of frames of the sliding animation according to the duration of the sliding animation and the number of frames per unit time.
  • the terminal device may obtain the disappearing animation of the scroll bar to display the disappearing animation of the scroll bar on the page, so that the user can see the disappearance of the scroll bar on the page.
  • the terminal device draws the disappearing animation of the scroll bar at the system frame rate, and the number of frames of the disappearing animation of the scroll bar is related to the system frame rate, resulting in the disappearing animation frame of the scroll bar. If the number is too large, the power consumption of the scroll bar is large.
  • the number of frames of the disappearing animation of the scroll bar acquired by the terminal device is related to the preset frame rate, where the preset frame rate is smaller than the system frame rate. That is to say, the number of frames of the disappearing animation of the scroll bar in the embodiment of the present application is less than the number of frames of the disappearing animation of the scroll bar drawn at the system frame rate, thereby reducing the power consumption of the terminal device to obtain the disappearing animation of the scroll bar, to reduce the power consumption of the scroll bar.
  • the scroll bar can be reduced by reducing the frame rate of the disappearing animation of the scroll bar.
  • the preset frame rate is 20Hz
  • the terminal device can draw the disappearance animation of the scroll bar at the preset frame rate of 20Hz, and call eglswapbuffer to send the display, thereby making the terminal device's disappearance animation.
  • the disappearing animation of the scroll bar is displayed on the page, that is, 6 animation frames are displayed.
  • FIG. 6 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at a preset frame rate.
  • the transparency of the scroll bar may gradually decrease until the transparency becomes 0 and the scroll bar disappears.
  • FIG. 6 takes an example of displaying the disappearing animation of the scroll bar at a preset frame rate of 20 Hz, wherein the terminal device can display the disappearing animation of the scroll bar by displaying 6 animation frames.
  • the terminal device may continue to draw a sliding animation of the scroll bar.
  • the disappearing animation of the scroll bar is displayed on the page.
  • dynamic elements such as dynamic emoji pictures, videos, etc. may also be displayed on the page.
  • the dynamic element does not include the scroll bar.
  • the disappearing animation of the scroll bar and the dynamic element can be displayed on the page, and the frame number of the dynamic element is related to the system frame rate.
  • the relationship between the frame number of the dynamic element and the system frame rate means that the terminal device draws the dynamic element at the system frame rate, and the frame number of the dynamic element is calculated from the system frame rate.
  • the dynamic elements in order to enable the user to see continuous and smooth dynamic elements on the page, the dynamic elements may be drawn at the system frame rate, and in order to reduce the power consumption of the scroll bar, the scroll bar may be drawn at the preset frame rate. disappearing animation. It should be understood that the process for the terminal device to draw the dynamic element at the system frame rate is similar to the process for the terminal device to draw the disappearing animation of the scroll bar at the preset frame rate. process.
  • the terminal device can draw the disappearing animation of the scroll bar at 20 Hz and the video at 60 Hz, and call eglswapbuffer to send the disappearing animation and video of the scroll bar. Then, 6 animation frames in the disappearing animation of the scroll bar and 17 video frames in the video are displayed on the page of the terminal device. Similar to the number of frames of the sliding animation is related to the system frame rate, the number of frames of the disappearing animation of the scroll bar is related to the preset frame rate means that the number of frames of the disappearing animation of the scroll bar is calculated by the preset frame rate. For example, the terminal device can determine the number of frames per unit time according to the preset frame rate, and then obtain the number of frames of the disappearing animation of the scroll bar according to the duration of the disappearing animation of the scroll bar and the number of frames per unit time.
  • the scroll bar display method provided in the embodiment of the present application includes: when the scroll bar on the page slides, displaying a sliding animation on the page, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the sliding of elements on the page Animation, the elements on the page include scroll bars; when the scroll bars on the page are stationary, the disappearing animation of the scroll bars is displayed on the page.
  • the number of frames of the disappearing animation of the scroll bars is related to the preset frame rate, and the preset frame rate is lower than the system frame rate.
  • the number of frames of the disappearing animation of the scroll bar obtained by the embodiment of the present application is smaller than the number of frames of the disappearing animation of the scroll bar obtained at the system frame rate, so the power consumption of the terminal device for displaying the disappearing animation of the scroll bar can be reduced, and thus the power consumption of the disappearing animation of the scroll bar can be reduced.
  • the power consumption of the scroll bar, and the system-on-chip power consumption of the browsing scene to which the scroll bar belongs is reduced.
  • FIG. 7 is a second schematic diagram of an animation of displaying a scroll bar on a page according to an embodiment of the present application.
  • FIG. 7 takes the application a as an example for description.
  • the page of the application a is a page including a scroll bar, and the terminal device may store the control logic code of the application a.
  • the terminal device can call the control logic code of application a (such as the code that controls the position change of the scroll bar) to draw the sliding animation of the scroll bar, and make the scroll bar slide.
  • the animation is sent and displayed on the page.
  • the terminal device can also change the size of the scroll bar on the page according to the called control logic code.
  • the terminal device can cache the position and size of the scroll bar, and call the common scroll bar disappearing drawing code in the terminal device to draw the disappearance animation of the scroll bar, and the disappearance animation of the scroll bar.
  • the terminal device can send the disappearing animation of the scroll bar to display on the page.
  • the common drawing code for the disappearance of the scroll bar can be preset in the terminal device, and the applications on the terminal device all need to call the common drawing code when drawing the disappearing animation of the scroll bar.
  • the frame rate of the scroll bar disappearing animation indicated in the scroll bar disappearing drawing code is the system frame rate, that is, the terminal device draws the scroll bar when calling the scroll bar disappearing drawing code.
  • the disappearing animation of the scroll bar is drawn at the system frame rate.
  • the frame rate indicated by the drawing code where the scroll bar disappears may be modified in advance, so that the terminal device draws the scroll bar at the preset frame rate when calling the drawing code where the scroll bar disappears.
  • the disappearing animation of the scroll bar, and the number of frames of the disappearing animation of the scroll bar is reduced to reduce the power consumption of the scroll bar. Because the drawing code for the disappearance of the scroll bar is modified in the embodiment of the present application, the display of other elements in the page is not affected.
  • FIG. 8 is a schematic diagram of the code for drawing the disappearing animation of the scroll bar at the system frame rate.
  • the interface control Activity stack to which the drawing code where the scrollbar disappears belongs, find the function that implements the scrollbars in the list view, and find the corresponding disappearance of the scrollbar in the function.
  • the code for the animation (that is, the drawing code for the scrollbar disappearing) is modified.
  • the function for implementing the scroll bar may be used to control the generation of the disappearing animation of the scroll bar. In this embodiment, the function for realizing the scroll bar is not adjusted, that is, the preset disappearing animation of the scroll bar is used.
  • the frame number of the preset disappearing animation of the scroll bar is related to the system frame rate, that is to say, the preset disappearing animation of the scroll bar is pre-drawn at the system frame rate and stored in the terminal device.
  • the number of frames of the preset disappearing animation of the scroll bar is related to the system frame rate means that the number of frames of the preset disappearing animation of the scroll bar is calculated according to the system frame rate.
  • the frame rate indicated by the drawing code where the scroll bar disappears as shown in a in FIG. 8 is the system frame rate.
  • the frame rate indicated by the drawing code where the scroll bar disappears can be modified to the preset frame rate, as shown in FIG. 8 shown in b. That is to say, what is used in the embodiment of the present application is the modified drawing code for the disappearance of the scroll bar.
  • FIG. 9 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application.
  • the above S402 can be replaced by S502: when the scroll bar on the page is stationary, call the drawing code for the disappearance of the scroll bar, draw the disappearance animation of the scroll bar, and display the disappearance animation of the scroll bar on the page.
  • the terminal device may call the common drawing code for the disappearance of the scroll bar stored in the terminal device to draw the disappearance animation of the scroll bar.
  • the drawing code is used to indicate the preset frame rate.
  • the function of realizing the scroll bar shown in FIG. 8 can be used to represent the first preset brightness change information, and the first preset brightness change information is used to indicate the brightness of the scroll bar in the disappearance animation of the scroll bar.
  • the process of drawing the disappearance animation of the scroll bar by calling the drawing code for the disappearance of the scroll bar is the process of drawing the disappearance animation of the scroll bar by the terminal device according to the first preset brightness change information.
  • the first preset brightness change information can be used to indicate the continuously changing brightness of the scroll bar.
  • the first preset brightness change information is the brightness change curve of the scroll bar
  • FIG. 10 is a schematic diagram of the brightness change curve of the scroll bar.
  • the terminal device when the scroll bar on the page is stationary, the terminal device may cache the position and size of the scroll bar, and may also cache the brightness of the scroll bar, and then the terminal device may change the information according to the first preset brightness and the scroll bar is stationary
  • the disappearing animation of the scroll bar is drawn at the preset frame rate.
  • the preset frame rate is 20 Hz
  • the terminal device can obtain the brightness of the scroll bar every about 47ms in the brightness change curve of the scroll bar, and then draw the brightness according to the obtained brightness.
  • the animation frame of the corresponding scroll bar to get the disappearing animation of the scroll bar with decreasing brightness.
  • the drawing code includes a time interval between two adjacent animation frames in the disappearing animation of the scroll bar.
  • the time interval between two adjacent animation frames is 50ms
  • the duration of the disappearance animation of the scrollbar is 280ms
  • the disappearance animation of the scrollbar may include 6 animation frames.
  • the developer can modify the time delay parameter in the drawing code (that is, the time interval between two adjacent animation frames) in the process of modifying the drawing code in the above-mentioned Fig. 8, so that the modified adjacent The time interval between two animation frames is 50ms.
  • the terminal device calls the drawing code for the disappearance of the scroll bar
  • the time interval between two adjacent animation frames in the disappearance animation of the scroll bar obtained is 50ms
  • the disappearance animation of the scroll bar includes 6 animation frames, that is, That is to say, the terminal device draws the disappearing animation of the scroll bar according to the preset frame rate, and the disappearing animation of the scroll bar is related to the preset frame rate.
  • the drawing code includes a multiple parameter, and the multiple parameter is used to represent the multiple relationship between the preset frame rate and the system frame rate. For example, if the system frame rate is 60 Hz, the multiple parameter included in the drawing code is 3. Because the preset frame rate in this embodiment of the present application is smaller than the system frame rate, it can be determined that the system frame rate is the preset frame rate according to the multiple parameter being 3. 3 times, and then the preset frame rate is 20Hz. In this way, the developer can modify the multiple parameter in the drawing code during the modification process of the drawing code in the above-mentioned FIG. 8 , so that the modified multiple parameter is 3. Correspondingly, the terminal device calls the drawing code for the disappearance of the scroll bar, and the frame rate of the disappearance animation of the scroll bar is drawn at a preset frame rate of 20 Hz, and the obtained disappearance animation of the scroll bar includes 6 animation frames.
  • the drawing code includes a preset frame rate.
  • the drawing codes in the above two methods both indirectly indicate the preset frame rate, and in this method, the preset frame rate may be directly included in the drawing code.
  • the developer can modify the frame rate in the drawing code during the modification process of the drawing code in the above-mentioned FIG. 8 , so that the frame rate of the modified drawing scroll bar disappearing animation is the preset frame rate.
  • the terminal device invokes the scroll bar disappearing drawing code, and the frame rate of the scroll bar disappearing animation is a preset frame rate of 20 Hz, and the obtained scroll bar disappearing animation includes 6 animation frames.
  • the drawing code may include a functional relationship for obtaining a preset frame rate of the disappearing animation of the scroll bar. That is to say, the terminal device can calculate the preset frame rate according to the functional relationship, that is, the drawing code can indicate the preset frame rate in an indirect manner. In this way, the developer can write the function relational expression of the preset frame rate in the process of modifying the drawing code in the above-mentioned FIG. 8 .
  • calling the drawing code for the disappearance of the scroll bar on the terminal device can obtain the preset frame rate according to the functional relationship, and then draw the disappearance animation of the scroll bar at the preset frame rate.
  • the scroll bar disappearing drawing code may be modified in advance, so that the scroll bar disappearing animation is drawn at a preset frame rate by using the modified scroll bar disappearing drawing code, thereby reducing the scroll bar disappearing animation The number of frames for the purpose of reducing the power consumption of the scroll bar.
  • the second method Similar to the first method above, it is also used to modify the code in advance to control and reduce the number of frames of the disappearing animation of the scroll bar.
  • the difference from the first method above is that the first method modifies the drawing code where the scroll bar disappears, while the second method can modify the function that implements the scroll bar. That is, in the embodiment of the present application, the number of frames of the generated scroll bar disappearance animation can be reduced by modifying the function for realizing the scroll bar.
  • the developer can find the function of implementing scrollbars in the list view in the Activity stack to which the drawing code where the scrollbar disappears belongs, and then modify the function so that the terminal device calls the function.
  • the disappearing animation of the scroll bar can be generated, and the number of frames of the disappearing animation of the scroll bar is related to the preset frame rate.
  • the generation function for modifying the disappearing animation of the scroll bar may be: modifying the generation frame rate of the disappearing animation of the scroll bar to a preset frame rate.
  • the function implementing the scroll bar is used to indicate the brightness change curve of the scroll bar.
  • the function implementing the scroll bar can be modified into a discrete function for indicating the second preset luminance variation information.
  • the second preset brightness change information is used to indicate a preset number of brightness values of the scroll bar in the disappearance animation of the scroll bar, and the preset number is equal to the frame number of the disappearance animation of the scroll bar.
  • the second preset brightness change information can be used to indicate scrolling in the disappearing animation of the scroll bar.
  • 6 brightness values of the bar such as the brightness values obtained by the terminal device every 47ms in the first method above.
  • the function for implementing the scroll bar may be a discrete function as shown in FIG. 11 .
  • FIG. 11 is a schematic diagram of the brightness change value of the scroll bar.
  • the generation function for modifying the disappearing animation of the scroll bar may be: modifying the total duration of the disappearing animation of the scroll bar, because when the frame rate of drawing the disappearing animation of the scroll bar remains unchanged, The total duration of the disappearing animation of the scroll bar can be reduced, and correspondingly, the number of frames of the disappearing animation of the scroll bar can also be reduced, thereby achieving the purpose of reducing the power consumption of the scroll bar.
  • the generation function of the modified disappearance animation and the modified drawing code for the disappearance of the scroll bar can all be preset in the terminal device.
  • the difference between the animation generation function and the drawing code where the scroll bar disappears describes the modification process.
  • FIG. 12 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application.
  • the above S402 can be replaced by S602: when the scroll bar on the page is stationary, call the generation function of the disappearing animation of the scroll bar, generate the disappearing animation of the scroll bar, and display the disappearing animation of the scroll bar on the page.
  • the terminal device may call the generation function of the disappearing animation of the scroll bar to generate the disappearing animation of the scroll bar. Because the function for generating the preset disappearing animation of the scroll bar in the terminal device is a function modified by the developer, the number of frames of the generated disappearing animation of the scroll bar is smaller than that of the preset disappearing animation.
  • the terminal device after the terminal device generates the disappearing animation of the scroll bar, it can display the disappearing animation of the scroll bar. That is, the terminal device may generate a disappearing animation of the scroll bar according to the second preset brightness change information. The terminal device may draw an animation frame of the scroll bar corresponding to the brightness value according to the preset number of brightness values indicated by the second preset brightness change information, and then obtain the disappearance animation of the scroll bar.
  • the function for generating the disappearing animation of the scroll bar may be modified in advance, so that the frame rate of the disappearing animation of the scroll bar generated by using the modified function is a preset frame rate, thereby reducing the disappearance of the scroll bar from the source.
  • the number of frames of the animation can reduce the power consumption of the scroll bar.
  • the above two methods pre-modify the scroll bar disappearing drawing code or the scroll bar disappearing animation generation function, so that the terminal device can call the modified disappearing scroll bar when drawing the scroll bar disappearing animation or generating the scroll bar disappearing animation.
  • the generation function of the disappearing animation of the drawing code or the scroll bar, and the disappearing animation of which the number of frames is less than the frame number of the preset disappearing animation is obtained.
  • the drawing code for the disappearance of the scroll bar or the generation function of the disappearing animation of the scroll bar can not be modified in advance, and the preset disappearing animation can be processed when the disappearing animation of the moving bar is drawn.
  • the disappearing animation of the number of frames of the preset disappearing animation can be processed when the disappearing animation of the moving bar is drawn.
  • FIG. 13 is a schematic flowchart of another embodiment of the scroll bar display method provided by the embodiment of the present application.
  • the above S402 can be replaced by S702: when the scroll bar on the page is stationary, and when the first animation frame in the preset disappearing animation of the scroll bar is detected on the page, the preset disappearing animation is extracted. Frame processing, get the disappearing animation of the scroll bar, and display the disappearing animation of the scroll bar on the page.
  • the terminal device when the terminal device detects that the scroll bar sliding on the page is stationary, it may start to display the preset disappearing animation according to the system frame rate.
  • the number of frames of the preset disappearing animation may be reduced. Therefore, when the terminal device detects the first frame of animation in the preset disappearing animation of the scroll bar on the page, Set the disappearing animation to perform frame extraction processing, and then obtain the disappearing animation of the scroll bar whose frame number is less than the frame number of the preset disappearing animation.
  • a preset disappearing animation is stored in the terminal device, so the terminal device can determine each animation frame in the preset disappearing animation.
  • the terminal device detects that the scroll bar is still, it can compare and analyze the animation frame of the scroll bar displayed on the page and the first animation frame of the preset disappearing animation to determine whether the animation frame of the scroll bar displayed on the page is the first animation frame.
  • Frame animation frames wherein, when the terminal device detects that the animation frame of the scroll bar displayed on the page is the first animation frame, it can perform frame extraction processing on the preset disappearing animation.
  • the difference from the above two methods is that the above two methods directly call the drawing code for the disappearance of the scroll bar or the generation function of the disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar.
  • the terminal device when the terminal device detects the first frame of animation in the preset disappearing animation of the scroll bar on the page, it can modify the frequency of calling eglswapbuffer, such as reducing the frequency of calling eglswapbuffer, so as to realize the automatic disappearance of the preset disappearing animation.
  • Frame extraction when the terminal device detects the first frame of animation in the preset disappearing animation of the scroll bar on the page, it can modify the frequency of calling eglswapbuffer, such as reducing the frequency of calling eglswapbuffer, so as to realize the automatic disappearance of the preset disappearing animation.
  • the frequency of calling eglswapbuffer may be related to the system frame rate.
  • the frequency of calling eglswapbuffer may be 60Hz
  • “correlation" may refer to calling
  • the frequency of eglswapbuffer can be the same as the system frame rate.
  • FIG. 14 is a schematic diagram 3 of an animation displaying a scroll bar on a page according to an embodiment of the present application.
  • the terminal device when the terminal device draws the disappearing animation of the scroll bar at the system frame rate of 60 Hz, the terminal device reduces the frequency of calling eglswapbuffer, such as 20 Hz, to reduce the frequency of sending the preset disappearing animation and realize the preset disappearance animation.
  • Frame extraction processing of the disappearing animation to reduce the number of frames of the disappearing animation of the scroll bar displayed by the terminal device.
  • the terminal device when the terminal device detects that the scroll bar is stationary, and detects the first animation frame in the preset disappearing animation of the scroll bar on the page, the preset disappearing animation is subjected to frame extraction processing. There may be an interval between the scroll bar being still and the first animation frame in the preset disappearing animation displayed on the page. Although the interval is very short, it still causes a delay in displaying the disappearing animation of the scroll bar. Because in the embodiment of the present application, the terminal device can perform frame extraction processing on the preset disappearing animation when detecting that the scroll bar is stationary, thereby avoiding the delay in displaying the disappearing animation of the scroll bar.
  • the preset disappearing animation can be processed by frame extraction to obtain the disappearing animation of the scroll bar whose frame number is less than the frame number of the preset disappearing animation, which can also achieve the purpose of reducing the power consumption of the scroll bar.
  • FIG. 15 is a schematic structural diagram of a display device for scroll bars according to an embodiment of the present application.
  • the display device of the scroll bar shown in FIG. 15 may be the terminal device in the above-mentioned embodiment, or a chip, processor, etc. Display method.
  • the display device 1500 of the scroll bar may include: a display module 1501 and a processing module 1502 .
  • the display module 1501 is used to display a sliding animation on the page when the scroll bar on the page slides.
  • the number of frames of the sliding animation is related to the system frame rate.
  • the sliding animation includes the sliding animation of elements on the page, and the elements on the page include scrolling strip.
  • the display module 1501 is further configured to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary.
  • the frame number of the disappearing animation of the scroll bar is related to a preset frame rate, and the preset frame rate is lower than the system frame rate.
  • the processing module 1502 is configured to detect the position of the scroll bar on the page; and if the position does not change within a preset time period, determine that the scroll bar on the page is stationary.
  • the processing module 1502 is further configured to use a preset frame rate to draw the disappearing animation of the scroll bar.
  • the display module 1501 is specifically configured to display the disappearing animation of the scroll bar and the dynamic elements on the page if there are dynamic elements on the page, and the frame number of the dynamic elements is related to the system frame rate.
  • the processing module 1502 is further configured to use a preset frame rate to draw the disappearing animation of the scroll bar, and use the system frame rate to draw dynamic elements.
  • the processing module 1502 is specifically configured to use a preset frame rate to draw the disappearance animation of the scroll bar according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary, and the first preset Let the brightness change information be used to indicate the brightness of the scroll bar in the disappearing animation of the scroll bar.
  • the first preset brightness change information is a brightness change curve of the scroll bar.
  • the processing module 1502 is further configured to generate a disappearance animation of the scroll bar according to the second preset brightness change information, and the second preset brightness change information is used to indicate the scroll bar in the disappearance animation of the scroll bar
  • the preset number of brightness values, the preset number is equal to the number of frames of the disappearing animation of the scroll bar.
  • the processing module 1502 is further configured to perform frame extraction processing on the preset disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar, and the frame number of the preset disappearing animation is related to the system frame rate.
  • the processing module 1502 is further configured to perform frame extraction processing on the preset disappearing animation when the first animation frame in the preset disappearing animation of the scroll bar is detected on the page to obtain the scroll bar The disappearing animation of the bar.
  • the number of frames of the preset disappearing animation is related to the system frame rate.
  • the scroll bar display device provided in the embodiment of the present application can perform the actions of the terminal device in the foregoing method embodiments, and the implementation principle and technical effect thereof are similar, and are not repeated here.
  • processing modules may be implemented in the form of software calling through processing elements; and may also be implemented in the form of hardware.
  • the processing module may be a separately established processing element, or may be integrated into a certain chip of the above-mentioned device to be implemented, in addition, it may also be stored in the memory of the above-mentioned device in the form of program code, and a certain processing element of the above-mentioned device Call and execute the function of the above processing module.
  • all or part of these modules can be integrated together, and can also be implemented independently.
  • the processing element described here may be an integrated circuit with signal processing capability.
  • each step of the above-mentioned method or each of the above-mentioned modules can be completed by an integrated logic circuit of hardware in the processor element or an instruction in the form of software.
  • the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital) signal processor, DSP), or, one or more field programmable gate arrays (field programmable gate array, FPGA), etc.
  • ASIC application specific integrated circuits
  • DSP digital signal processor
  • FPGA field programmable gate array
  • the processing element may be a general-purpose processor, such as a central processing unit (central processing unit, CPU) or other processors that can call program codes.
  • these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
  • SOC system-on-a-chip
  • the terminal device can realize the display function through the GPU, the display screen, and the application processor.
  • the GPU is a microprocessor for image processing, which connects the display screen and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor may include one or more GPUs that execute instructions to generate or change display information.
  • the display module in this embodiment of the present application may be a display screen, and the display screen is used to display images, videos, animations, and the like.
  • the display screen may include a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • the terminal device may include 1 or N display screens, where N is a positive integer greater than 1.
  • FIG. 16 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device is the terminal device shown above.
  • the electronic device 1600 may include: a processor 1601 (eg, a CPU), a memory 1602 and a display 1603 .
  • a display 1603 may be coupled to the processor 1601, and the display 1603 may display an animation of a scroll bar, which may include a sliding animation of the scroll bar and a disappearing animation of the scroll bar.
  • the memory 1602 may include high-speed random-access memory (RAM), and may also include non-volatile memory (non-volatile memory, NVM), such as at least one disk memory, in which various instructions can be stored , used to complete various processing functions and implement the method steps of the present application.
  • the electronic device 1600 involved in this application may further include: a power supply 1604 , a communication bus 1605 and a communication port 1606 .
  • the above-mentioned communication port 1606 is used to implement connection and communication between the electronic device and other peripheral devices.
  • the above-mentioned memory 1602 is used to store computer-executable program codes, and the program codes include instructions; when the processor 1601 executes the instructions, the instructions cause the processor 1601 of the electronic device to perform the actions in the foregoing method embodiments, which The implementation principle and technical effect are similar, and are not repeated here. It can be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 1600 . In other embodiments of the present application, the electronic device 1600 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • a computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g.
  • a computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media.
  • Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.
  • plural refers to two or more.
  • the term “and/or” in this article is only an association relationship to describe the associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, and A and B exist independently B these three cases.
  • the character "/" in this article generally indicates that the related objects before and after are an “or” relationship; in the formula, the character "/" indicates that the related objects are a "division" relationship.

Abstract

A method and apparatus for displaying a scroll bar, and an electronic device and a readable storage medium. The method comprises: when a scroll bar on a page is sliding, displaying a sliding animation on the page, wherein the number of frames of the sliding animation is related to a system frame rate, the sliding animation comprises a sliding animation of elements on the page, and the elements on the page comprise the scroll bar (S401); and when the scroll bar on the page is stationary, displaying a fade-away animation of the scroll bar on the page, wherein the number of frames of the fade-away animation of the scroll bar is related to a preset frame rate, and the preset frame rate is less than the system frame rate (S402). By means of the method, a fade-away animation of a scroll bar can be displayed at a preset frame rate. Therefore, the number of frames of the fade-away animation of the scroll bar being less than the number of frames of the fade-away animation of the scrolled bar acquired at a system frame rate can make it possible to reduce the power consumption of the scroll bar, and same can also reduce the power consumption of a system on chip (SOC) in a browsing scenario of the scroll bar.

Description

滚动条的显示方法、装置、电子设备和可读存储介质Scroll bar display method, device, electronic device and readable storage medium
本申请要求于2020年10月20日提交中国专利局、申请号为202011125617.8、申请名称为“滚动条的显示方法、装置、电子设备和可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on October 20, 2020 with the application number 202011125617.8 and the application title is "display method, device, electronic device and readable storage medium for scroll bar", all of which are The contents are incorporated herein by reference.
技术领域technical field
本申请实施例涉及终端显示技术,尤其涉及一种滚动条的显示方法、装置、电子设备和可读存储介质。The embodiments of the present application relate to terminal display technologies, and in particular, to a scroll bar display method, apparatus, electronic device, and readable storage medium.
背景技术Background technique
当页面无法显示所有内容时,页面上会显示滚动条,以表征页面上显示的内容在所有的内容中的位置。当用户滑动页面时,滚动条会根据页面的滑动改变位置,当滑动的页面静止时,滚动条也会静止且逐渐消失。When the page cannot display all the content, a scroll bar will be displayed on the page to represent the position of the content displayed on the page among all the content. When the user slides the page, the scroll bar will change position according to the slide of the page, and when the sliding page is stationary, the scroll bar will also be stationary and gradually disappear.
目前页面上滚动条改变位置的过程,以及滚动条逐渐消失的过程,均是终端设备显示滚动条的动画的过程。示例性的,如终端设备会按照系统帧率绘制滚动条的消失动画,且在滚动条静止时显示滚动条的消失动画,进而页面上的滚动条会逐渐消失。目前终端设备按照系统帧率绘制滚动条的消失动画的功耗大。At present, the process of changing the position of the scroll bar on the page and the process of gradually disappearing the scroll bar are both processes in which the terminal device displays the animation of the scroll bar. Exemplarily, for example, the terminal device may draw the disappearing animation of the scroll bar according to the system frame rate, and display the disappearing animation of the scroll bar when the scroll bar is stationary, and then the scroll bar on the page will gradually disappear. Currently, the terminal device consumes a lot of power to draw the disappearing animation of the scroll bar according to the system frame rate.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种滚动条的显示方法、装置、电子设备和可读存储介质,可以降低滚动条的功耗以及滚动条所属的浏览场景的片上系统SOC功耗。Embodiments of the present application provide a scroll bar display method, apparatus, electronic device, and readable storage medium, which can reduce the power consumption of the scroll bar and the power consumption of the system-on-chip SOC of the browsing scene to which the scroll bar belongs.
第一方面,本申请实施例提供一种滚动条的显示方法,该方法可以应用于终端设备或终端设备中的芯片,下述以终端设备为例进行说明。该滚动条的显示方法中,当页面上的滚动条滑动时,在所述页面上显示滑动动画,所述滑动动画的帧数与系统帧率相关,所述滑动动画包括所述页面上的元素的滑动动画,所述页面上的元素包括滚动条;当所述页面上的滚动条静止时,在所述页面上显示所述滚动条的消失动画,所述滚动条的消失动画的帧数与预设帧率相关,所述预设帧率小于所述系统帧率。应理解,帧率是单位时间内显示的帧数,“相关”的含义是帧数可以通过帧率计算得到。示例性的,动画的帧数可以通过帧率计算得到,如可以根据帧率确定单位时间内的帧数,进而根据动画的时长和单位时间内的帧数,得到动画的帧数。滚动条的消失动画的帧数与预设帧率相关指的是滚动条的消失动画的帧数是通过预设帧率计算得到,如可以根据预设帧率确定单位时间内的帧数,进而根据滚动条的消失动画的时长和单位时间内的帧数,得到滚动条的消失动画的帧数。同理的,滑动动画的帧数与系统帧率相关指的是滑动动画的帧数是通过系统帧率计算得到。In a first aspect, an embodiment of the present application provides a method for displaying a scroll bar, and the method can be applied to a terminal device or a chip in the terminal device. The following description takes the terminal device as an example. In the scroll bar display method, when the scroll bar on the page slides, a sliding animation is displayed on the page, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the elements on the page When the scroll bar on the page is static, the disappearing animation of the scroll bar is displayed on the page, and the frame number of the disappearing animation of the scroll bar is the same as that of the scroll bar. The preset frame rate is related, and the preset frame rate is smaller than the system frame rate. It should be understood that the frame rate is the number of frames displayed in a unit time, and the meaning of "correlation" is that the number of frames can be calculated from the frame rate. Exemplarily, the number of frames of the animation can be obtained by calculating the frame rate. For example, the number of frames per unit time can be determined according to the frame rate, and then the number of frames of the animation can be obtained according to the duration of the animation and the number of frames per unit time. The number of frames of the disappearing animation of the scroll bar is related to the preset frame rate, which means that the number of frames of the disappearing animation of the scroll bar is calculated by the preset frame rate. For example, the number of frames per unit time can be determined according to the preset frame rate, and then According to the duration of the disappearing animation of the scroll bar and the number of frames per unit time, the frame number of the disappearing animation of the scroll bar is obtained. Similarly, the frame number of the sliding animation is related to the system frame rate, which means that the frame number of the sliding animation is calculated by the system frame rate.
目前的技术方案中,当页面上的滚动条滑动时,可以在页面上显示所述滚动条的滑动动画,滚动条的滑动动画的帧数与系统帧率相关;当页面上的滚动条静止时,在页面上显示滚动条的消失动画,滚动条的消失动画的帧数与系统帧率相关。也就是说,目前的技术 方案中在页面上显示滚动条的动画时,均以系统帧率显示,其中滚动条的动画包括滚动条的滑动动画和滚动条的消失动画。而本申请实施例中在页面上显示滚动条的消失动画时,可以以小于系统帧率的预设帧率显示,进而使得终端设备上显示的滚动条的消失动画的帧数减小,可以降低滚动条的功耗以及滚动条所属的浏览场景的片上系统SOC功耗。换句话说,目前的技术方案中,终端设备采用系统帧率绘制滑动动画以及滚动条的消失动画,而本申请实施例中终端设备采用系统帧率绘制滑动动画,但采用预设帧率绘制滚动条的消失动画,该预设帧率小于系统帧率。In the current technical solution, when the scroll bar on the page slides, the sliding animation of the scroll bar can be displayed on the page, and the number of frames of the sliding animation of the scroll bar is related to the system frame rate; when the scroll bar on the page is stationary , to display the disappearing animation of the scroll bar on the page. The number of frames of the disappearing animation of the scroll bar is related to the system frame rate. That is to say, in the current technical solution, the animation of the scroll bar is displayed at the system frame rate when displaying the animation of the scroll bar on the page, wherein the animation of the scroll bar includes the sliding animation of the scroll bar and the disappearing animation of the scroll bar. In the embodiment of the present application, when the disappearing animation of the scroll bar is displayed on the page, it can be displayed at a preset frame rate lower than the system frame rate, thereby reducing the number of frames of the disappearing animation of the scroll bar displayed on the terminal device. The power consumption of the scroll bar and the SOC power consumption of the system-on-chip of the browsing scene to which the scroll bar belongs. In other words, in the current technical solution, the terminal device uses the system frame rate to draw the sliding animation and the disappearing animation of the scroll bar, while in the embodiment of the present application, the terminal device uses the system frame rate to draw the sliding animation, but uses the preset frame rate to draw the scrolling animation. The disappearing animation of the bar, the preset frame rate is lower than the system frame rate.
在本申请的技术方案中,终端设备可以实时检测页面上的滚动条的运动状态,以确定页面上的滚动条是否静止。在一种可能的实现方式中,终端设备可以检测检测所述滚动条在所述页面的位置,来确定页面上的滚动条是否静止。其中,若所述位置在预设时长内不变,则确定所述页面上的滚动条静止。若所述位置在预设时长内改变,则确定所述页面上的滚动条未静止,滚动条滑动。本申请实施例中,当终端设备检测到页面上的滚动条滑动时,可以以系统帧率绘制滚动条的滑动动画,进而在页面上显示所述滚动条的滑动动画。当终端设备检测到页面上的滚动条静止时,可以以预设帧率绘制滚动条的消失动画,进而在页面上显示所述滚动条的消失动画。其中,滚动条的消失动画的帧数小于目前以系统帧率绘制的滚动条的消失动画的帧数。In the technical solution of the present application, the terminal device can detect the motion state of the scroll bar on the page in real time to determine whether the scroll bar on the page is stationary. In a possible implementation manner, the terminal device may detect and detect the position of the scroll bar on the page to determine whether the scroll bar on the page is stationary. Wherein, if the position does not change within a preset time period, it is determined that the scroll bar on the page is stationary. If the position changes within a preset time period, it is determined that the scroll bar on the page is not stationary, and the scroll bar slides. In the embodiment of the present application, when the terminal device detects the sliding of the scroll bar on the page, it can draw the sliding animation of the scroll bar at the system frame rate, and then display the sliding animation of the scroll bar on the page. When the terminal device detects that the scroll bar on the page is still, it can draw the disappearing animation of the scroll bar at a preset frame rate, and then display the disappearing animation of the scroll bar on the page. The number of frames of the disappearing animation of the scroll bar is smaller than the number of frames of the disappearing animation of the scroll bar currently drawn at the system frame rate.
在一种实施例中,当所述页面上的滚动条静止时,页面上还存在动态元素,若动态图片或视频等,该动态元素不包括滚动条。终端设备可以在所述页面上显示所述滚动条的消失动画和所述动态元素,所述动态元素的帧数与所述系统帧率相关。其中,动态元素的帧数与所述系统帧率相关指的是:终端设备以系统帧率绘制该动态元素,该动态元素的帧数是通过系统帧率计算得到的。本申请实施例中为了使得用户可以在页面上可以看到连续流畅的动态元素,则可以以系统帧率绘制该动态元素,为了减少滚动条的功耗,可以以预设帧率绘制滚动条的消失动画。应理解,终端设备以系统帧率绘制动态元素的过程,与终端设备以预设帧率绘制滚动条的消失动画的过程类似,下述介绍终端设备以预设帧率绘制滚动条的消失动画的过程。In one embodiment, when the scroll bar on the page is static, there are still dynamic elements on the page, such as dynamic pictures or videos, the dynamic elements do not include the scroll bar. The terminal device may display the disappearing animation of the scroll bar and the dynamic element on the page, and the frame number of the dynamic element is related to the system frame rate. The relationship between the frame number of the dynamic element and the system frame rate means that the terminal device draws the dynamic element at the system frame rate, and the frame number of the dynamic element is obtained by calculating the system frame rate. In this embodiment of the present application, in order to enable the user to see continuous and smooth dynamic elements on the page, the dynamic elements may be drawn at the system frame rate, and in order to reduce the power consumption of the scroll bar, the scroll bar may be drawn at the preset frame rate. disappearing animation. It should be understood that the process for the terminal device to draw the dynamic element at the system frame rate is similar to the process for the terminal device to draw the disappearing animation of the scroll bar at the preset frame rate. process.
在一种可能的实现方式中,终端设备采用预设帧率绘制所述滚动条的消失动画的方式可以为:终端设备可以调用滚动条的消失动画的绘制代码,以预设帧率绘制所述滚动条的消失动画。应理解,终端设备中可以存储有第一预设亮度变化信息,该第一预设亮度变化信息用于指示所述滚动条的消失动画中所述滚动条的亮度。示例性的,如该第一预设亮度变化信息为所述滚动条的亮度变化曲线。终端设备调用滚动条的消失动画的绘制代码的过程,即为根据第一预设亮度变化信息,以及所述滚动条静止时所述滚动条的亮度,采用所述预设帧率绘制所述滚动条的消失动画。其中,在页面上的滚动条静止时,终端设备可以获取滚动条的亮度,进而根据预设帧率在第一预设亮度变化信息中获取滚动条的亮度值,进而根据滚动条的亮度值得到滚动条的动画帧,进而绘制得到滚动条的消失动画。In a possible implementation manner, the manner in which the terminal device uses a preset frame rate to draw the disappearing animation of the scroll bar may be as follows: Scrollbar disappearing animation. It should be understood that the terminal device may store first preset brightness change information, where the first preset brightness change information is used to indicate the brightness of the scroll bar in the disappearance animation of the scroll bar. Exemplarily, for example, the first preset brightness change information is a brightness change curve of the scroll bar. The process of invoking the drawing code of the disappearing animation of the scroll bar by the terminal device is to draw the scroll bar at the preset frame rate according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary. The disappearing animation of the bar. Wherein, when the scroll bar on the page is stationary, the terminal device can obtain the brightness of the scroll bar, and then obtain the brightness value of the scroll bar from the first preset brightness change information according to the preset frame rate, and then obtain the brightness value of the scroll bar according to the brightness value of the scroll bar. The animation frame of the scroll bar, and then draw the disappearing animation of the scroll bar.
在该种方式中,可以通过预先修改滚动条的消失动画的绘制代码的方式,修改绘制滚动条的消失动画的帧率,能够达到减小滚动条的消失动画的帧数的目的,且绘制速度快,页面上显示的滚动条的消失动画不存在时延。In this method, the frame rate of the disappearing animation of the scroll bar can be modified by modifying the drawing code of the disappearing animation of the scroll bar in advance, so as to achieve the purpose of reducing the number of frames of the disappearing animation of the scroll bar, and the drawing speed can be improved. Fast, there is no delay in the disappearing animation of the scroll bar displayed on the page.
在一种可能的实现方式中,终端设备中可以存储有第二预设亮度变化信息,该第二预设亮度变化用于指示所述滚动条的消失动画中所述滚动条的预设数量个亮度值,所述预设 数量等于所述滚动条的消失动画的帧数。也就是说,该第二预设亮度变化信息指示的滚动条的亮度值的数量与预设帧率相关。本申请实施例中,终端设备可以根据第二预设亮度变化信息,生成所述滚动条的消失动画。终端设备可以根据第二预设亮度变化信息指示的滚动条的亮度值,生成对应的滚动条的动画帧,进而得到滚动条的消失动画。在该种方式中,可以通过预先修改滚动条的消失动画的生成函数的方式,修改绘制滚动条的消失动画的帧率,能够达到减小滚动条的消失动画的帧数的目的,且页面上显示的滚动条的消失动画不存在时延。In a possible implementation manner, the terminal device may store second preset brightness change information, where the second preset brightness change is used to indicate a preset number of the scroll bar in the disappearance animation of the scroll bar Brightness value, the preset number is equal to the frame number of the disappearing animation of the scroll bar. That is, the number of brightness values of the scroll bar indicated by the second preset brightness change information is related to the preset frame rate. In this embodiment of the present application, the terminal device may generate a disappearing animation of the scroll bar according to the second preset brightness change information. The terminal device may generate a corresponding animation frame of the scroll bar according to the brightness value of the scroll bar indicated by the second preset brightness change information, and then obtain the disappearance animation of the scroll bar. In this way, the frame rate of drawing the disappearing animation of the scroll bar can be modified by modifying the generation function of the disappearing animation of the scroll bar in advance, so as to achieve the purpose of reducing the number of frames of the disappearing animation of the scroll bar, and on the page There is no delay in the disappearing animation of the displayed scroll bar.
在一种可能的实现方式中,终端设备检测到页面上的滚动条静止,可以在页面上显示滚动条的预设消失动画的第一个动画帧。其中,该预设消失动画的帧数与系统帧率相关,当终端设备在所述页面上检测到所述滚动条的预设消失动画中的第一帧动画帧时,可以对该预设消失动画进行抽帧处理,得到所述滚动条的消失动画。可选的,终端设备中可以预先存储有预设帧率,进而能够确定滚动条的消失动画的帧数,以预设消失动画进行抽帧处理,进而得到预设帧率对应的帧数的滚动条的消失动画。可选的,为了降低该种方式中终端设备检测预设消失动画中的第一帧动画帧才对预设消失动画进行抽帧处理造成的时延问题,该实现方式中,终端设备可以在检测到所述页面上的滚动条静止时,对所述滚动条的预设消失动画进行抽帧处理,可以得到所述滚动条的消失动画。应理解,预设消失动画的帧数与系统帧率相关指的是:终端设备以系统帧率绘制该预设消失动画,该预设消失动画的帧数是通过系统帧率计算得到的。In a possible implementation manner, the terminal device detects that the scroll bar on the page is stationary, and may display the first animation frame of the preset disappearance animation of the scroll bar on the page. The number of frames of the preset disappearing animation is related to the system frame rate. When the terminal device detects the first animation frame in the preset disappearing animation of the scroll bar on the page, the preset disappearing animation can be The animation is processed by frame extraction to obtain the disappearing animation of the scroll bar. Optionally, a preset frame rate may be pre-stored in the terminal device, so as to determine the number of frames of the disappearing animation of the scroll bar, and perform frame extraction processing with the preset disappearing animation, so as to obtain the scrolling of the frame number corresponding to the preset frame rate. The disappearing animation of the bar. Optionally, in order to reduce the delay problem caused by performing frame extraction processing on the preset disappearing animation before the terminal device detects the first animation frame in the preset disappearing animation, in this implementation method, the terminal device can detect the first frame of the disappearing animation. When the scroll bar on the page is stationary, frame extraction processing is performed on the preset disappearing animation of the scroll bar, so as to obtain the disappearing animation of the scroll bar. It should be understood that the relationship between the frame number of the preset disappearing animation and the system frame rate means that the terminal device draws the preset disappearing animation at the system frame rate, and the frame number of the preset disappearing animation is calculated by the system frame rate.
第二方面,本申请实施例提供一种滚动条的显示装置,该滚动条的显示装置如上述第一方面的终端设备或终端设备中的芯片,该滚动条的显示装置包括:In a second aspect, an embodiment of the present application provides a display device for a scroll bar. The display device for the scroll bar is the terminal device or the chip in the terminal device according to the first aspect. The display device for the scroll bar includes:
显示模块,用于当页面上的滚动条滑动时,在所述页面上显示滑动动画,所述滑动动画的帧数与系统帧率相关,所述滑动动画包括所述页面上的元素的滑动动画,所述页面上的元素包括所述滚动条。A display module, configured to display a sliding animation on the page when the scroll bar on the page slides, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the sliding animation of the elements on the page , the element on the page includes the scroll bar.
显示模块,还用于当页面上的滚动条静止时,在页面上显示滚动条的消失动画,滚动条的消失动画的帧数与预设帧率相关,预设帧率小于系统帧率。The display module is also used to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary. The number of frames of the disappearing animation of the scroll bar is related to the preset frame rate, and the preset frame rate is smaller than the system frame rate.
在一种可能的实现方式中,处理模块,用于检测滚动条在页面的位置;且若位置在预设时长内不变,则确定页面上的滚动条静止。In a possible implementation manner, the processing module is configured to detect the position of the scroll bar on the page; and if the position does not change within a preset time period, it is determined that the scroll bar on the page is stationary.
在一种可能的实现方式中,处理模块,还用于采用预设帧率绘制滚动条的消失动画。In a possible implementation manner, the processing module is further configured to use a preset frame rate to draw the disappearing animation of the scroll bar.
在一种可能的实现方式中,显示模块,具体用于若页面上存在动态元素,则在页面上显示滚动条的消失动画和动态元素,动态元素的帧数与系统帧率相关。In a possible implementation manner, the display module is specifically configured to display the disappearing animation of the scroll bar and the dynamic elements on the page if there are dynamic elements on the page, and the frame number of the dynamic elements is related to the system frame rate.
在一种可能的实现方式中,处理模块,还用于采用预设帧率绘制滚动条的消失动画,以及采用系统帧率绘制动态元素。In a possible implementation manner, the processing module is further configured to use a preset frame rate to draw a scroll bar disappearing animation, and use a system frame rate to draw dynamic elements.
在所述页面上显示所述滚动条的滑动动画,所述滚动条的滑动动画的帧数与系统帧率相关。The sliding animation of the scroll bar is displayed on the page, and the frame number of the sliding animation of the scroll bar is related to the system frame rate.
显示模块,还用于当所述页面上的滚动条静止时,在所述页面上显示所述滚动条的消失动画,所述滚动条的消失动画的帧数与预设帧率相关,所述预设帧率小于所述系统帧率。The display module is further configured to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary, and the frame number of the disappearing animation of the scroll bar is related to the preset frame rate, and the The preset frame rate is smaller than the system frame rate.
在一种可能的实现方式中,处理模块,用于检测所述滚动条在所述页面的位置;且若所述位置在预设时长内不变,则确定所述页面上的滚动条静止。In a possible implementation manner, the processing module is configured to detect the position of the scroll bar on the page; and if the position does not change within a preset time period, determine that the scroll bar on the page is stationary.
在一种可能的实现方式中,处理模块,还用于采用所述预设帧率绘制所述滚动条的消 失动画。In a possible implementation manner, the processing module is further configured to use the preset frame rate to draw the disappearing animation of the scroll bar.
在一种可能的实现方式中,处理模块,具体用于根据第一预设亮度变化信息,以及所述滚动条静止时所述滚动条的亮度,采用所述预设帧率绘制所述滚动条的消失动画,所述第一预设亮度变化信息用于指示所述滚动条的消失动画中所述滚动条的亮度。In a possible implementation manner, the processing module is specifically configured to use the preset frame rate to draw the scroll bar according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary The disappearing animation of the scroll bar, the first preset brightness change information is used to indicate the brightness of the scroll bar in the disappearing animation of the scroll bar.
在一种可能的实现方式中,所述第一预设亮度变化信息为所述滚动条的亮度变化曲线。In a possible implementation manner, the first preset brightness change information is a brightness change curve of the scroll bar.
在一种可能的实现方式中,处理模块,还用于根据第二预设亮度变化信息,生成所述滚动条的消失动画,所述第二预设亮度变化信息用于指示所述滚动条的消失动画中所述滚动条的预设数量个亮度值,所述预设数量等于所述滚动条的消失动画的帧数。In a possible implementation manner, the processing module is further configured to generate a disappearing animation of the scroll bar according to second preset brightness change information, where the second preset brightness change information is used to indicate the A preset number of brightness values of the scroll bar in the disappearing animation, where the preset number is equal to the frame number of the disappearing animation of the scroll bar.
在一种可能的实现方式中,处理模块,还用于对所述滚动条的预设消失动画进行抽帧处理,得到所述滚动条的消失动画,所述预设消失动画的帧数与所述系统帧率相关。In a possible implementation manner, the processing module is further configured to perform frame extraction processing on the preset disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar, the number of frames of the preset disappearing animation being the same as the number of frames of the preset disappearing animation. The system frame rate is related.
在一种可能的实现方式中,处理模块,还用于当在所述页面上检测到所述滚动条的预设消失动画中的第一帧动画帧时,对所述预设消失动画进行抽帧处理,得到所述滚动条的消失动画,所述预设消失动画的帧数与所述系统帧率相关。In a possible implementation manner, the processing module is further configured to extract the preset disappearing animation when the first animation frame in the preset disappearing animation of the scroll bar is detected on the page. The frame processing is performed to obtain the disappearing animation of the scroll bar, and the frame number of the preset disappearing animation is related to the system frame rate.
本申请实施例提供的滚动条的显示装置,可以执行上述方法实施例中终端设备的动作,其实现原理和技术效果类似,在此不再赘述。The scroll bar display device provided in the embodiment of the present application can perform the actions of the terminal device in the foregoing method embodiments, and the implementation principle and technical effect thereof are similar, and are not repeated here.
第三方面,本申请实施例提供一种电子设备,所述电子设备包括:处理器、存储器;In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes: a processor and a memory;
存储器用于存储计算机可执行程序代码,程序代码包括指令;当处理器执行指令时,指令使所述电子设备执行如第一方面或第一方面的各可能的实现方式所提供的方法。The memory is used to store computer-executable program codes, and the program codes include instructions; when the processor executes the instructions, the instructions cause the electronic device to perform the method provided by the first aspect or each possible implementation manner of the first aspect.
第四方面,本申请实施例提供一种滚动条的显示装置,包括用于执行以上第一方面或第一方面各可能的实现方式所提供的方法的单元、模块或电路。该滚动条的显示装置可以为待定位对象,也可以为应用于待定位对象的一个模块,例如,可以为应用于待定位对象的芯片。In a fourth aspect, an embodiment of the present application provides a scroll bar display device, including a unit, a module, or a circuit for executing the method provided by the first aspect or each possible implementation manner of the first aspect. The display device of the scroll bar may be the object to be positioned, or a module applied to the object to be positioned, for example, a chip applied to the object to be positioned.
第五方面,本申请实施例提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面或第一方面的各种可能的实现方式中的方法。In a fifth aspect, embodiments of the present application provide a computer program product containing instructions, which, when run on a computer, cause the computer to execute the method in the first aspect or various possible implementations of the first aspect.
本申请实施例提供一种滚动条的显示方法、装置、电子设备和可读存储介质,该方法包括当页面上的滚动条滑动时,在页面上显示滑动动画,滑动动画的帧数与系统帧率相关,滑动动画包括页面上的元素的滑动动画,页面上的元素包括滚动条;当页面上的滚动条静止时,在页面上显示滚动条的消失动画,滚动条的消失动画的帧数与预设帧率相关,预设帧率小于系统帧率。本申请实施例可以以预设帧率显示滚动条的消失动画,因此滚动条的消失动画的帧数小于以系统帧率获取的滚动条的消失动画的帧数,可以减小滚动条的功耗,也可以减小滚动条所属的浏览场景的片上系统SOC功耗。Embodiments of the present application provide a scroll bar display method, device, electronic device, and readable storage medium. The method includes, when a scroll bar on a page slides, displaying a sliding animation on the page, and the frame number of the sliding animation is the same as the system frame. The sliding animation includes the sliding animation of the elements on the page, and the elements on the page include the scroll bar; when the scroll bar on the page is stationary, the disappearing animation of the scroll bar is displayed on the page, and the number of frames of the disappearing animation of the scroll bar is the same as that of the scroll bar. The preset frame rate is related, and the preset frame rate is less than the system frame rate. In this embodiment of the present application, the disappearing animation of the scroll bar can be displayed at a preset frame rate. Therefore, the number of frames of the disappearing animation of the scroll bar is smaller than the number of frames of the disappearing animation of the scroll bar obtained at the system frame rate, which can reduce the power consumption of the scroll bar. , it can also reduce the power consumption of the system-on-chip SOC of the browsing scene to which the scroll bar belongs.
附图说明Description of drawings
图1为一种滚动条的显示示意图;Fig. 1 is the display schematic diagram of a kind of scroll bar;
图2为目前页面上显示滚动条的动画的示意图;Fig. 2 is the schematic diagram showing the animation of scroll bar on the current page;
图3为以系统帧率显示滚动条的消失动画时的滚动条的变化示意图;3 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at the system frame rate;
图4为本申请实施例提供的滚动条的显示方法的一实施例的流程示意图;FIG. 4 is a schematic flowchart of an embodiment of a method for displaying a scroll bar according to an embodiment of the present application;
图5为本申请实施例页面上显示滚动条的动画的示意图一;5 is a schematic diagram 1 of an animation displaying a scroll bar on a page according to an embodiment of the present application;
图6为以预设帧率显示滚动条的消失动画时的滚动条的变化示意图;6 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at a preset frame rate;
图7为本申请实施例页面上显示滚动条的动画的示意图二;7 is a schematic diagram 2 of an animation displaying a scroll bar on a page according to an embodiment of the present application;
图8为以系统帧率绘制滚动条的消失动画的代码示意图;Fig. 8 is the code schematic diagram that draws the disappearance animation of the scroll bar with the system frame rate;
图9为本申请实施例提供的滚动条的显示方法的另一实施例的流程示意图;9 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application;
图10为滚动条的亮度变化曲线示意图;FIG. 10 is a schematic diagram of a brightness change curve of a scroll bar;
图11为滚动条的亮度变化值的示意图;FIG. 11 is a schematic diagram of a brightness change value of a scroll bar;
图12为本申请实施例提供的滚动条的显示方法的另一实施例的流程示意图;12 is a schematic flowchart of another embodiment of a method for displaying a scroll bar provided by an embodiment of the present application;
图13为本申请实施例提供的滚动条的显示方法的另一实施例的流程示意图;13 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application;
图14为本申请实施例页面上显示滚动条的动画的示意图三;14 is a schematic diagram 3 of an animation displaying a scroll bar on a page according to an embodiment of the present application;
图15为本申请实施例提供的滚动条的显示装置的结构示意图;FIG. 15 is a schematic structural diagram of a display device for scroll bars according to an embodiment of the present application;
图16为本申请实施例提供的电子设备的结构示意图。FIG. 16 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
图1为一种滚动条的显示示意图。如图1所示,界面101显示的页面包括滚动条,滚动条可以位于页面的右侧。滚动条的位置会随着页面呈现的内容在所有内容中的位置的变化而改变,如界面102所示,当用户上滑页面时,滚动条的位置由界面101中的位置变为界面102中的位置。当滑动的页面静止时,滚动条也静止,且滚动条会逐渐消失,如界面103所示。滚动条消失后,直至用户重新操作页面,滚动条会重新显示。示例性的,如界面104所示,当用户的手指触碰页面时,滚动条会重新显示,滚动条显示的位置如界面102所示的位置。本申请实施例中以界面102中的滚动条静止为例,其中,界面102转变为界面103的时间很短,如可以为280ms。应理解,图1中的滚动条显示方式可以应用于终端设备中,图1中以终端设备为手机为例进行说明。FIG. 1 is a schematic diagram of a display of a scroll bar. As shown in FIG. 1 , the page displayed on the interface 101 includes a scroll bar, and the scroll bar may be located on the right side of the page. The position of the scroll bar will change with the position of the content presented on the page in all the content. As shown in interface 102, when the user slides up the page, the position of the scroll bar changes from the position in interface 101 to that in interface 102. s position. When the sliding page is stationary, the scroll bar is also stationary, and the scroll bar will gradually disappear, as shown in interface 103 . After the scroll bar disappears, the scroll bar will reappear until the user manipulates the page again. Exemplarily, as shown in the interface 104 , when the user's finger touches the page, the scroll bar will be redisplayed, and the displayed position of the scroll bar is the position shown in the interface 102 . In the embodiment of the present application, the scroll bar in the interface 102 is static as an example, wherein the time for the interface 102 to be transformed into the interface 103 is very short, such as 280 ms. It should be understood that the scroll bar display manner in FIG. 1 may be applied to a terminal device, and the terminal device is a mobile phone as an example for description in FIG. 1 .
开发人员通过比较终端设备中有滚动条的应用程序和无滚动条的应用程序的功耗开销,发现滚动条的功耗开销很大。如下表一所示,有滚动条的应用程序中滚动条的功耗开销占整个芯片的片上系统(system on a chip,SOC)功耗开销的20%以上,因此有必要减小滚动条的功耗开销。By comparing the power consumption of applications with scrollbars and applications without scrollbars on end devices, developers found that scrollbars have a high power consumption overhead. As shown in Table 1 below, the power consumption of scroll bars in applications with scroll bars accounts for more than 20% of the system on a chip (SOC) power consumption of the entire chip, so it is necessary to reduce the power consumption of scroll bars. cost.
表一Table I
场景Scenes SOC功耗(mA)SOC power consumption (mA)
网页浏览(有滚动条)Web browsing (with scroll bars) 81.0381.03
网页浏览(无滚动条)Web browsing (without scroll bars) 59.4359.43
每当用户滑动一次页面,终端设备通常会执行两次滚动条的绘制,滚动条的功耗开销消耗在这两次滚动条的绘制。应理解,该两次滚动条的绘制可以由终端设备中的图形处理器(graphics processing unit,GPU)执行。用户滑动一次页面指的是:页面滑动后静止为一次,其中,在页面随着用户的操作进行滑动的过程中,GPU执行第一次滚动条的绘制,在滑动的页面静止且滚动条静止时,GPU执行第二次滚动条的绘制。其中,GPU执行第一次滚动条的绘制指的是:GPU获取滚动条的滑动动画,以使终端设备在页面上显示滚动条的滑动动画。应理解,因为页面上还可以包括其他元素,因此GPU执行第一次滚动条的绘制时可以绘制页面上其他元素的滑动动画。GPU执行第二次滚动条的绘制指的是:GPU获取滚动条的消失动画的绘制,以使终端设备在页面上显示滚动条的消失动画。应理解,GPU的绘制滚动条的动画(滑动动画或消失动画)的绘制帧率可以与终端设备的显示 滚动条的动画的显示帧率相同,也就是说,GPU的绘制滚动条的动画是怎样的帧率,则按照怎样的帧率显示滚动条的动画。Whenever the user slides the page once, the terminal device usually performs two scroll bar drawing, and the power consumption of the scroll bar is consumed in the two scroll bar drawing. It should be understood that the drawing of the two scroll bars may be performed by a graphics processing unit (graphics processing unit, GPU) in the terminal device. When the user slides a page once, it means that after the page slides, it is static once. In the process of sliding the page with the user's operation, the GPU performs the first scroll bar drawing. When the sliding page is static and the scroll bar is static , the GPU performs the second scroll bar drawing. The first time the GPU performs the drawing of the scroll bar means that the GPU obtains the sliding animation of the scroll bar, so that the terminal device displays the sliding animation of the scroll bar on the page. It should be understood that, because other elements may also be included on the page, the GPU may draw sliding animations of other elements on the page when the first scroll bar is drawn. The second time the GPU performs the drawing of the scroll bar refers to: the GPU obtains the drawing of the disappearing animation of the scroll bar, so that the terminal device displays the disappearing animation of the scroll bar on the page. It should be understood that the drawing frame rate of the animation (sliding animation or disappearing animation) of the GPU for drawing the scroll bar can be the same as the display frame rate of the animation for displaying the scroll bar of the terminal device, that is, what is the animation of the GPU for drawing the scroll bar? If the frame rate is set, the animation of the scroll bar will be displayed according to the frame rate.
在GPU执行第一次滚动条的绘制的过程中,滚动条的出现以及滚动条的位置改变时,整个页面都在滑动,页面中其他元素(如图1中的文本、图片等)也需要进行同步绘制。示例性的,如GPU会调用渲染代码、UI显示代码等进行滚动条,以及页面中其他元素的绘制。因此在GPU执行第一次滚动条的绘制时,GPU调用渲染代码、UI显示代码等所用的功耗分配在页面中其他元素的绘制和滚动条的绘制中,滚动条的绘制占用了GPU调用代码所用的功耗中的一部分。而在GPU执行第二次滚动条的绘制的过程中,除了滚动条之外,页面中其他元素是静止的,滚动条的绘制也需要GPU调用渲染代码、UI显示代码等,因此GPU调用代码所用的功耗全是滚动条的绘制带来的。在GPU调用渲染代码、UI显示代码等所用的功耗相同的前提下,对比两次滚动条的绘制可以确定滚动条的功耗开销主要来源于GPU执行第二次滚动条的绘制,即终端设备获取滚动条的消失动画这一动作。When the GPU executes the first scroll bar drawing process, when the scroll bar appears and the position of the scroll bar changes, the entire page is sliding, and other elements in the page (such as text, pictures, etc. in Figure 1) also need to be Synchronized drawing. Exemplarily, for example, the GPU will call rendering code, UI display code, etc. to draw scroll bars and other elements on the page. Therefore, when the GPU performs the first scroll bar drawing, the power consumption used by the GPU to call the rendering code, UI display code, etc. is allocated to the drawing of other elements in the page and the drawing of the scroll bar, and the drawing of the scroll bar occupies the GPU calling code. part of the power consumption used. In the process of drawing the second scroll bar by the GPU, except for the scroll bar, other elements in the page are static, and the drawing of the scroll bar also requires the GPU to call the rendering code, UI display code, etc., so the GPU calling code uses The power consumption is all caused by the drawing of the scroll bar. On the premise that the power consumption used by the GPU to call the rendering code, UI display code, etc. is the same, by comparing the two scroll bar drawing, it can be determined that the power consumption of the scroll bar mainly comes from the GPU executing the second scroll bar drawing, that is, the terminal device. Get the action of the scroll bar disappearing animation.
应理解,GPU执行第一次滚动条的绘制时,可以获取滚动条的滑动动画。其中,滚动条的滑动动画中可以包括多帧动画帧,动画帧的帧数与系统帧率相关。如系统帧率为60Hz,则该滚动条的滑动动画可以包括17帧动画帧,相应的,终端设备会显示该17帧动画帧,用户可以通过该17帧动画帧看到滚动条在页面上滑动。同理的,GPU执行第二次滚动条的绘制时,可以获取滚动条的消失动画,其中,滚动条的消失动画中可以包括多帧动画帧,动画帧的帧数与系统帧率相关。如系统帧率为60Hz,则该滚动条的消失动画可以包括17帧动画帧,相应的,终端设备会显示该17帧动画帧,用户可以通过该17帧动画帧看到滚动条在页面上消失(因为时间很短,用户不感知)。It should be understood that when the GPU performs the first drawing of the scroll bar, the sliding animation of the scroll bar can be obtained. The sliding animation of the scroll bar may include multiple frames of animation frames, and the number of frames of the animation frames is related to the system frame rate. If the system frame rate is 60Hz, the sliding animation of the scroll bar can include 17 animation frames. Correspondingly, the terminal device will display the 17 animation frames, and the user can see the scroll bar sliding on the page through the 17 animation frames. . Similarly, when the GPU executes the second scroll bar drawing, the disappearing animation of the scroll bar may be obtained, wherein the disappearing animation of the scroll bar may include multiple frames of animation frames, and the number of animation frames is related to the system frame rate. If the system frame rate is 60Hz, the disappearing animation of the scroll bar can include 17 animation frames. Correspondingly, the terminal device will display the 17 animation frames, and the user can see the scroll bar disappearing on the page through the 17 animation frames. (Because the time is very short, the user does not perceive it).
图2为目前页面上显示滚动条的动画的示意图。图2中以系统帧率为60Hz为例、且以绘制滚动条的动画过程进行说明。其中,当页面上的滚动条滑动时,GPU以系统帧率60Hz绘制滚动条的滑动动画,且调用eglswapbuffer送显(即将滚动条的滑动动画发送至终端设备中的显卡以进行显示),使得终端设备的页面上显示滚动条的滑动动画,目前的显示帧率和绘制帧率(绘制滚动条的帧率)相同,均为60Hz,因此终端设备的页面上可以以60Hz显示滚动条的滑动动画,如显示17帧动画帧。同理的,当页面上的滚动条静止时,GPU以系统帧率60Hz绘制滚动条的消失动画,且调用eglswapbuffer送显,进而使得终端设备的页面上显示滚动条的消失动画,如终端设备的页面上可以以60Hz显示滚动条的滑动动画,即显示17帧动画帧。应理解,eglswapbuffer是GPU绘制的动画送显时均会调用的函数,GPU绘制的动画可以包括GPU绘制的滚动条的动画,以及GPU绘制的页面上其他元素的动画。FIG. 2 is a schematic diagram of an animation displaying a scroll bar on a current page. In FIG. 2 , the system frame rate is 60 Hz as an example, and the animation process of drawing a scroll bar is used for description. Among them, when the scroll bar on the page slides, the GPU draws the sliding animation of the scroll bar at the system frame rate of 60Hz, and calls eglswapbuffer for display (that is, the sliding animation of the scroll bar is sent to the graphics card in the terminal device for display), so that the terminal The sliding animation of the scroll bar is displayed on the page of the device. The current display frame rate and the drawing frame rate (the frame rate for drawing the scroll bar) are the same, and both are 60 Hz. Therefore, the sliding animation of the scroll bar can be displayed on the page of the terminal device at 60 Hz. Such as display 17 animation frames. Similarly, when the scroll bar on the page is static, the GPU draws the disappearing animation of the scroll bar at the system frame rate of 60Hz, and calls eglswapbuffer to send it for display, so that the disappearing animation of the scroll bar is displayed on the page of the terminal device, such as the disappearing animation of the scroll bar on the terminal device. The sliding animation of the scroll bar can be displayed on the page at 60Hz, that is, 17 animation frames are displayed. It should be understood that eglswapbuffer is a function that is called when the animation drawn by the GPU is sent to display, and the animation drawn by the GPU may include the animation of the scroll bar drawn by the GPU, and the animation of other elements on the page drawn by the GPU.
图3为以系统帧率显示滚动条的消失动画时的滚动条的变化示意图。示例性的,如图3所示,终端设备显示滚动条的消失动画时,滚动条的透明度可以逐渐变小,直至透明度变为0,滚动条消失。图3中以系统帧率60Hz显示滚动条的消失动画为例进行说明,其中,终端设备显示17帧动画帧,来显示滚动条的消失动画。可以想到的是,滚动条还可以以突变的形式消失,如前10帧动画帧为有滚动条的动画帧,后7帧动画帧为没有滚动条的动画帧,本申请实施例对滚动条消失的方式不做限制。图3的主要目的是为了体现目前GPU以系统帧率绘制滚动条的消失动画时造成消失动画的帧数较多的问题。FIG. 3 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at the system frame rate. Exemplarily, as shown in FIG. 3 , when the terminal device displays the disappearing animation of the scroll bar, the transparency of the scroll bar may gradually decrease until the transparency becomes 0 and the scroll bar disappears. FIG. 3 takes an example of displaying the disappearing animation of the scroll bar at a system frame rate of 60 Hz, wherein the terminal device displays 17 animation frames to display the disappearing animation of the scroll bar. It is conceivable that the scroll bar can also disappear in the form of a sudden change. For example, the first 10 animation frames are animation frames with scroll bars, and the last 7 animation frames are animation frames without scroll bars. In this embodiment of the present application, the scroll bars disappear. method is not limited. The main purpose of FIG. 3 is to reflect the problem of a large number of frames of the disappearing animation when the GPU draws the disappearing animation of the scroll bar at the system frame rate at present.
应理解,系统帧率也可以称为终端设备的刷新帧率,对于用户来讲,系统帧率越高, 用户看到的画面越连贯,用户体验越好。示例性的,如终端设备的系统帧率为30Hz,用户在滑动页面时,页面呈现不连贯,用户体验不佳,因此目前终端设备的系统帧率很高,通常高于60Hz。当GPU执行第二次滚动条的绘制时,GPU以系统帧率绘制滚动条的消失动画,相应的,终端设备以系统帧率显示滚动条的消失动画。目前,考虑到用户体验,滚动条的消失动画的时长固定在280ms左右,当GPU以系统帧率60Hz绘制滚动条的消失动画时,终端设备显示的消失动画的帧数为17帧左右。当GPU以系统帧率90Hz绘制滚动条的消失动画时,终端设备显示的消失动画的帧数为25帧左右。当GPU以系统帧率120Hz绘制滚动条的消失动画时,终端设备显示的消失动画的帧数为34帧左右。也就是说,系统帧率越高,GPU绘制滚动条的消失动画的帧数越多,GPU执行第二次绘制的功耗也就越高,导致滚动条的功耗开销也越大。It should be understood that the system frame rate may also be referred to as the refresh frame rate of the terminal device. For the user, the higher the system frame rate, the more coherent the picture the user sees, and the better the user experience. Exemplarily, for example, the system frame rate of the terminal device is 30 Hz. When the user slides the page, the page is rendered incoherent and the user experience is not good. Therefore, the current system frame rate of the terminal device is very high, usually higher than 60 Hz. When the GPU performs the second scroll bar drawing, the GPU draws the scroll bar disappearing animation at the system frame rate, and correspondingly, the terminal device displays the scroll bar disappearing animation at the system frame rate. At present, considering the user experience, the duration of the disappearing animation of the scroll bar is fixed at about 280ms. When the GPU draws the disappearing animation of the scroll bar at the system frame rate of 60 Hz, the number of frames of the disappearing animation displayed by the terminal device is about 17 frames. When the GPU draws the disappearing animation of the scroll bar at the system frame rate of 90 Hz, the number of frames of the disappearing animation displayed by the terminal device is about 25 frames. When the GPU draws the disappearing animation of the scroll bar at the system frame rate of 120 Hz, the number of frames of the disappearing animation displayed by the terminal device is about 34 frames. That is to say, the higher the system frame rate, the more frames the GPU draws the disappearing animation of the scroll bar, and the higher the power consumption of the GPU to perform the second drawing, resulting in the greater power consumption of the scroll bar.
既然滚动条的功耗开销主要来源于GPU执行第二次滚动条的绘制,本申请实施例中可以通过减少GPU执行第二次滚动条的绘制的功耗来减少滚动条的功耗开销,又因为GPU执行第二次滚动条的绘制的功耗来源于消失动画的过多的帧数,因此本申请实施例中为了减少滚动条的功耗开销,提供了一种滚动条的显示方法,可以通过减少GPU执行第二次滚动条的消失动画的帧数,以减小GPU执行第二次滚动条的绘制的功耗,即减小终端设备显示的滚动条的消失动画的帧数,进而减小滚动条的功耗开销,因为滚动条的消失动画的帧数与绘制滚动条的消失动画的帧率相关,因此本申请实施例中可以通过减小获取滚动条的消失动画的帧率的方式减小滚动条的功耗开销。Since the power consumption of the scroll bar mainly comes from the GPU performing the second scroll bar drawing, in the embodiment of the present application, the power consumption of the scroll bar can be reduced by reducing the power consumption of the GPU performing the second scroll bar drawing, and the Because the power consumption of the GPU for the second scroll bar drawing comes from the excessive number of frames of the disappearing animation, in order to reduce the power consumption of the scroll bar, the embodiment of the present application provides a scroll bar display method, which can By reducing the number of frames of the disappearance animation of the scroll bar performed by the GPU for the second time, the power consumption of the GPU to perform the drawing of the scroll bar for the second time is reduced, that is, the number of frames of the disappearance animation of the scroll bar displayed by the terminal device is reduced, thereby reducing the power consumption of the scroll bar. The power consumption overhead of a small scroll bar, because the number of frames of the disappearing animation of the scroll bar is related to the frame rate of drawing the disappearing animation of the scroll bar. Therefore, in this embodiment of the present application, the frame rate of the disappearing animation of the scroll bar can be obtained by reducing the method. Reduce the power consumption of scroll bars.
应理解,本申请实施例中执行滚动条的显示方法的执行主体可以为终端设备,或者终端设备中的GPU或其他处理芯片等。下述实施例中以终端设备为执行主体为例进行示例说明。应理解,本申请实施例中的终端设备可以称为用户设备(user equipment,UE)、移动终端(mobile terminal)、终端(terminal)等。终端设备可以为个人数字处理(personal digital assistant,PDA)、具有无线通信功能的手持设备、计算设备、车载设备或可穿戴设备,虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等。本申请实施例中对终端设备的形态不做具体限定。应理解,本申请实施例中执行滚动条的显示方法可以适用于页面上竖直的滚动条、水平的滚动条,或者倾斜显示的滚动条,本申请实施例中对滚动条的形态不做限制。It should be understood that the execution subject of the scroll bar display method in the embodiment of the present application may be a terminal device, or a GPU or other processing chip in the terminal device, or the like. In the following embodiments, the terminal device is used as an example for illustration. It should be understood that the terminal device in this embodiment of the present application may be referred to as a user equipment (user equipment, UE), a mobile terminal (mobile terminal), a terminal (terminal), and the like. The terminal device can be a personal digital assistant (PDA), a handheld device with wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (virtual reality, VR) terminal device, an augmented reality (augmented reality, AR) terminal equipment, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical, wireless terminals in smart grid, Wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The form of the terminal device is not specifically limited in the embodiments of the present application. It should be understood that the display method for executing the scroll bar in the embodiment of the present application may be applicable to a vertical scroll bar, a horizontal scroll bar, or a scroll bar displayed obliquely, and the form of the scroll bar is not limited in the embodiment of the present application .
下面结合具体的实施例对本申请实施例提供的滚动条的显示方法进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。图4为本申请实施例提供的滚动条的显示方法的一实施例的流程示意图。如图4所示,本申请实施例提供的滚动条的显示方法可以包括:The display method of the scroll bar provided by the embodiment of the present application will be described in detail below with reference to specific embodiments. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. FIG. 4 is a schematic flowchart of an embodiment of a method for displaying a scroll bar according to an embodiment of the present application. As shown in FIG. 4 , the display method of the scroll bar provided by the embodiment of the present application may include:
S401,当页面上的滚动条滑动时,在页面上显示滑动动画,滑动动画的帧数与系统帧率相关,滑动动画包括页面上的元素的滑动动画,页面上的元素包括滚动条。S401, when the scroll bar on the page slides, display a sliding animation on the page, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the sliding animation of the element on the page, and the element on the page includes the scroll bar.
S402,当页面上的滚动条静止时,在页面上显示滚动条的消失动画,滚动条的消失动画的帧数与预设帧率相关,预设帧率小于系统帧率。S402 , when the scroll bar on the page is stationary, display the disappearing animation of the scroll bar on the page, and the frame number of the disappearing animation of the scroll bar is related to a preset frame rate, and the preset frame rate is lower than the system frame rate.
上述S401中,用户每滑动一次页面,页面上会显示滚动条的两次动画。其中,当页面上的元素滑动时,页面上的滚动条也滑动,此时可以在页面上显示滑动动画,应理解,滑动动画包括页面上的元素的滑动动画,页面上的元素可以包括滚动条。示例性的,当页面上包括文字元素和滚动条,且页面滑动时(页面上的滚动条滑动时),可以在页面上显示文字的滑动动画和滚动条的滑动动画。其中,滚动条的滑动动画可以包括滚动条位置改变的动画,或者还可以包括滚动条大小和位置改变的动画。应理解,本申请实施例中终端设备可以检测页面上滚动条滑动或者静止,确定在页面上显示滚动条的动画。示例性的,终端设备可以检测页面上滚动条是否静止,若页面上滚动条未静止(滑动),则在页面上显示滚动条的滑动动画,若页面上滚动条静止,则在页面上显示滚动条的消失动画。In the above S401, each time the user slides the page, two animations of the scroll bar are displayed on the page. Wherein, when the element on the page slides, the scroll bar on the page also slides, and a sliding animation can be displayed on the page at this time. It should be understood that the sliding animation includes the sliding animation of the element on the page, and the element on the page may include the scroll bar . Exemplarily, when a page includes text elements and a scroll bar, and the page slides (when the scroll bar on the page slides), a text sliding animation and a scroll bar sliding animation can be displayed on the page. The sliding animation of the scroll bar may include an animation of changing the position of the scroll bar, or may also include an animation of changing the size and position of the scroll bar. It should be understood that, in this embodiment of the present application, the terminal device may detect that the scroll bar on the page slides or is still, and determine to display the animation of the scroll bar on the page. Exemplarily, the terminal device can detect whether the scroll bar on the page is still, and if the scroll bar on the page is not still (sliding), a sliding animation of the scroll bar is displayed on the page, and if the scroll bar is still on the page, the scroll bar is displayed on the page. The disappearing animation of the bar.
其中,终端设备检测页面上滑动的滚动条是否静止的一种方式为:因为页面静止时,滚动条也静止,因此本申请实施例中可以通过检测页面是否静止来确定滚动条是否静止。检测页面是否静止可以通过检测页面上的元素的位置来确定页面是否静止。其中,若页面上的某一元素在预设时长内位置不变,则可以确定页面静止,反之,则页面未静止。其中,若检测页面静止,则可以确定滑动的滚动条静止,若页面未静止,则可以确定滑动的滚动条未静止。应理解,在页面滑动的过程中,终端设备检测的页面上的元素是可以不同。One way for the terminal device to detect whether the scroll bar sliding on the page is stationary is: because the scroll bar is stationary when the page is stationary, in this embodiment of the present application, whether the scroll bar is stationary can be determined by detecting whether the page is stationary. Detecting if a page is stationary You can determine if a page is stationary by detecting the positions of elements on the page. Wherein, if the position of an element on the page does not change within the preset time period, it can be determined that the page is stationary, otherwise, the page is not stationary. Wherein, if it is detected that the page is stationary, it can be determined that the sliding scroll bar is stationary, and if the page is not stationary, it can be determined that the sliding scroll bar is not stationary. It should be understood that, in the process of page sliding, the elements on the page detected by the terminal device may be different.
上述方式虽然能够检测滑动的滚动条是否静止,但需要检测页面是否静止来检测,也就是通过间接的方式检测滚动条是否静止,检测效率低。本申请实施例可以通过检测滚动条的位置的方式来检测滚动条是否静止,能够提高检测效率。终端设备检测页面上滑动的滚动条是否静止的另一种方式为:在页面滑动的过程中,滚动条的长度和位置是随着页面中的内容在所有内容中的位置的改变而自适应变化的。本申请实施例中,终端设备可以实时检测、更新记录滚动条在滑动过程中的位置以及滚动条的大小。终端设备可以通过查询实时记录的滚动条的位置来确定滚动条是否静止。若滚动条的位置在预设时长内未发生改变,则可以确定页面上滑动的滚动条静止,若滚动条的位置在预设时长内发生改变,则可以确定页面上滑动的滚动条未静止。Although the above method can detect whether the sliding scroll bar is still, it is necessary to detect whether the page is still, that is, to detect whether the scroll bar is still in an indirect way, which has low detection efficiency. This embodiment of the present application can detect whether the scroll bar is stationary by detecting the position of the scroll bar, which can improve the detection efficiency. Another way for the terminal device to detect whether the scroll bar sliding on the page is static is: in the process of page sliding, the length and position of the scroll bar are adaptively changed with the change of the position of the content on the page in all the content. of. In this embodiment of the present application, the terminal device may detect, update and record the position of the scroll bar during the sliding process and the size of the scroll bar in real time. The terminal device can determine whether the scroll bar is stationary by querying the position of the scroll bar recorded in real time. If the position of the scroll bar does not change within the preset time period, it can be determined that the scroll bar sliding on the page is stationary; if the position of the scroll bar changes within the preset time period, it can be determined that the scroll bar sliding on the page is not stationary.
应注意的是,本申请实施例中的滑动动画的帧数与系统帧率相关。也就是说,本申请实施例中终端设备(或者终端设备中的GPU)可以以系统帧率绘制滑动动画。图5为本申请实施例页面上显示滚动条的动画的示意图一。图5中以系统帧率绘制滚动条的滑动动画为例,与上述图2相同的,如系统帧率为60Hz,则终端设备以系统帧率60Hz绘制滚动条的滑动动画,且调用eglswapbuffer送显使得终端设备的页面上显示17帧滚动条的滑动动画的动画帧。应理解,帧率是单位时间内显示的帧数,“相关”的含义是帧数可以以帧率计算得到的。示例性的,如在时长固定的前提下,可以根据帧率得到单位时间(如1s)内的帧数,根据时长和单位时间内的帧数得到动画的帧数。滑动动画的帧数与系统帧率相关指的是:滑动动画的帧数是通过系统帧率计算得到。如终端设备可以根据系统设帧率确定单位时间内的帧数,进而根据滑动动画的时长和单位时间内的帧数,得到滑动动画的帧数。It should be noted that the number of frames of the sliding animation in this embodiment of the present application is related to the system frame rate. That is, in this embodiment of the present application, the terminal device (or the GPU in the terminal device) may draw the sliding animation at the system frame rate. FIG. 5 is a schematic diagram 1 of an animation displaying a scroll bar on a page according to an embodiment of the present application. In Figure 5, the system frame rate is used to draw the sliding animation of the scroll bar as an example. It is the same as the above Figure 2. If the system frame rate is 60 Hz, the terminal device draws the sliding animation of the scroll bar at the system frame rate of 60 Hz, and calls eglswapbuffer to send the display. The animation frame of the sliding animation of the 17-frame scroll bar is displayed on the page of the terminal device. It should be understood that the frame rate is the number of frames displayed in a unit time, and the meaning of "related" is that the frame rate can be calculated by the frame rate. Exemplarily, on the premise that the duration is fixed, the number of frames in a unit time (eg, 1 s) may be obtained according to the frame rate, and the number of frames of the animation may be obtained according to the duration and the number of frames in the unit time. The number of frames of the sliding animation is related to the system frame rate, which means that the number of frames of the sliding animation is calculated by the system frame rate. For example, the terminal device can determine the number of frames per unit time according to the frame rate set by the system, and then obtain the number of frames of the sliding animation according to the duration of the sliding animation and the number of frames per unit time.
上述S402中,页面上滑动的滚动条静止时,终端设备可以获取滚动条的消失动画,以在页面上显示滚动条的消失动画,使得用户可以在页面上看到滚动条消失。与目前的技术方案不同的是,目前的技术方案中终端设备以系统帧率绘制滚动条的消失动画,该滚动条的消失动画的帧数与系统帧率相关,导致滚动条的消失动画的帧数过多,进而造成滚动 条的功耗大。本申请实施例中,终端设备获取的滚动条的消失动画的帧数与预设帧率相关,其中,预设帧率小于系统帧率。也就是说,本申请实施例中的滚动条的消失动画的帧数小于以系统帧率绘制的滚动条的消失动画的帧数,进而可以减小终端设备获取滚动条的消失动画的功耗,以减少滚动条的功耗。可选的,因为滚动条的消失动画的帧数与绘制滚动条的消失动画的帧率相关,因此本申请实施例中可以通过减小获取滚动条的消失动画的帧率的方式减小滚动条的功耗开销。如预设帧率为20Hz,当页面上的滚动条静止时,如图5所示,终端设备可以以预设帧率20Hz绘制滚动条的消失动画,且调用eglswapbuffer送显,进而使得终端设备的页面上显示滚动条的消失动画,即显示6帧动画帧。图6为以预设帧率显示滚动条的消失动画时的滚动条的变化示意图。示例性的,如图6所示,终端设备显示滚动条的消失动画时,滚动条的透明度可以逐渐变小,直至透明度变为0,滚动条消失。图6中以预设帧率20Hz显示滚动条的消失动画为例进行说明,其中,终端设备显示6帧动画帧即可以显示滚动条的消失动画。因为滚动条的消失动画的时长很短,如280ms,用户对滚动条的消失动画的帧数不感知,且滚动条的消失动画简单、消失动画中的动画帧间的差异很小,因此本申请实施例中通过减小滚动条的消失动画的帧数不会影响用户体验。应理解的是,若终端设备检测页面上滑动的滚动条未静止(滑动),则终端设备可以继续绘制滚动条的滑动动画。In the above S402, when the scroll bar sliding on the page is stationary, the terminal device may obtain the disappearing animation of the scroll bar to display the disappearing animation of the scroll bar on the page, so that the user can see the disappearance of the scroll bar on the page. Different from the current technical solution, in the current technical solution, the terminal device draws the disappearing animation of the scroll bar at the system frame rate, and the number of frames of the disappearing animation of the scroll bar is related to the system frame rate, resulting in the disappearing animation frame of the scroll bar. If the number is too large, the power consumption of the scroll bar is large. In this embodiment of the present application, the number of frames of the disappearing animation of the scroll bar acquired by the terminal device is related to the preset frame rate, where the preset frame rate is smaller than the system frame rate. That is to say, the number of frames of the disappearing animation of the scroll bar in the embodiment of the present application is less than the number of frames of the disappearing animation of the scroll bar drawn at the system frame rate, thereby reducing the power consumption of the terminal device to obtain the disappearing animation of the scroll bar, to reduce the power consumption of the scroll bar. Optionally, because the number of frames of the disappearing animation of the scroll bar is related to the frame rate of drawing the disappearing animation of the scroll bar, in this embodiment of the present application, the scroll bar can be reduced by reducing the frame rate of the disappearing animation of the scroll bar. power consumption. For example, the preset frame rate is 20Hz, when the scroll bar on the page is static, as shown in Figure 5, the terminal device can draw the disappearance animation of the scroll bar at the preset frame rate of 20Hz, and call eglswapbuffer to send the display, thereby making the terminal device's disappearance animation. The disappearing animation of the scroll bar is displayed on the page, that is, 6 animation frames are displayed. FIG. 6 is a schematic diagram of the change of the scroll bar when the disappearing animation of the scroll bar is displayed at a preset frame rate. Exemplarily, as shown in FIG. 6 , when the terminal device displays the disappearing animation of the scroll bar, the transparency of the scroll bar may gradually decrease until the transparency becomes 0 and the scroll bar disappears. FIG. 6 takes an example of displaying the disappearing animation of the scroll bar at a preset frame rate of 20 Hz, wherein the terminal device can display the disappearing animation of the scroll bar by displaying 6 animation frames. Because the duration of the disappearing animation of the scroll bar is very short, such as 280ms, the user does not perceive the number of frames of the disappearing animation of the scroll bar, and the disappearing animation of the scroll bar is simple and the difference between the animation frames in the disappearing animation is very small. Therefore, this application In the embodiment, the user experience is not affected by reducing the number of frames of the disappearing animation of the scroll bar. It should be understood that, if the terminal device detects that the scroll bar sliding on the page is not stationary (sliding), the terminal device may continue to draw a sliding animation of the scroll bar.
上述实施例中讲述了滚动条静止且页面上的其他元素也静止时,页面上显示滚动条的消失动画。在一种实施例中,当页面上的滚动条静止时,页面上还可以显示有动态元素,该动态元素如动态emoji图片、视频等。应理解,该动态元素不包括该滚动条。在该种实施例中,页面上可以显示滚动条的消失动画和动态元素,该动态元素的帧数与系统帧率相关。其中,动态元素的帧数与所述系统帧率相关指的是:终端设备以系统帧率绘制该动态元素,动态元素的帧数是通过系统帧率计算得到。本申请实施例中为了使得用户可以在页面上可以看到连续流畅的动态元素,则可以以系统帧率绘制该动态元素,为了减少滚动条的功耗,可以以预设帧率绘制滚动条的消失动画。应理解,终端设备以系统帧率绘制动态元素的过程,与终端设备以预设帧率绘制滚动条的消失动画的过程类似,下述介绍终端设备以预设帧率绘制滚动条的消失动画的过程。In the above-mentioned embodiments, when the scroll bar is stationary and other elements on the page are stationary, the disappearing animation of the scroll bar is displayed on the page. In one embodiment, when the scroll bar on the page is stationary, dynamic elements such as dynamic emoji pictures, videos, etc. may also be displayed on the page. It should be understood that the dynamic element does not include the scroll bar. In this embodiment, the disappearing animation of the scroll bar and the dynamic element can be displayed on the page, and the frame number of the dynamic element is related to the system frame rate. The relationship between the frame number of the dynamic element and the system frame rate means that the terminal device draws the dynamic element at the system frame rate, and the frame number of the dynamic element is calculated from the system frame rate. In this embodiment of the present application, in order to enable the user to see continuous and smooth dynamic elements on the page, the dynamic elements may be drawn at the system frame rate, and in order to reduce the power consumption of the scroll bar, the scroll bar may be drawn at the preset frame rate. disappearing animation. It should be understood that the process for the terminal device to draw the dynamic element at the system frame rate is similar to the process for the terminal device to draw the disappearing animation of the scroll bar at the preset frame rate. process.
示例性的,页面上存在视频,则当页面上的滚动条静止时,终端设备可以以20Hz绘制滚动条的消失动画、以60Hz绘制该视频,且调用eglswapbuffer将送显滚动条的消失动画和视频送显,进而使得终端设备的页面上显示滚动条的消失动画中的6帧动画帧以及视频中的17帧视频帧。类似于滑动动画的帧数与系统帧率相关,滚动条的消失动画的帧数与预设帧率相关指的是:滚动条的消失动画的帧数是通过预设帧率计算得到。如终端设备可以根据预设帧率确定单位时间内的帧数,进而根据滚动条的消失动画的时长和单位时间内的帧数,得到滚动条的消失动画的帧数。Exemplarily, if there is a video on the page, when the scroll bar on the page is still, the terminal device can draw the disappearing animation of the scroll bar at 20 Hz and the video at 60 Hz, and call eglswapbuffer to send the disappearing animation and video of the scroll bar. Then, 6 animation frames in the disappearing animation of the scroll bar and 17 video frames in the video are displayed on the page of the terminal device. Similar to the number of frames of the sliding animation is related to the system frame rate, the number of frames of the disappearing animation of the scroll bar is related to the preset frame rate means that the number of frames of the disappearing animation of the scroll bar is calculated by the preset frame rate. For example, the terminal device can determine the number of frames per unit time according to the preset frame rate, and then obtain the number of frames of the disappearing animation of the scroll bar according to the duration of the disappearing animation of the scroll bar and the number of frames per unit time.
本申请实施例中提供的滚动条的显示方法包括:当页面上的滚动条滑动时,在页面上显示滑动动画,滑动动画的帧数与系统帧率相关,滑动动画包括页面上的元素的滑动动画,页面上的元素包括滚动条;当页面上的滚动条静止时,在页面上显示滚动条的消失动画,滚动条的消失动画的帧数与预设帧率相关,预设帧率小于系统帧率。本申请实施例获取的滚动条的消失动画的帧数小于以系统帧率获取的滚动条的消失动画的帧数,因此可以减小终端设备显示滚动条的消失动画的功耗,进而能够减小滚动条的功耗,以及降低滚动条所 属的浏览场景的片上系统功耗。The scroll bar display method provided in the embodiment of the present application includes: when the scroll bar on the page slides, displaying a sliding animation on the page, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the sliding of elements on the page Animation, the elements on the page include scroll bars; when the scroll bars on the page are stationary, the disappearing animation of the scroll bars is displayed on the page. The number of frames of the disappearing animation of the scroll bars is related to the preset frame rate, and the preset frame rate is lower than the system frame rate. The number of frames of the disappearing animation of the scroll bar obtained by the embodiment of the present application is smaller than the number of frames of the disappearing animation of the scroll bar obtained at the system frame rate, so the power consumption of the terminal device for displaying the disappearing animation of the scroll bar can be reduced, and thus the power consumption of the disappearing animation of the scroll bar can be reduced. The power consumption of the scroll bar, and the system-on-chip power consumption of the browsing scene to which the scroll bar belongs is reduced.
下述实施例中对上述实施例中终端设备获取滚动条的消失动画的过程进行详细说明,示例性的通过4种可能实现的方式进行说明。In the following embodiments, the process of acquiring the disappearing animation of the scroll bar by the terminal device in the above-mentioned embodiment will be described in detail, and the description will be exemplified in four possible implementation manners.
第一种方式:在详细说明终端设备获取滚动条的消失动画的过程之前,首先对目前技术方案中终端设备显示滚动条、改变滚动条的位置、以及滚动条消失的过程进行简单介绍。图7为本申请实施例页面上显示滚动条的动画的示意图二。图7以应用程序a为例进行说明,应用程序a的页面为包含滚动条的页面,终端设备可以存储有应用程序a的控制逻辑代码。当用户滑动页面时,页面上的滚动条滑动,终端设备可以调用应用程序a的控制逻辑代码(如控制滚动条位置改变的代码),进行滚动条的滑动动画的绘制,且将滚动条的滑动动画送显以在页面上显示,在这个过程中,终端设备还可以根据调用的控制逻辑代码改变页面上滚动条的大小。当页面静止时,滚动条静止,此时终端设备可以缓存滚动条的位置和大小,且调用终端设备中的公用的滚动条消失的绘制代码,绘制滚动条的消失动画,在滚动条的消失动画绘制完成后,终端设备可以将滚动条的消失动画送显以在页面上显示。其中,公用的滚动条消失的绘制代码可以预设在终端设备中,终端设备上的应用程序在绘制滚动条的消失动画时均需调用该公用的绘制代码。The first way: Before describing in detail the process of the terminal device obtaining the disappearing animation of the scroll bar, the process of displaying the scroll bar, changing the position of the scroll bar, and disappearing the scroll bar in the current technical solution is briefly introduced first. FIG. 7 is a second schematic diagram of an animation of displaying a scroll bar on a page according to an embodiment of the present application. FIG. 7 takes the application a as an example for description. The page of the application a is a page including a scroll bar, and the terminal device may store the control logic code of the application a. When the user slides the page, the scroll bar on the page slides, and the terminal device can call the control logic code of application a (such as the code that controls the position change of the scroll bar) to draw the sliding animation of the scroll bar, and make the scroll bar slide. The animation is sent and displayed on the page. During this process, the terminal device can also change the size of the scroll bar on the page according to the called control logic code. When the page is stationary, the scroll bar is stationary. At this time, the terminal device can cache the position and size of the scroll bar, and call the common scroll bar disappearing drawing code in the terminal device to draw the disappearance animation of the scroll bar, and the disappearance animation of the scroll bar. After the drawing is completed, the terminal device can send the disappearing animation of the scroll bar to display on the page. Wherein, the common drawing code for the disappearance of the scroll bar can be preset in the terminal device, and the applications on the terminal device all need to call the common drawing code when drawing the disappearing animation of the scroll bar.
应注意的是,目前的技术方案中,滚动条消失的绘制代码中指示的绘制滚动条的消失动画的帧率为系统帧率,也就是说,终端设备在调用滚动条消失的绘制代码绘制滚动条的消失动画时,是以系统帧率绘制该滚动条的消失动画的。本申请实施例中可以预先修改该段滚动条消失的绘制代码指示的帧率为预设帧率,进而使得终端设备在调用该段滚动条消失的绘制代码时,以预设帧率绘制滚动条的消失动画,进而滚动条的消失动画的帧数减少,以降低滚动条的功耗。因为本申请实施例中对滚动条消失的绘制代码进行修改,因此并不影响页面中其他元素的显示。It should be noted that, in the current technical solution, the frame rate of the scroll bar disappearing animation indicated in the scroll bar disappearing drawing code is the system frame rate, that is, the terminal device draws the scroll bar when calling the scroll bar disappearing drawing code. During the disappearing animation of the scroll bar, the disappearing animation of the scroll bar is drawn at the system frame rate. In this embodiment of the present application, the frame rate indicated by the drawing code where the scroll bar disappears may be modified in advance, so that the terminal device draws the scroll bar at the preset frame rate when calling the drawing code where the scroll bar disappears. The disappearing animation of the scroll bar, and the number of frames of the disappearing animation of the scroll bar is reduced to reduce the power consumption of the scroll bar. Because the drawing code for the disappearance of the scroll bar is modified in the embodiment of the present application, the display of other elements in the page is not affected.
此处先介绍修改该段滚动条消失的绘制代码的过程。图8为以系统帧率绘制滚动条的消失动画的代码示意图。如图8所示,在滚动条消失的绘制代码所属的界面控制Activity栈中,找到列表视图(list view)下实现滚动条(scrollbars)的函数,在该函数下找到对应的绘制滚动条的消失动画的代码(即滚动条消失的绘制代码)进行修改。其中,实现滚动条的函数可以用于控制生成滚动条的消失动画,该实施例中未对该实现滚动条的函数进行调整,即采用的是滚动条的预设消失动画。滚动条的预设消失动画的帧数与系统帧率相关,也就是说,滚动条的预设消失动画是采用系统帧率预先绘制并存储在终端设备中的。其中,滚动条的预设消失动画的帧数与系统帧率相关指的是:滚动条的预设消失动画的帧数是根据系统帧率计算得到。图8中的a所示的滚动条消失的绘制代码指示的帧率为系统帧率,本申请实施例中可以将滚动条消失的绘制代码指示的帧率修改为预设帧率,如图8中的b所示。也就是说,本申请实施例中应用的是修改后的滚动条消失的绘制代码。The process of modifying the drawing code for the disappearance of the scroll bar in this paragraph is first introduced here. FIG. 8 is a schematic diagram of the code for drawing the disappearing animation of the scroll bar at the system frame rate. As shown in Figure 8, in the interface control Activity stack to which the drawing code where the scrollbar disappears belongs, find the function that implements the scrollbars in the list view, and find the corresponding disappearance of the scrollbar in the function. The code for the animation (that is, the drawing code for the scrollbar disappearing) is modified. The function for implementing the scroll bar may be used to control the generation of the disappearing animation of the scroll bar. In this embodiment, the function for realizing the scroll bar is not adjusted, that is, the preset disappearing animation of the scroll bar is used. The frame number of the preset disappearing animation of the scroll bar is related to the system frame rate, that is to say, the preset disappearing animation of the scroll bar is pre-drawn at the system frame rate and stored in the terminal device. The number of frames of the preset disappearing animation of the scroll bar is related to the system frame rate means that the number of frames of the preset disappearing animation of the scroll bar is calculated according to the system frame rate. The frame rate indicated by the drawing code where the scroll bar disappears as shown in a in FIG. 8 is the system frame rate. In this embodiment of the present application, the frame rate indicated by the drawing code where the scroll bar disappears can be modified to the preset frame rate, as shown in FIG. 8 shown in b. That is to say, what is used in the embodiment of the present application is the modified drawing code for the disappearance of the scroll bar.
图9为本申请实施例提供的滚动条的显示方法的另一实施例的流程示意图。如图9所示,上述S402可以替换为S502:当页面上的滚动条静止时,调用滚动条消失的绘制代码,绘制滚动条的消失动画,且在页面上显示滚动条的消失动画。FIG. 9 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application. As shown in FIG. 9 , the above S402 can be replaced by S502: when the scroll bar on the page is stationary, call the drawing code for the disappearance of the scroll bar, draw the disappearance animation of the scroll bar, and display the disappearance animation of the scroll bar on the page.
上述S502中,在滚动条静止时,终端设备可以调用终端设备中存储的公用的滚动条消失的绘制代码,绘制滚动条的消失动画。其中,绘制代码用于指示预设帧率。图8中所 示的实现滚动条的函数可以用于表征第一预设亮度变化信息,该第一预设亮度变化信息用于指示滚动条的消失动画中滚动条的亮度。本申请实施例中调用滚动条消失的绘制代码绘制滚动条的消失动画的过程,即为终端设备根据第一预设亮度变化信息,绘制滚动条的消失动画的过程。应理解,该第一预设亮度变化信息可以用于指示滚动条连续变化的亮度,如该第一预设亮度变化信息为滚动条的亮度变化曲线,图10为滚动条的亮度变化曲线示意图。In the above S502, when the scroll bar is stationary, the terminal device may call the common drawing code for the disappearance of the scroll bar stored in the terminal device to draw the disappearance animation of the scroll bar. Among them, the drawing code is used to indicate the preset frame rate. The function of realizing the scroll bar shown in FIG. 8 can be used to represent the first preset brightness change information, and the first preset brightness change information is used to indicate the brightness of the scroll bar in the disappearance animation of the scroll bar. In the embodiment of the present application, the process of drawing the disappearance animation of the scroll bar by calling the drawing code for the disappearance of the scroll bar is the process of drawing the disappearance animation of the scroll bar by the terminal device according to the first preset brightness change information. It should be understood that the first preset brightness change information can be used to indicate the continuously changing brightness of the scroll bar. For example, the first preset brightness change information is the brightness change curve of the scroll bar, and FIG. 10 is a schematic diagram of the brightness change curve of the scroll bar.
本申请实施例中,在页面上的滚动条静止时,终端设备可以缓存滚动条的位置和大小,也可以缓存滚动条的亮度,进而终端设备根据第一预设亮度变化信息,以及滚动条静止时滚动条的亮度,采用预设帧率绘制滚动条的消失动画。示例性的,如预设帧率为20Hz,则终端设备需要绘制6帧动画帧,则终端设备可以在滚动条的亮度变化曲线中每间隔约47ms获取滚动条的亮度,进而根据获取的亮度绘制对应的滚动条的动画帧,以得到亮度不断减小的滚动条的消失动画。In the embodiment of the present application, when the scroll bar on the page is stationary, the terminal device may cache the position and size of the scroll bar, and may also cache the brightness of the scroll bar, and then the terminal device may change the information according to the first preset brightness and the scroll bar is stationary When the brightness of the scroll bar is set, the disappearing animation of the scroll bar is drawn at the preset frame rate. Exemplarily, if the preset frame rate is 20 Hz, and the terminal device needs to draw 6 animation frames, the terminal device can obtain the brightness of the scroll bar every about 47ms in the brightness change curve of the scroll bar, and then draw the brightness according to the obtained brightness. The animation frame of the corresponding scroll bar to get the disappearing animation of the scroll bar with decreasing brightness.
下面对绘制代码指示预设帧率的方式进行说明。在一种可能的实现方式中,绘制代码包括滚动条的消失动画中相邻两帧动画帧之间的时间间隔。如相邻两帧动画帧之间的时间间隔为50ms,则在滚动条的消失动画的时长为280ms的前提下,滚动条的消失动画可以包括6帧动画帧。在该种方式中,开发人员在上述图8对绘制代码的修改过程中,可以修改绘制代码中的时延参数(即相邻两帧动画帧之间的时间间隔),使得修改后的相邻两帧动画帧之间的时间间隔为50ms。相对应的,在终端设备调用滚动条消失的绘制代码,获取的滚动条的消失动画中相邻两帧动画帧之间的时间间隔为50ms,滚动条的消失动画包括6帧动画帧,也就是说,终端设备按照预设帧率绘制滚动条的消失动画,滚动条的消失动画与预设帧率相关。The following describes how the rendering code indicates the preset frame rate. In a possible implementation manner, the drawing code includes a time interval between two adjacent animation frames in the disappearing animation of the scroll bar. For example, the time interval between two adjacent animation frames is 50ms, and on the premise that the duration of the disappearance animation of the scrollbar is 280ms, the disappearance animation of the scrollbar may include 6 animation frames. In this way, the developer can modify the time delay parameter in the drawing code (that is, the time interval between two adjacent animation frames) in the process of modifying the drawing code in the above-mentioned Fig. 8, so that the modified adjacent The time interval between two animation frames is 50ms. Correspondingly, when the terminal device calls the drawing code for the disappearance of the scroll bar, the time interval between two adjacent animation frames in the disappearance animation of the scroll bar obtained is 50ms, and the disappearance animation of the scroll bar includes 6 animation frames, that is, That is to say, the terminal device draws the disappearing animation of the scroll bar according to the preset frame rate, and the disappearing animation of the scroll bar is related to the preset frame rate.
在另一种可能的实现方式中,绘制代码包括倍数参数,倍数参数用于表征预设帧率与系统帧率的倍数关系。如系统帧率为60Hz,绘制代码包括的倍数参数为3,因为本申请实施例中的预设帧率小于系统帧率,因此根据该倍数参数为3可以确定系统帧率是预设帧率的3倍,进而得到预设帧率为20Hz。在该种方式中,开发人员在上述图8对绘制代码的修改过程中,可以修改绘制代码中的倍数参数,使得修改后的倍数参数为3。相对应的,在终端设备调用滚动条消失的绘制代码,绘制滚动条的消失动画的帧率为预设帧率20Hz,进而得到的滚动条的消失动画包括6帧动画帧。In another possible implementation manner, the drawing code includes a multiple parameter, and the multiple parameter is used to represent the multiple relationship between the preset frame rate and the system frame rate. For example, if the system frame rate is 60 Hz, the multiple parameter included in the drawing code is 3. Because the preset frame rate in this embodiment of the present application is smaller than the system frame rate, it can be determined that the system frame rate is the preset frame rate according to the multiple parameter being 3. 3 times, and then the preset frame rate is 20Hz. In this way, the developer can modify the multiple parameter in the drawing code during the modification process of the drawing code in the above-mentioned FIG. 8 , so that the modified multiple parameter is 3. Correspondingly, the terminal device calls the drawing code for the disappearance of the scroll bar, and the frame rate of the disappearance animation of the scroll bar is drawn at a preset frame rate of 20 Hz, and the obtained disappearance animation of the scroll bar includes 6 animation frames.
在另一种可能的实现方式中,绘制代码包括预设帧率。与上述两种方式不同的是,上述两种方式中的绘制代码均间接指示了预设帧率,该种方式中绘制代码中可以直接包括预设帧率。在该种方式中,开发人员在上述图8对绘制代码的修改过程中,可以修改绘制代码中的帧率,使得修改后的绘制滚动条的消失动画的帧率为预设帧率。相对应的,在终端设备调用滚动条消失的绘制代码,绘制滚动条的消失动画的帧率为预设帧率20Hz,进而得到的滚动条的消失动画包括6帧动画帧。In another possible implementation, the drawing code includes a preset frame rate. Different from the above two methods, the drawing codes in the above two methods both indirectly indicate the preset frame rate, and in this method, the preset frame rate may be directly included in the drawing code. In this way, the developer can modify the frame rate in the drawing code during the modification process of the drawing code in the above-mentioned FIG. 8 , so that the frame rate of the modified drawing scroll bar disappearing animation is the preset frame rate. Correspondingly, the terminal device invokes the scroll bar disappearing drawing code, and the frame rate of the scroll bar disappearing animation is a preset frame rate of 20 Hz, and the obtained scroll bar disappearing animation includes 6 animation frames.
在另一种可能的实现方式中,绘制代码可以包括获取滚动条的消失动画的预设帧率的函数关系式。也就是说,终端设备根据该函数关系式可以计算得到预设帧率,即采用间接的方式使得绘制代码指示预设帧率。在该种方式中,开发人员在上述图8对绘制代码的修改过程中,可以写入预设帧率的函数关系式。相对应的,在终端设备调用滚动条消失的绘制代码,可以根据该函数关系式得到预设帧率,进而以该预设帧率绘制滚动条的消失动画。In another possible implementation manner, the drawing code may include a functional relationship for obtaining a preset frame rate of the disappearing animation of the scroll bar. That is to say, the terminal device can calculate the preset frame rate according to the functional relationship, that is, the drawing code can indicate the preset frame rate in an indirect manner. In this way, the developer can write the function relational expression of the preset frame rate in the process of modifying the drawing code in the above-mentioned FIG. 8 . Correspondingly, calling the drawing code for the disappearance of the scroll bar on the terminal device can obtain the preset frame rate according to the functional relationship, and then draw the disappearance animation of the scroll bar at the preset frame rate.
应理解,本申请实施例中对如何修改绘制代码使得绘制代码指示预设帧率的方式不做限制,开发人员可以重新编写绘制代码,或者为了尽可能少地改动源绘制代码,可以修改绘制代码中的参数等。It should be understood that in the embodiments of the present application, there is no restriction on how to modify the drawing code so that the drawing code indicates the preset frame rate. The developer can rewrite the drawing code, or modify the drawing code in order to change the source drawing code as little as possible. parameters, etc.
本申请实施例中,可以预先对滚动条消失的绘制代码进行修改,使得采用修改后的滚动条消失的绘制代码,以预设帧率绘制滚动条的消失动画,进而达到减少滚动条的消失动画的帧数的目的,以减少滚动条的功耗。In the embodiment of the present application, the scroll bar disappearing drawing code may be modified in advance, so that the scroll bar disappearing animation is drawn at a preset frame rate by using the modified scroll bar disappearing drawing code, thereby reducing the scroll bar disappearing animation The number of frames for the purpose of reducing the power consumption of the scroll bar.
第二种方式:与上述第一种方式类似的,也是采用预先修改代码的方式控制减少滚动条的消失动画的帧数。与上述第一种方式不同的是,第一种方式修改的是滚动条消失的绘制代码,而第二种方式中可以修改实现滚动条的函数。也就是说,本申请实施例中可以通过修改实现滚动条的函数的方式减小生成的滚动条的消失动画的帧数。在该种实现方式中,开发人员可以在滚动条消失的绘制代码所属的Activity栈中,找到列表视图(list view)下实现滚动条(scrollbars)的函数,进而修改该函数,使得终端设备调用该函数时可以生成滚动条的消失动画,该滚动条的消失动画的帧数与预设帧率相关。The second method: Similar to the first method above, it is also used to modify the code in advance to control and reduce the number of frames of the disappearing animation of the scroll bar. The difference from the first method above is that the first method modifies the drawing code where the scroll bar disappears, while the second method can modify the function that implements the scroll bar. That is, in the embodiment of the present application, the number of frames of the generated scroll bar disappearance animation can be reduced by modifying the function for realizing the scroll bar. In this implementation, the developer can find the function of implementing scrollbars in the list view in the Activity stack to which the drawing code where the scrollbar disappears belongs, and then modify the function so that the terminal device calls the function. When the function is used, the disappearing animation of the scroll bar can be generated, and the number of frames of the disappearing animation of the scroll bar is related to the preset frame rate.
可选的,修改滚动条的消失动画的生成函数(实现滚动条的函数)可以为:将滚动条的消失动画的生成帧率修改为预设帧率。上述第一种方式中,实现滚动条的函数用于指示滚动条的亮度变化曲线,该方式中可以将实现滚动条的函数修改成用于指示第二预设亮度变化信息的离散的函数。其中,第二预设亮度变化信息用于指示滚动条的消失动画中滚动条的预设数量个亮度值,该预设数量等于滚动条的消失动画的帧数。示例性的,如以预设帧率20Hz绘制滚动条的消失动画时该滚动条的消失动画的帧数为6帧,则第二预设亮度变化信息可以用于指示滚动条的消失动画中滚动条的6个亮度值,如上述第一种方式中终端设备每隔47ms获取的亮度值。对应的,该实现滚动条的函数可以为如图11所示的离散函数。图11为滚动条的亮度变化值的示意图。可选的,在一种可能的实现方式中,修改滚动条的消失动画的生成函数可以为:修改滚动条的消失动画的总时长,因为当绘制滚动条的消失动画的帧率不变时,减少滚动条的消失动画的总时长,相应的也可以减少滚动条的消失动画的帧数,进而达到减小滚动条的功耗的目的。Optionally, the generation function for modifying the disappearing animation of the scroll bar (the function for implementing the scroll bar) may be: modifying the generation frame rate of the disappearing animation of the scroll bar to a preset frame rate. In the above first manner, the function implementing the scroll bar is used to indicate the brightness change curve of the scroll bar. In this manner, the function implementing the scroll bar can be modified into a discrete function for indicating the second preset luminance variation information. The second preset brightness change information is used to indicate a preset number of brightness values of the scroll bar in the disappearance animation of the scroll bar, and the preset number is equal to the frame number of the disappearance animation of the scroll bar. Exemplarily, if the disappearing animation of the scroll bar is drawn at a preset frame rate of 20 Hz, the number of frames of the disappearing animation of the scroll bar is 6 frames, then the second preset brightness change information can be used to indicate scrolling in the disappearing animation of the scroll bar. 6 brightness values of the bar, such as the brightness values obtained by the terminal device every 47ms in the first method above. Correspondingly, the function for implementing the scroll bar may be a discrete function as shown in FIG. 11 . FIG. 11 is a schematic diagram of the brightness change value of the scroll bar. Optionally, in a possible implementation manner, the generation function for modifying the disappearing animation of the scroll bar may be: modifying the total duration of the disappearing animation of the scroll bar, because when the frame rate of drawing the disappearing animation of the scroll bar remains unchanged, The total duration of the disappearing animation of the scroll bar can be reduced, and correspondingly, the number of frames of the disappearing animation of the scroll bar can also be reduced, thereby achieving the purpose of reducing the power consumption of the scroll bar.
应理解,与上述第一种方式相同的,修改后的消失动画的生成函数、修改后的滚动条消失的绘制代码均可以预设在终端设备中,本申请实施例中为了表示与目前的消失动画的生成函数、滚动条消失的绘制代码的区别描述修改过程。It should be understood that, in the same way as the above-mentioned first method, the generation function of the modified disappearance animation and the modified drawing code for the disappearance of the scroll bar can all be preset in the terminal device. The difference between the animation generation function and the drawing code where the scroll bar disappears describes the modification process.
图12为本申请实施例提供的滚动条的显示方法的另一实施例的流程示意图。如图12所示,上述S402可以替换为S602:当页面上的滚动条静止时,调用滚动条的消失动画的生成函数,生成滚动条的消失动画,且在页面上显示滚动条的消失动画。FIG. 12 is a schematic flowchart of another embodiment of a method for displaying a scroll bar according to an embodiment of the present application. As shown in FIG. 12 , the above S402 can be replaced by S602: when the scroll bar on the page is stationary, call the generation function of the disappearing animation of the scroll bar, generate the disappearing animation of the scroll bar, and display the disappearing animation of the scroll bar on the page.
在上述S602中,在终端设备检测到页面上滑动的滚动条静止时,可以调用滚动条的消失动画的生成函数,生成滚动条的消失动画。因为终端设备中预设的滚动条的消失动画的生成函数为开发人员修改后的函数,因此生成的滚动条的消失动画的帧数小于预设消失动画的帧数。本申请实施例中,终端设备生成滚动条的消失动画后,可以显示滚动条的消失动画。也就是说,终端设备可以根据第二预设亮度变化信息,生成滚动条的消失动画。其中,终端设备可以根据第二预设亮度变化信息指示的预设数量个亮度值,绘制出对应亮度值的滚动条的动画帧,进而得到滚动条的消失动画。In the above S602, when the terminal device detects that the scroll bar sliding on the page is stationary, the terminal device may call the generation function of the disappearing animation of the scroll bar to generate the disappearing animation of the scroll bar. Because the function for generating the preset disappearing animation of the scroll bar in the terminal device is a function modified by the developer, the number of frames of the generated disappearing animation of the scroll bar is smaller than that of the preset disappearing animation. In this embodiment of the present application, after the terminal device generates the disappearing animation of the scroll bar, it can display the disappearing animation of the scroll bar. That is, the terminal device may generate a disappearing animation of the scroll bar according to the second preset brightness change information. The terminal device may draw an animation frame of the scroll bar corresponding to the brightness value according to the preset number of brightness values indicated by the second preset brightness change information, and then obtain the disappearance animation of the scroll bar.
本申请实施例中,可以预先对生成滚动条的消失动画的函数进行修改,使得采用修改后的函数生成的滚动条的消失动画的帧率为预设帧率,进而从源头减少滚动条的消失动画的帧数,能够减少滚动条的功耗。In the embodiment of the present application, the function for generating the disappearing animation of the scroll bar may be modified in advance, so that the frame rate of the disappearing animation of the scroll bar generated by using the modified function is a preset frame rate, thereby reducing the disappearance of the scroll bar from the source. The number of frames of the animation can reduce the power consumption of the scroll bar.
上述两种方式通过预先修改滚动条消失的绘制代码或者滚动条的消失动画的生成函数,使得终端设备可以在绘制滚动条的消失动画或者在生成滚动条的消失动画时,调用修改后的消失的绘制代码或者滚动条的消失动画的生成函数,得到帧数少于预设消失动画的帧数的消失动画。下述两种方式中可以预先不对滚动条消失的绘制代码或者滚动条的消失动画的生成函数进行修改,在绘制动条的消失动画时对预设消失动画进行处理,也能够获取帧数少于预设消失动画的帧数的消失动画。The above two methods pre-modify the scroll bar disappearing drawing code or the scroll bar disappearing animation generation function, so that the terminal device can call the modified disappearing scroll bar when drawing the scroll bar disappearing animation or generating the scroll bar disappearing animation. The generation function of the disappearing animation of the drawing code or the scroll bar, and the disappearing animation of which the number of frames is less than the frame number of the preset disappearing animation is obtained. In the following two methods, the drawing code for the disappearance of the scroll bar or the generation function of the disappearing animation of the scroll bar can not be modified in advance, and the preset disappearing animation can be processed when the disappearing animation of the moving bar is drawn. The disappearing animation of the number of frames of the preset disappearing animation.
第三种方式:图13为本申请实施例提供的滚动条的显示方法的另一实施例的流程示意图。如图13所示,上述S402可以替换为S702:当页面上的滚动条静止,以及在页面上检测到滚动条的预设消失动画中的第一帧动画帧时,对预设消失动画进行抽帧处理,得到滚动条的消失动画,且在页面上显示滚动条的消失动画。The third way: FIG. 13 is a schematic flowchart of another embodiment of the scroll bar display method provided by the embodiment of the present application. As shown in FIG. 13 , the above S402 can be replaced by S702: when the scroll bar on the page is stationary, and when the first animation frame in the preset disappearing animation of the scroll bar is detected on the page, the preset disappearing animation is extracted. Frame processing, get the disappearing animation of the scroll bar, and display the disappearing animation of the scroll bar on the page.
在上述S702中,在终端设备检测到页面上滑动的滚动条静止时,可以按照系统帧率开始显示预设消失动画。本申请实施例中为了减小滚动条的功耗,可以减少预设消失动画的帧数,因此终端设备可以在页面上检测到滚动条的预设消失动画中的第一帧动画时,对预设消失动画进行抽帧处理,进而得到帧数少于预设消失动画的帧数的滚动条的消失动画。In the above S702, when the terminal device detects that the scroll bar sliding on the page is stationary, it may start to display the preset disappearing animation according to the system frame rate. In this embodiment of the present application, in order to reduce the power consumption of the scroll bar, the number of frames of the preset disappearing animation may be reduced. Therefore, when the terminal device detects the first frame of animation in the preset disappearing animation of the scroll bar on the page, Set the disappearing animation to perform frame extraction processing, and then obtain the disappearing animation of the scroll bar whose frame number is less than the frame number of the preset disappearing animation.
终端设备中存储有预设消失动画,因此终端设备可以确定预设消失动画中的每一帧动画帧。终端设备检测到滚动条静止时,可以将页面上显示的滚动条的动画帧与预设消失动画中的第一帧动画帧进行比较分析,确定页面上显示的滚动条的动画帧是否为第一帧动画帧。其中,当终端设备检测到页面上显示的滚动条的动画帧为第一帧动画帧时,可以对预设消失动画进行抽帧处理。A preset disappearing animation is stored in the terminal device, so the terminal device can determine each animation frame in the preset disappearing animation. When the terminal device detects that the scroll bar is still, it can compare and analyze the animation frame of the scroll bar displayed on the page and the first animation frame of the preset disappearing animation to determine whether the animation frame of the scroll bar displayed on the page is the first animation frame. Frame animation frames. Wherein, when the terminal device detects that the animation frame of the scroll bar displayed on the page is the first animation frame, it can perform frame extraction processing on the preset disappearing animation.
应注意,与上述两种方式不同的是,上述两种方式是直接调用滚动条消失的绘制代码或滚动条的消失动画的生成函数,得到滚动条的消失动画。而该方式中,终端设备在页面上检测到滚动条的预设消失动画中的第一帧动画时,可以修改调用的eglswapbuffer的频率,如降低调用eglswapbuffer的频率,以实现对预设消失动画的抽帧处理。示例性的,如上述图2中以系统帧率60Hz绘制滚动条的消失动画后,调用eglswapbuffer的频率可以与系统帧率相关,如调用eglswapbuffer的频率可以为60Hz,“相关”可以指的是调用eglswapbuffer的频率可以与系统帧率相同。而该种方式中,图14为本申请实施例页面上显示滚动条的动画的示意图三。如图14所示,当终端设备以系统帧率60Hz绘制滚动条的消失动画后,终端设备降低调用eglswapbuffer的频率,如20Hz,以减小预设消失动画的送显的频率,实现对预设消失动画的抽帧处理,以减小终端设备显示的滚动条的消失动画的帧数。It should be noted that the difference from the above two methods is that the above two methods directly call the drawing code for the disappearance of the scroll bar or the generation function of the disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar. In this method, when the terminal device detects the first frame of animation in the preset disappearing animation of the scroll bar on the page, it can modify the frequency of calling eglswapbuffer, such as reducing the frequency of calling eglswapbuffer, so as to realize the automatic disappearance of the preset disappearing animation. Frame extraction. Exemplarily, after the disappearing animation of the scroll bar is drawn at the system frame rate of 60Hz as shown in Figure 2 above, the frequency of calling eglswapbuffer may be related to the system frame rate. For example, the frequency of calling eglswapbuffer may be 60Hz, and "correlation" may refer to calling The frequency of eglswapbuffer can be the same as the system frame rate. In this manner, FIG. 14 is a schematic diagram 3 of an animation displaying a scroll bar on a page according to an embodiment of the present application. As shown in Figure 14, when the terminal device draws the disappearing animation of the scroll bar at the system frame rate of 60 Hz, the terminal device reduces the frequency of calling eglswapbuffer, such as 20 Hz, to reduce the frequency of sending the preset disappearing animation and realize the preset disappearance animation. Frame extraction processing of the disappearing animation to reduce the number of frames of the disappearing animation of the scroll bar displayed by the terminal device.
在该种方式中,当终端设备检测到滚动条静止,且在页面上检测到滚动条的预设消失动画中的第一帧动画帧时,对预设消失动画进行抽帧处理。其中,滚动条静止和页面上显示预设消失动画中的第一帧动画帧之间可能存在间隔时长,该间隔时长虽然很短,但是仍然会造成显示滚动条的消失动画的时延。因本申请实施例中,终端设备可以在检测到滚动条静止时就对预设消失动画进行抽帧处理,进而可以避免显示滚动条的消失动画的时延。In this manner, when the terminal device detects that the scroll bar is stationary, and detects the first animation frame in the preset disappearing animation of the scroll bar on the page, the preset disappearing animation is subjected to frame extraction processing. There may be an interval between the scroll bar being still and the first animation frame in the preset disappearing animation displayed on the page. Although the interval is very short, it still causes a delay in displaying the disappearing animation of the scroll bar. Because in the embodiment of the present application, the terminal device can perform frame extraction processing on the preset disappearing animation when detecting that the scroll bar is stationary, thereby avoiding the delay in displaying the disappearing animation of the scroll bar.
本申请实施例中,可以对预设消失动画进行抽帧处理,得到帧数少于预设消失动画的 帧数的滚动条的消失动画,同样能够达到减小滚动条的功耗的目的。In the embodiment of the present application, the preset disappearing animation can be processed by frame extraction to obtain the disappearing animation of the scroll bar whose frame number is less than the frame number of the preset disappearing animation, which can also achieve the purpose of reducing the power consumption of the scroll bar.
图15为本申请实施例提供的滚动条的显示装置的结构示意图。图15所示的滚动条的显示装置可以为上述实施例中的终端设备、或者终端设备中的芯片、处理器等,可以执行上述图4、图9、图12、图13中的滚动条的显示方法。该滚动条的显示装置1500可以包括:显示模块1501、处理模块1502。FIG. 15 is a schematic structural diagram of a display device for scroll bars according to an embodiment of the present application. The display device of the scroll bar shown in FIG. 15 may be the terminal device in the above-mentioned embodiment, or a chip, processor, etc. Display method. The display device 1500 of the scroll bar may include: a display module 1501 and a processing module 1502 .
显示模块1501,用于当页面上的滚动条滑动时,在页面上显示滑动动画,滑动动画的帧数与系统帧率相关,滑动动画包括页面上的元素的滑动动画,页面上的元素包括滚动条。The display module 1501 is used to display a sliding animation on the page when the scroll bar on the page slides. The number of frames of the sliding animation is related to the system frame rate. The sliding animation includes the sliding animation of elements on the page, and the elements on the page include scrolling strip.
显示模块1501,还用于当页面上的滚动条静止时,在页面上显示滚动条的消失动画,滚动条的消失动画的帧数与预设帧率相关,预设帧率小于系统帧率。The display module 1501 is further configured to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary. The frame number of the disappearing animation of the scroll bar is related to a preset frame rate, and the preset frame rate is lower than the system frame rate.
在一种可能的实现方式中,处理模块1502,用于检测滚动条在页面的位置;且若位置在预设时长内不变,则确定页面上的滚动条静止。In a possible implementation manner, the processing module 1502 is configured to detect the position of the scroll bar on the page; and if the position does not change within a preset time period, determine that the scroll bar on the page is stationary.
在一种可能的实现方式中,处理模块1502,还用于采用预设帧率绘制滚动条的消失动画。In a possible implementation manner, the processing module 1502 is further configured to use a preset frame rate to draw the disappearing animation of the scroll bar.
在一种可能的实现方式中,显示模块1501,具体用于若页面上存在动态元素,则在页面上显示滚动条的消失动画和动态元素,动态元素的帧数与系统帧率相关。In a possible implementation manner, the display module 1501 is specifically configured to display the disappearing animation of the scroll bar and the dynamic elements on the page if there are dynamic elements on the page, and the frame number of the dynamic elements is related to the system frame rate.
在一种可能的实现方式中,处理模块1502,还用于采用预设帧率绘制滚动条的消失动画,以及采用系统帧率绘制动态元素。In a possible implementation manner, the processing module 1502 is further configured to use a preset frame rate to draw the disappearing animation of the scroll bar, and use the system frame rate to draw dynamic elements.
在一种可能的实现方式中,处理模块1502,具体用于根据第一预设亮度变化信息,以及滚动条静止时滚动条的亮度,采用预设帧率绘制滚动条的消失动画,第一预设亮度变化信息用于指示滚动条的消失动画中滚动条的亮度。In a possible implementation manner, the processing module 1502 is specifically configured to use a preset frame rate to draw the disappearance animation of the scroll bar according to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary, and the first preset Let the brightness change information be used to indicate the brightness of the scroll bar in the disappearing animation of the scroll bar.
在一种可能的实现方式中,第一预设亮度变化信息为滚动条的亮度变化曲线。In a possible implementation manner, the first preset brightness change information is a brightness change curve of the scroll bar.
在一种可能的实现方式中,处理模块1502,还用于根据第二预设亮度变化信息,生成滚动条的消失动画,第二预设亮度变化信息用于指示滚动条的消失动画中滚动条的预设数量个亮度值,预设数量等于滚动条的消失动画的帧数。In a possible implementation manner, the processing module 1502 is further configured to generate a disappearance animation of the scroll bar according to the second preset brightness change information, and the second preset brightness change information is used to indicate the scroll bar in the disappearance animation of the scroll bar The preset number of brightness values, the preset number is equal to the number of frames of the disappearing animation of the scroll bar.
在一种可能的实现方式中,处理模块1502,还用于对滚动条的预设消失动画进行抽帧处理,得到滚动条的消失动画,预设消失动画的帧数与系统帧率相关。In a possible implementation manner, the processing module 1502 is further configured to perform frame extraction processing on the preset disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar, and the frame number of the preset disappearing animation is related to the system frame rate.
在一种可能的实现方式中,处理模块1502,还用于当在页面上检测到滚动条的预设消失动画中的第一帧动画帧时,对预设消失动画进行抽帧处理,得到滚动条的消失动画,预设消失动画的帧数与系统帧率相关。In a possible implementation manner, the processing module 1502 is further configured to perform frame extraction processing on the preset disappearing animation when the first animation frame in the preset disappearing animation of the scroll bar is detected on the page to obtain the scroll bar The disappearing animation of the bar. The number of frames of the preset disappearing animation is related to the system frame rate.
本申请实施例提供的滚动条的显示装置,可以执行上述方法实施例中终端设备的动作,其实现原理和技术效果类似,在此不再赘述。The scroll bar display device provided in the embodiment of the present application can perform the actions of the terminal device in the foregoing method embodiments, and the implementation principle and technical effect thereof are similar, and are not repeated here.
需要说明的是,应理解以上处理模块可以以软件通过处理元件调用的形式实现;也可以以硬件的形式实现。例如,处理模块可以为单独设立的处理元件,也可以集成在上述装置的某一个芯片中实现,此外,也可以以程序代码的形式存储于上述装置的存储器中,由上述装置的某一个处理元件调用并执行以上处理模块的功能。此外这些模块全部或部分可以集成在一起,也可以独立实现。这里所述的处理元件可以是一种集成电路,具有信号的处理能力。在实现过程中,上述方法的各步骤或以上各个模块可以通过处理器元件中的硬件的集成逻辑电路或者软件形式的指令完成。例如,以上这些模块可以是被配置成实施以 上方法的一个或多个集成电路,例如:一个或多个专用集成电路(application specific integrated circuit,ASIC),或,一个或多个微处理器(digital signal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)等。再如,当以上某个模块通过处理元件调度程序代码的形式实现时,该处理元件可以是通用处理器,例如中央处理器(central processing unit,CPU)或其它可以调用程序代码的处理器。再如,这些模块可以集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现。It should be noted that, it should be understood that the above processing modules may be implemented in the form of software calling through processing elements; and may also be implemented in the form of hardware. For example, the processing module may be a separately established processing element, or may be integrated into a certain chip of the above-mentioned device to be implemented, in addition, it may also be stored in the memory of the above-mentioned device in the form of program code, and a certain processing element of the above-mentioned device Call and execute the function of the above processing module. In addition, all or part of these modules can be integrated together, and can also be implemented independently. The processing element described here may be an integrated circuit with signal processing capability. In the implementation process, each step of the above-mentioned method or each of the above-mentioned modules can be completed by an integrated logic circuit of hardware in the processor element or an instruction in the form of software. For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital) signal processor, DSP), or, one or more field programmable gate arrays (field programmable gate array, FPGA), etc. For another example, when a certain module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (central processing unit, CPU) or other processors that can call program codes. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
终端设备通过GPU,显示屏,以及应用处理器等可以实现显示功能。GPU为图像处理的微处理器,连接显示屏和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器可包括一个或多个GPU,其执行指令以生成或改变显示信息。本申请实施例中的显示模块可以为显示屏,显示屏用于显示图像,视频,动画等。显示屏可以包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,终端设备可以包括1个或N个显示屏,N为大于1的正整数。The terminal device can realize the display function through the GPU, the display screen, and the application processor. The GPU is a microprocessor for image processing, which connects the display screen and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor may include one or more GPUs that execute instructions to generate or change display information. The display module in this embodiment of the present application may be a display screen, and the display screen is used to display images, videos, animations, and the like. The display screen may include a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light). emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on. In some embodiments, the terminal device may include 1 or N display screens, where N is a positive integer greater than 1.
图16为本申请实施例提供的电子设备的结构示意图。该电子设备如上述所示的终端设备。如图16所示,该电子设备1600可以包括:处理器1601(例如CPU)、存储器1602和显示器1603。显示器1603可以耦合至处理器1601,显示器1603显示滚动条的动画,该滚动条的动画可以包括滚动条的滑动动画和滚动条的消失动画。存储器1602可能包含高速随机存取存储器(random-access memory,RAM),也可能还包括非易失性存储器(non-volatile memory,NVM),例如至少一个磁盘存储器,存储器1602中可以存储各种指令,以用于完成各种处理功能以及实现本申请的方法步骤。可选的,本申请涉及的电子设备1600还可以包括:电源1604、通信总线1605以及通信端口1606。上述通信端口1606用于实现电子设备与其他外设之间进行连接通信。FIG. 16 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device is the terminal device shown above. As shown in FIG. 16 , the electronic device 1600 may include: a processor 1601 (eg, a CPU), a memory 1602 and a display 1603 . A display 1603 may be coupled to the processor 1601, and the display 1603 may display an animation of a scroll bar, which may include a sliding animation of the scroll bar and a disappearing animation of the scroll bar. The memory 1602 may include high-speed random-access memory (RAM), and may also include non-volatile memory (non-volatile memory, NVM), such as at least one disk memory, in which various instructions can be stored , used to complete various processing functions and implement the method steps of the present application. Optionally, the electronic device 1600 involved in this application may further include: a power supply 1604 , a communication bus 1605 and a communication port 1606 . The above-mentioned communication port 1606 is used to implement connection and communication between the electronic device and other peripheral devices.
在本申请实施例中,上述存储器1602用于存储计算机可执行程序代码,程序代码包括指令;当处理器1601执行指令时,指令使电子设备的处理器1601执行上述方法实施例中的动作,其实现原理和技术效果类似,在此不再赘述。可以理解的是,本实施例示意的结构并不构成对电子设备1600的具体限定。在本申请另一些实施例中,电子设备1600可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。In this embodiment of the present application, the above-mentioned memory 1602 is used to store computer-executable program codes, and the program codes include instructions; when the processor 1601 executes the instructions, the instructions cause the processor 1601 of the electronic device to perform the actions in the foregoing method embodiments, which The implementation principle and technical effect are similar, and are not repeated here. It can be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 1600 . In other embodiments of the present application, the electronic device 1600 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传 输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. A 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 the present 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. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center. A computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media. Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.
本文中的术语“多个”是指两个或两个以上。本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系;在公式中,字符“/”,表示前后关联对象是一种“相除”的关系。The term "plurality" as used herein refers to two or more. The term "and/or" in this article is only an association relationship to describe the associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, and A and B exist independently B these three cases. In addition, the character "/" in this article generally indicates that the related objects before and after are an "or" relationship; in the formula, the character "/" indicates that the related objects are a "division" relationship.
可以理解的是,在本申请的实施例中涉及的各种数字编号仅为描述方便进行的区分,并不用来限制本申请的实施例的范围。可以理解的是,在本申请的实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。It can be understood that, the various numbers and numbers involved in the embodiments of the present application are only for the convenience of description, and are not used to limit the scope of the embodiments of the present application. It can be understood that, in the embodiments of the present application, the size of the sequence numbers of the above processes does not imply the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, rather than the implementation of the present application. The implementation of the examples constitutes no limitation.

Claims (14)

  1. 一种滚动条的显示方法,其特征在于,包括:A method for displaying scroll bars, comprising:
    当页面上的滚动条滑动时,在所述页面上显示滑动动画,所述滑动动画的帧数与系统帧率相关,所述滑动动画包括所述页面上的元素的滑动动画,所述页面上的元素包括所述滚动条;When the scroll bar on the page slides, a sliding animation is displayed on the page. The number of frames of the sliding animation is related to the system frame rate. The sliding animation includes the sliding animation of elements on the page. The element includes the scrollbar;
    当所述页面上的滚动条静止时,在所述页面上显示所述滚动条的消失动画,所述滚动条的消失动画的帧数与预设帧率相关,所述预设帧率小于所述系统帧率。When the scroll bar on the page is stationary, the disappearing animation of the scroll bar is displayed on the page, and the number of frames of the disappearing animation of the scroll bar is related to a preset frame rate, and the preset frame rate is smaller than the preset frame rate. the system frame rate.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    检测所述滚动条在所述页面的位置;detecting the position of the scroll bar on the page;
    若所述位置在预设时长内不变,则确定所述页面上的滚动条静止。If the position does not change within the preset time period, it is determined that the scroll bar on the page is stationary.
  3. 根据权利要求1或2所述的方法,其特征在于,所述在所述页面上显示所述滚动条的消失动画之前,还包括:The method according to claim 1 or 2, wherein before displaying the disappearing animation of the scroll bar on the page, the method further comprises:
    采用所述预设帧率绘制所述滚动条的消失动画。The disappearing animation of the scroll bar is drawn using the preset frame rate.
  4. 根据权利要求1或2所述的方法,其特征在于,所述在所述页面上显示所述滚动条的消失动画,包括:The method according to claim 1 or 2, wherein the displaying the disappearing animation of the scroll bar on the page comprises:
    若所述页面上存在动态元素,则在所述页面上显示所述滚动条的消失动画和所述动态元素,所述动态元素的帧数与所述系统帧率相关。If there is a dynamic element on the page, the disappearing animation of the scroll bar and the dynamic element are displayed on the page, and the frame number of the dynamic element is related to the system frame rate.
  5. 根据权利要求4所述的方法,其特征在于,所述在所述页面上显示所述滚动条的消失动画和所述动态元素之前,还包括:The method according to claim 4, wherein before displaying the disappearing animation of the scroll bar and the dynamic element on the page, the method further comprises:
    采用所述预设帧率绘制所述滚动条的消失动画,以及采用所述系统帧率绘制所述动态元素。The disappearing animation of the scroll bar is drawn using the preset frame rate, and the dynamic element is drawn using the system frame rate.
  6. 根据权利要求3或5所述的方法,其特征在于,所述采用所述预设帧率绘制所述滚动条的消失动画,包括:The method according to claim 3 or 5, wherein the step of using the preset frame rate to draw the disappearing animation of the scroll bar comprises:
    根据第一预设亮度变化信息,以及所述滚动条静止时所述滚动条的亮度,采用所述预设帧率绘制所述滚动条的消失动画,所述第一预设亮度变化信息用于指示所述滚动条的消失动画中所述滚动条的亮度。According to the first preset brightness change information and the brightness of the scroll bar when the scroll bar is stationary, the disappearance animation of the scroll bar is drawn using the preset frame rate, and the first preset brightness change information is used for Indicates the brightness of the scroll bar during the disappearing animation of the scroll bar.
  7. 根据权利要求6所述的方法,其特征在于,所述第一预设亮度变化信息为所述滚动条的亮度变化曲线。The method according to claim 6, wherein the first preset brightness change information is a brightness change curve of the scroll bar.
  8. 根据权利要求1或2所述的方法,其特征在于,所述在所述页面上显示所述滚动条的消失动画之前,还包括:The method according to claim 1 or 2, wherein before displaying the disappearing animation of the scroll bar on the page, the method further comprises:
    根据第二预设亮度变化信息,生成所述滚动条的消失动画,所述第二预设亮度变化信息用于指示所述滚动条的消失动画中所述滚动条的预设数量个亮度值,所述预设数量等于所述滚动条的消失动画的帧数。generating a disappearance animation of the scroll bar according to second preset brightness change information, where the second preset brightness change information is used to indicate a preset number of brightness values of the scroll bar in the disappearance animation of the scroll bar, The preset number is equal to the frame number of the disappearing animation of the scroll bar.
  9. 根据权利要求1或2所述的方法,其特征在于,所述在所述页面上显示所述滚动条的消失动画之前,还包括:The method according to claim 1 or 2, wherein before displaying the disappearing animation of the scroll bar on the page, the method further comprises:
    对所述滚动条的预设消失动画进行抽帧处理,得到所述滚动条的消失动画,所述预设消失动画的帧数与所述系统帧率相关。Perform frame extraction processing on the preset disappearing animation of the scroll bar to obtain the disappearing animation of the scroll bar, and the number of frames of the preset disappearing animation is related to the system frame rate.
  10. 根据权利要求1或2所述的方法,其特征在于,所述在所述页面上显示所述滚动条的消失动画之前,还包括:The method according to claim 1 or 2, wherein before displaying the disappearing animation of the scroll bar on the page, the method further comprises:
    当在所述页面上检测到所述滚动条的预设消失动画中的第一帧动画帧时,对所述预设消失动画进行抽帧处理,得到所述滚动条的消失动画,所述预设消失动画的帧数与所述系统帧率相关。When the first animation frame in the preset disappearing animation of the scroll bar is detected on the page, frame extraction processing is performed on the preset disappearing animation to obtain the disappearing animation of the scroll bar, and the preset disappearing animation is obtained. It is assumed that the frame number of the disappearing animation is related to the system frame rate.
  11. 一种滚动条的显示装置,其特征在于,包括:A scroll bar display device, comprising:
    显示模块,用于当页面上的滚动条滑动时,在所述页面上显示滑动动画,所述滑动动画的帧数与系统帧率相关,所述滑动动画包括所述页面上的元素的滑动动画,所述页面上的元素包括所述滚动条;A display module, configured to display a sliding animation on the page when the scroll bar on the page slides, the frame number of the sliding animation is related to the system frame rate, and the sliding animation includes the sliding animation of the elements on the page , the element on the page includes the scroll bar;
    所述显示模块,还用于当所述页面上的滚动条静止时,在所述页面上显示所述滚动条的消失动画,所述滚动条的消失动画的帧数与预设帧率相关,所述预设帧率小于所述系统帧率。The display module is further configured to display the disappearing animation of the scroll bar on the page when the scroll bar on the page is stationary, and the frame number of the disappearing animation of the scroll bar is related to a preset frame rate, The preset frame rate is smaller than the system frame rate.
  12. 一种电子设备,其特征在于,包括:存储器、处理器和显示器;An electronic device, comprising: a memory, a processor and a display;
    所述处理器用于与所述存储器耦合,读取并执行所述存储器中的指令,以实现权利要求1-10中任一项所述的方法;The processor is configured to be coupled with the memory to read and execute instructions in the memory to implement the method of any one of claims 1-10;
    所述显示器,用于显示页面。The display is used for displaying pages.
  13. 一种计算机可读存储介质,其特征在于,所述计算机存储介质存储有计算机指令,当所述计算机指令被计算机执行时,使得所述计算机执行权利要求1-10中任一项所述的方法。A computer-readable storage medium, characterized in that the computer storage medium stores computer instructions, which, when executed by a computer, cause the computer to execute the method according to any one of claims 1-10 .
  14. 一种程序产品,其特征在于,所述程序产品包括计算机程序,所述计算机程序存储在可读存储介质中,通信装置的至少一个处理器可以从所述可读存储介质读取所述计算机程序,所述至少一个处理器执行所述计算机程序使得通信装置实施如权利要求1‐10任意一项所述的方法。A program product, characterized in that the program product comprises a computer program, the computer program is stored in a readable storage medium, and at least one processor of a communication device can read the computer program from the readable storage medium , the at least one processor executing the computer program causes a communication device to implement the method of any one of claims 1-10.
PCT/CN2021/116840 2020-10-20 2021-09-07 Method and apparatus for displaying scroll bar, and electronic device and readable storage medium WO2022083326A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011125617.8 2020-10-20
CN202011125617.8A CN112416231B (en) 2020-10-20 2020-10-20 Scroll bar display method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2022083326A1 true WO2022083326A1 (en) 2022-04-28

Family

ID=74840985

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/116840 WO2022083326A1 (en) 2020-10-20 2021-09-07 Method and apparatus for displaying scroll bar, and electronic device and readable storage medium

Country Status (2)

Country Link
CN (1) CN112416231B (en)
WO (1) WO2022083326A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416231B (en) * 2020-10-20 2022-05-24 华为技术有限公司 Scroll bar display method and device, electronic equipment and readable storage medium
CN113391743B (en) * 2021-04-29 2022-05-20 荣耀终端有限公司 Display method and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104811821A (en) * 2015-04-02 2015-07-29 小米科技有限责任公司 Drawing display frame rate adjusting method and device
US20160139793A1 (en) * 2014-11-13 2016-05-19 Here Global B.V. Method and apparatus for providing a segmented scrollbar
CN106055069A (en) * 2016-05-23 2016-10-26 广东欧珀移动通信有限公司 Power saving control method and apparatus of mobile terminal, and mobile terminal
US20170206000A1 (en) * 2014-08-05 2017-07-20 Snowflake Computing, Inc. Progress scrollbar
CN108519808A (en) * 2018-03-27 2018-09-11 广东欧珀移动通信有限公司 Frame per second method of adjustment, device, terminal device and storage medium
CN110881136A (en) * 2019-11-14 2020-03-13 腾讯科技(深圳)有限公司 Video frame rate control method and device, computer equipment and storage medium
CN112416231A (en) * 2020-10-20 2021-02-26 华为技术有限公司 Scroll bar display method and device, electronic equipment and readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201817232A (en) * 2016-08-11 2018-05-01 聯詠科技股份有限公司 Image processing method and related apparatus
CN110875978A (en) * 2018-08-31 2020-03-10 努比亚技术有限公司 Terminal display control method, terminal and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170206000A1 (en) * 2014-08-05 2017-07-20 Snowflake Computing, Inc. Progress scrollbar
US20160139793A1 (en) * 2014-11-13 2016-05-19 Here Global B.V. Method and apparatus for providing a segmented scrollbar
CN104811821A (en) * 2015-04-02 2015-07-29 小米科技有限责任公司 Drawing display frame rate adjusting method and device
CN106055069A (en) * 2016-05-23 2016-10-26 广东欧珀移动通信有限公司 Power saving control method and apparatus of mobile terminal, and mobile terminal
CN108519808A (en) * 2018-03-27 2018-09-11 广东欧珀移动通信有限公司 Frame per second method of adjustment, device, terminal device and storage medium
CN110881136A (en) * 2019-11-14 2020-03-13 腾讯科技(深圳)有限公司 Video frame rate control method and device, computer equipment and storage medium
CN112416231A (en) * 2020-10-20 2021-02-26 华为技术有限公司 Scroll bar display method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN112416231A (en) 2021-02-26
CN112416231B (en) 2022-05-24

Similar Documents

Publication Publication Date Title
US11100901B2 (en) Method for controlling rendering of layers, terminal, and storage medium
WO2022083326A1 (en) Method and apparatus for displaying scroll bar, and electronic device and readable storage medium
WO2021147657A1 (en) Frame interpolation processing method and related product
CN113225427B (en) Image display method and terminal equipment
US20170220220A1 (en) Advertisement generation apparatus and terminal device
CN110989878B (en) Animation display method and device in applet, electronic equipment and storage medium
US10095371B2 (en) Floating toolbar
US20110145730A1 (en) Utilization of Browser Space
JP2011128204A (en) Advertisement distribution device, method, and program
US9519946B2 (en) Partial tile rendering
CN114648951A (en) Method for controlling dynamic change of screen refresh rate and electronic equipment
WO2018000372A1 (en) Picture display method and terminal
CN108989869B (en) Video picture playing method, device, equipment and computer readable storage medium
WO2021244666A1 (en) Video playing control method and apparatus, and computer device and storage medium
CN107025100A (en) Play method, interface rendering intent and device, the equipment of multi-medium data
WO2023040666A1 (en) Keyboard display method, foldable screen device, and computer-readable storage medium
WO2023001163A1 (en) Screen refreshing method and device capable of improving dynamic effect performance
CN112596843A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
US20190089927A1 (en) Block-based power efficient timing engine for smart display panels
JP2013232225A (en) Content distribution device, content distribution method, content distribution program, and program for terminal
US20190087144A1 (en) Frame-based power efficient timing engine for smart display panels
CN107015726A (en) A kind of multidate information methods of exhibiting and device
CN109800039B (en) User interface display method and device, electronic equipment and storage medium
CN117111799A (en) Data display method and device, storage medium and electronic equipment
CN114237482A (en) Handwriting display processing method, device, system, equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21881745

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21881745

Country of ref document: EP

Kind code of ref document: A1