CN113487707A - Webpage animation processing method and device, electronic equipment and storage medium - Google Patents

Webpage animation processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113487707A
CN113487707A CN202110740612.4A CN202110740612A CN113487707A CN 113487707 A CN113487707 A CN 113487707A CN 202110740612 A CN202110740612 A CN 202110740612A CN 113487707 A CN113487707 A CN 113487707A
Authority
CN
China
Prior art keywords
frequency
objective function
operating frequency
animation
rendering
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110740612.4A
Other languages
Chinese (zh)
Inventor
郭朋飞
郝晶芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110740612.4A priority Critical patent/CN113487707A/en
Publication of CN113487707A publication Critical patent/CN113487707A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present disclosure relates to a web animation processing method, which includes: under the condition that the currently displayed webpage contains the animation, acquiring the current running frequency of an objective function for updating the animation frame; the operation frequency represents the operation times of the objective function in unit time; determining an amount of change in the operating frequency relative to a historical operating frequency of the objective function; the running frequency of the objective function is adjusted according to the variation, dynamic adjustment of the running frequency is achieved, the actual occupation situation of terminal computing resources in the webpage animation playing process can be determined by obtaining the variation of the running frequency, and therefore the display mode of the animation special effect is adjusted in a matching mode, and the accuracy of the running mode adjustment is improved.

Description

Webpage animation processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to animation rendering, and in particular, to a method and an apparatus for processing web animation, an electronic device, and a storage medium.
Background
With the development of client technology, developers can add animation special effects on clients through special effect making software, and the interactivity and the attractiveness of client interfaces are improved. In practical application, when an animation special effect generated by special effect making software runs on a client, a large amount of computing resources of terminal equipment are often occupied, interaction feedback delay is easily caused, and a display is displayed clearly and is unsmooth, so that the use experience of a user is influenced.
In the prior art, in order to ensure stable operation of the client, hardware parameters of the terminal device may be obtained, and a performance level corresponding to the terminal device may be determined according to the hardware parameters, so that an operation mode of an animation special effect on the terminal device may be determined according to the performance level on the premise that an interaction function of the client is normally used.
However, different animation special effects have differences in performance consumption of the terminal device, and the above dynamic effect adjustment mode based on the terminal device performance is too rigid, so that the accuracy of adjusting the special effect operation mode is reduced.
Disclosure of Invention
The disclosure provides a webpage animation processing method, a webpage animation processing device, electronic equipment and a storage medium, and aims to at least solve the problem of low accuracy of adjustment of a special-effect operation mode in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a method for processing web animation, including:
under the condition that the currently displayed webpage contains the animation, acquiring the current running frequency of an objective function for updating the animation frame; the operation frequency represents the operation times of the objective function in unit time;
determining an amount of change in the operating frequency relative to a historical operating frequency of the objective function;
and adjusting the operating frequency of the objective function according to the variable quantity.
In an exemplary embodiment, the adjusting the operating frequency of the objective function according to the variation includes:
if the variation is negative variation and the negative variation reaches a preset first variation threshold, reducing the operating frequency of the objective function; the negative change amount characterizes a decrease in the operating frequency of the objective function relative to a historical operating frequency of the objective function.
In an exemplary embodiment, the adjusting the operating frequency of the objective function according to the variation includes:
if the variable quantity is a forward variable quantity and the forward variable quantity reaches a preset second variable quantity threshold, increasing the operating frequency of the objective function; the forward variation characterizes an increase in an operating frequency of the objective function relative to a historical operating frequency of the objective function.
In an exemplary embodiment, the adjusting the operating frequency of the objective function according to the variation includes:
if the variation is negative variation, acquiring the current rendering frequency of the animation in the webpage; the rendering frequency is the frequency of the browser for rendering the animation frame after the target function is updated;
if the difference value between the rendering frequency and a preset low rendering frequency threshold value is larger than a preset difference value, and the rendering frequency is not larger than a preset high rendering frequency threshold value and not smaller than a preset low rendering frequency threshold value, reducing the operating frequency of the objective function; the low rendering frequency threshold value is the rendering frequency when the animation in the webpage meets the preset minimum fluency, and the high rendering frequency threshold value is the rendering frequency when the animation in the webpage reaches the preset sensible fluency;
and if the difference is not larger than the preset difference, or the rendering frequency is smaller than or equal to the low rendering frequency threshold, suspending the operation of the objective function.
In an exemplary embodiment, the reducing the operating frequency of the objective function includes:
if the adjustment record for increasing the operating frequency of the objective function is determined to exist previously, determining the accumulated increasing times and the accumulated increasing amplitude of the operating frequency of the objective function;
determining the reduction amplitude of the current turn-down according to the accumulated turn-up times and the accumulated turn-up amplitude;
and reducing the operating frequency of the objective function by adopting the reduction amplitude.
In an exemplary embodiment, the reducing the operating frequency of the objective function further includes:
if it is determined that no adjustment record for increasing the operating frequency of the target function exists in the past, acquiring a preset decreasing amplitude, and decreasing the operating frequency of the target function according to the preset decreasing amplitude.
In an exemplary embodiment, before the adjusting up the operating frequency of the objective function, the method further comprises:
acquiring the current rendering frequency of the animation in the webpage;
when the rendering frequency is greater than a preset high rendering frequency threshold value, keeping the current running frequency;
and when the rendering frequency is not greater than the high rendering frequency threshold and not less than a preset low rendering frequency threshold, executing the operation frequency of the objective function to be increased.
In an exemplary embodiment, the increasing the operating frequency of the objective function includes:
if the adjustment record for reducing the running frequency of the objective function is determined to exist previously, determining the cumulative reducing times and the cumulative reducing amplitude of the running frequency of the objective function;
determining the increasing amplitude of the current increase according to the accumulated decrease times and the accumulated decrease amplitude;
and increasing the operating frequency of the objective function by adopting the increasing amplitude.
In an exemplary embodiment, the increasing the operating frequency of the objective function further includes:
if it is determined that no adjustment record for reducing the operating frequency of the objective function exists in the past, acquiring a preset increasing amplitude, and increasing the operating frequency of the objective function according to the preset increasing amplitude.
In an exemplary embodiment, further comprising:
acquiring an initial target function for updating the animation frame, wherein the target function is a built-in function of a browser;
and performing function wrapping on the target function so as to control the operating frequency of the target function through the function wrapping.
In an exemplary embodiment, the obtaining a current operating frequency of an objective function for updating an animation frame includes:
recording the running time of the target function in each running;
and determining the running frequency corresponding to the objective function according to the recently recorded running times and the running times of the objective function in the time range corresponding to the running times.
According to a second aspect of the embodiments of the present disclosure, there is provided a web animation processing apparatus including:
the running frequency obtaining unit is configured to obtain the current running frequency of the target function for updating the animation frame under the condition that the currently displayed webpage contains the animation; the operation frequency represents the operation times of the objective function in unit time;
a variation determining unit configured to determine a variation of the operating frequency with respect to a historical operating frequency of the objective function;
an operating frequency adjusting unit configured to adjust an operating frequency of the objective function according to the variation.
In an exemplary embodiment, the operating frequency adjusting unit includes:
the operation frequency reducing module is configured to reduce the operation frequency of the objective function if the variation is a negative variation and the negative variation reaches a preset first variation threshold; the negative change amount characterizes a decrease in the operating frequency of the objective function relative to a historical operating frequency of the objective function.
In an exemplary embodiment, the operating frequency adjusting unit includes:
the operation frequency increasing module is configured to increase the operation frequency of the target function if the variation is a forward variation and the forward variation reaches a preset second variation threshold; the forward variation characterizes an increase in an operating frequency of the objective function relative to a historical operating frequency of the objective function.
In an exemplary embodiment, the operating frequency adjusting unit includes:
a first rendering frequency obtaining module, configured to obtain a current rendering frequency of the animation in the web page if the variation is a negative variation; the rendering frequency is the frequency of the browser for rendering the animation frame after the target function is updated;
a second reduction module configured to reduce the operating frequency of the objective function if it is determined that a difference between the rendering frequency and a preset low rendering frequency threshold is greater than a preset difference, and the rendering frequency is not greater than a preset high rendering frequency threshold and not less than a preset low rendering frequency threshold; the low rendering frequency threshold value is the rendering frequency when the animation in the webpage meets the preset minimum fluency, and the high rendering frequency threshold value is the rendering frequency when the animation in the webpage reaches the preset sensible fluency;
a pause module configured to pause running the objective function if it is determined that the difference is not greater than the preset difference, or the rendering frequency is less than or equal to the low rendering frequency threshold.
In an exemplary embodiment, the operating frequency reduction module includes:
a cumulative number-of-raises determination module configured to determine a cumulative number of raises and a cumulative magnitude of raises for the operating frequency of the objective function if it is determined that there has been a previous record of raising the operating frequency of the objective function;
the reducing amplitude determining module is configured to determine the reducing amplitude of the current reducing according to the accumulated increasing times and the accumulated increasing amplitude;
a first reduction module configured to reduce an operating frequency of the objective function with the reduction amplitude.
In an exemplary embodiment, the operation frequency lowering module further includes:
and the second reducing module is configured to obtain a preset reducing amplitude and reduce the operating frequency of the target function according to the preset reducing amplitude if the fact that no regulating record for increasing the operating frequency of the target function exists previously is determined.
In an exemplary embodiment, the apparatus further comprises:
the frequency acquisition module is configured to acquire the current rendering frequency of the animation in the webpage;
the operation frequency maintaining module is used for maintaining the current operation frequency when the rendering frequency is greater than a preset high rendering frequency threshold;
a frequency increasing module configured to perform the operation frequency of the target function being increased when the rendering frequency is not greater than the high rendering frequency threshold and not less than a preset low rendering frequency threshold.
In an exemplary embodiment, the operating frequency increasing module includes:
a second rendering frequency obtaining module configured to determine a cumulative number of times of lowering and a cumulative magnitude of lowering for the operating frequency of the objective function if it is determined that there is a previous adjustment record for lowering the operating frequency of the objective function;
the increasing amplitude determining module is configured to determine the increasing amplitude of the current increasing according to the accumulated decreasing times and the accumulated decreasing amplitude;
a first increasing module configured to increase an operating frequency of the objective function with the increase magnitude.
In an exemplary embodiment, the operating frequency increasing module further includes:
and the second increasing module is configured to acquire a preset increasing amplitude and increase the operating frequency of the objective function according to the preset increasing amplitude if it is determined that no adjusting record for reducing the operating frequency of the objective function exists previously.
In an exemplary embodiment, further comprising:
the target function acquisition module is configured to acquire an initial target function for updating the animation frame, wherein the target function is a built-in function of the browser;
a function wrapping module configured to function wrap the objective function to control an operating frequency of the objective function through the function wrapping.
In an exemplary embodiment, the operating frequency obtaining unit includes:
the runtime recording module is configured to record the runtime of each runtime of the target function;
and the running frequency calculation module is configured to determine the running frequency corresponding to the objective function according to a plurality of recently recorded running times and the running times of the objective function in a time range corresponding to the running times.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the web page animation processing method as any one of the above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions of the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the web animation processing method as described in any one of the above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer programs/instructions which, when executed by a processor, implement the web animation processing method of any one of claims 1 to 9.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
under the condition that the currently displayed webpage contains the animation, the current running frequency of the target function for updating the animation frame can be obtained, the variable quantity of the running frequency relative to the historical running frequency of the target function is determined, the running frequency of the target function is adjusted according to the variable quantity, dynamic adjustment of the running frequency is achieved, the actual occupation condition of terminal computing resources in the webpage animation playing process can be determined by obtaining the variable quantity of the running frequency, therefore, the display mode of the animation special effect is adaptively adjusted, and the accuracy of running mode adjustment is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a diagram illustrating an application environment for a method of animation processing of a web page, according to an exemplary embodiment.
FIG. 2 is a flowchart illustrating a method of web animation processing, according to an exemplary embodiment.
FIG. 3 is a flowchart illustrating a method of web animation processing, according to another exemplary embodiment.
FIG. 4 is a flowchart illustrating a method of web page animation processing, according to another exemplary embodiment.
Fig. 5 is a block diagram illustrating a web animation processing apparatus according to an exemplary embodiment.
FIG. 6 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
With the development of client technology, a developer can add animation special effects on a client through special effect making software, the interactivity and the attractiveness of a client interface are improved, and the special effect making software enables the developer to perfectly present the animation special effects designed by a designer on the client through short codes. In practical application, when an animation special effect generated by special effect making software runs on a client, a large amount of computing resources of terminal equipment are often occupied, when the animation special effect runs on the terminal equipment with poor performance, interaction feedback delay is easily caused, a display is displayed slowly, and the use experience of a user is influenced.
In the prior art, in order to ensure stable operation of the client interaction function, hardware parameters of the terminal device may be obtained, and a performance level corresponding to the terminal device may be determined according to the hardware parameters, so that an operation mode of an animation special effect on the terminal device may be determined according to the performance level on the premise that the client interaction function is normally used. For example, operating at best in high-end devices, reducing the dynamic frequency in mid-end devices reduces the computational resource occupancy, and shutting down the dynamic in low-end devices completely frees computational resources.
However, different animation special effects have differences in performance consumption of terminal devices, for example, for a low-performance dynamic effect and an interactive function of the device, the device can normally operate in a low-end computer in practice, and for a usage scenario with a high-performance device, a device slightly higher than a medium-performance standard can normally operate, and a device slightly lower than the medium-performance standard presents performance obstacles. Based on the above, the disclosure provides a webpage animation processing method, so as to at least solve the problem of low accuracy of adjusting a special effect operation mode in the related art.
The webpage animation processing method provided by the disclosure can be applied to the application environment shown in FIG. 1. The terminal 110 may interact with the server 120 through the network to obtain the web page resource, and when the web page resource includes the web page animation, the terminal 110 may render an animation frame and display the animation frame in the terminal interface.
The terminal 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers.
Fig. 2 is a flowchart illustrating a web animation processing method according to an exemplary embodiment, and as shown in fig. 2, the web animation processing method is used in the terminal 110 and may include the following steps.
In step S210, when the currently displayed web page includes an animation, the current operating frequency of the objective function for updating the animation frame is acquired.
As an example, the operating frequency may characterize the number of times the objective function operates per unit time.
The animation included in the web page may be an image formed by playing a plurality of consecutive animation frames, and as an example, the animation may be an animation special effect, such as an animation related to the device interaction function, and the animation special effect may be an animation for showing the data processing progress and prompting the user to perform a specified operation. In addition, the animation can also be web animation, such as continuously played pictures in web video; the animation background may be in a web page, for example, when a user can browse a plurality of web pages by sliding up and down, the animation background may be in each web page.
In the present disclosure, the terminal 110 may interact with the server 120 and obtain web page resources, and display a related web page in a display interface. In the process of displaying the webpage, under the condition that the currently displayed webpage contains the animation, the current running frequency of the objective function for updating the animation frame can be obtained.
Specifically, when the web page resources include web page animation resources, such as animation special effect resources associated with the interactive function, the terminal may run the objective function, and update animation frames in combination with the acquired web page animation resources, so as to realize playing of the web page animation. When the animation is displayed, the terminal 110 may count the operation condition of the objective function to obtain the current operation frequency of the objective function.
It should be noted that, the case where the web page contains the animation may be any time period during the playing of the animation. The terminal 110 may obtain the current operating frequency of the objective function from any one or more times in the animation playing process, for example, the operating frequency may be obtained at a preset time interval in the whole process from the animation starting playing to the animation ending playing; for another example, for a playing process from the beginning to the end of playing the animation, the terminal 110 may obtain the operating frequency of the objective function at any time interval or a plurality of continuous or discontinuous time intervals in the playing process.
In step S220, the amount of change in the operating frequency from the historical operating frequency of the objective function is determined.
As an example, the historical operating frequency may be a recorded operating frequency of the objective function, which may be a recorded operating frequency in a recent time range, such as a last recorded operating frequency, or may also be a frequency value obtained by processing a plurality of recorded operating frequencies in a preset time range, such as an average value, a median, and the like.
In practical application, the web browser may render animation frames according to a preset time interval, and under the condition that the computing resources are sufficient, the terminal 110 may update the current animation frame through the objective function before the web browser renders the animation frame next time, so that the web browser may render the updated animation frame, and the animation effect is achieved by continuously cycling. However, since updating the animation frame through the objective function occupies a certain amount of computing resources, when the computing amount is large, and the time consumed for updating the animation frame is long, it is difficult to complete updating of the animation frame before the next rendering of the browser, so that the browser repeatedly renders the original animation frame, and a phenomenon of "frame dropping" is formed.
When the phenomenon of "frame dropping" occurs, it can be determined that there is a resource shortage condition when the terminal 110 is showing the animation in the webpage. In this case, a reasonable resource allocation manner may be to allocate the computing resource to the primary task of the terminal 110 first, and if the display of the web animation belongs to the secondary task, the resource preemption is easily caused by continuously updating and rendering animation frames, for example, when the animation in the web is animation related to the device interaction function, such as animation special effects related to a button clicked by a user and a moving screen, the animation is not a main display object, and if the animation special effects are continuously rendered, the computing resource preemption is formed, so that interaction feedback delay is caused.
In the present disclosure, the usage of the computing resources in the terminal 110 may be determined by the amount of change in the operating frequency of the objective function. Specifically, after acquiring the current operating frequency of the objective function, the terminal 110 may compare the operating frequency with the historical operating frequency of the objective function, thereby obtaining a variation of the current operating frequency of the objective function with respect to the historical operating frequency.
In a specific implementation, if the terminal 110 first obtains the current operating frequency of the objective function, the historical operating frequency used for comparison may be a preset value used for initialization. In the process of collecting the operating frequency, the terminal 110 may store the acquired operating frequency as a historical operating frequency, and then may obtain a variation based on the stored historical frequency after acquiring the current operating frequency of the objective function next time.
In step S230, the operating frequency of the objective function is adjusted according to the variation.
In the present disclosure, after the variation is obtained, the operating frequency of the objective function may be adjusted according to the variation. Specifically, whether the current operating frequency of the objective function changes relative to the historical operating frequency and the corresponding change degree when the current operating frequency of the objective function changes can be determined according to the change amount, and then the operating frequency of the objective function can be adjusted according to whether the current operating frequency of the objective function changes and the change degree. Specifically, if it is determined that the operating frequency of the objective function is decreased according to the variation, it may be determined that the terminal 110 currently has insufficient computing resources, and the operating frequency of the objective function may be adjusted in a manner that the computing resources can be released, for example, the operating frequency of the objective function is decreased, so that the computing resources may be allocated to the main task to be processed by the terminal 110. If the running frequency of the objective function is determined to be increased according to the variation, it can be determined that the computing resources are sufficient, and at this time, the running frequency of the objective function can be adjusted by fully utilizing the computing resources, for example, the running frequency of the objective function is increased, so that the smoothness of animation display can be improved in time.
In the above-mentioned web animation processing method, the terminal 110 may obtain the current operating frequency of the objective function for updating the animation frame when the currently displayed web page includes the animation, determine the variation of the operating frequency relative to the historical operating frequency of the objective function, adjust the operating frequency of the objective function according to the variation, implement the dynamic adjustment of the operating frequency, and by obtaining the variation of the operating frequency, may determine the actual occupation of the computing resource of the terminal 110 in the playing process of the web animation, thereby the display mode of the animation special effect is adapted and adjusted, and the accuracy of the adjustment of the operating mode is improved.
In an exemplary embodiment, in step S230, adjusting the operating frequency of the objective function according to the variation may include:
and if the variation is negative variation and the negative variation reaches a preset first variation threshold, reducing the operating frequency of the objective function.
As an example, a negative change may characterize a decrease in the operating frequency of the objective function relative to a historical operating frequency of the objective function.
In practical applications, after the current operating frequency of the objective function is obtained, the variation of the operating frequency may be compared with the historical operating frequency. Specifically, a difference between the operating frequency and the historical operating frequency may be obtained, and if the difference is smaller than zero, it may be determined that the operating frequency of the objective function is reduced relative to the historical operating frequency of the objective function, and the change amount is a negative change amount.
When the variation is a negative variation and the negative variation reaches a preset first variation threshold, it may be determined that the current computing resource of the terminal 110 is insufficient, which may cause the operating frequency of the objective function to decrease, and accordingly, the operating frequency of the objective function may be decreased.
For example, in the case of a shortage of CPU computing resources, if a negative change is detected and the negative change reaches the first change threshold, the operating frequency of the objective function may be reduced, and a part of the computing resources may be released, so that the CPU may be prevented from being in a high-order operation state for a long time, and performance degradation caused by power consumption and heat generation of the terminal 110 may be reduced. For another example, a webpage with extremely simple animation special effect and interaction function can be judged to normally run on a low-end machine by adopting the scheme disclosed by the invention. According to the scheme disclosed by the invention, excellent animation processing effects can be obtained for different animation special effects.
In the disclosure, if the variation is a negative variation and the negative variation reaches a preset first variation threshold, the operation frequency of the objective function may be reduced, and by reducing the operation frequency of the number of targets, part of the computing resources of the terminal 110 may be released, thereby avoiding preemption of the computing resources, and preferentially ensuring that the user interaction behavior in the web page can be responded in time.
In an exemplary embodiment, in step S230, adjusting the operating frequency of the objective function according to the variation may further include:
and if the variable quantity is a forward variable quantity and the forward variable quantity reaches a preset second variable quantity threshold value, increasing the operating frequency of the objective function.
Wherein the forward variation may be indicative of an increase in the operating frequency of the objective function relative to a historical operating frequency of the objective function.
In a specific implementation, a difference between the operating frequency and the historical operating frequency may be obtained, and if the difference is greater than or equal to zero, it may be determined that the operating frequency of the objective function is increased relative to the historical operating frequency of the objective function, where the change is a forward change.
When the variation is a forward variation and the forward variation reaches a preset second variation threshold, it may be determined that the current computing resource of the terminal 110 is sufficient, so that the objective function may be operated more in unit time, and the operating frequency of the objective function is increased.
In the present disclosure, if the variation is a forward variation and the forward variation reaches a preset second variation threshold, the operation frequency of the objective function is increased, so that the animation display effect can be optimized in a fine-grained manner under the condition that the computing resources of the terminal 110 are sufficient, and the animation operation mode is prevented from being determined vividly.
In an exemplary embodiment, as shown in fig. 3, in step S230, adjusting the operating frequency of the objective function according to the variation may include:
in step S231, if the variation is a negative variation, a current rendering frequency of the animation in the web page is obtained.
The rendering frequency may be a frequency at which the browser renders the animation frame after the objective function is updated. Specifically, the frequency of rendering the animation frames by the browser may be preset, but since the time consumed for updating the animation frames by the objective function is not fixed, and the rendering frequency is the frequency of rendering the updated animation frames by the browser, the rendering frequency of the browser may be positively correlated with the operating frequency of the objective function.
In a specific implementation, after the variation of the operating frequency of the objective function is obtained, if the variation is a negative variation, the terminal 110 may obtain a current rendering frequency of the animation in the web page, and determine a specific manner of adjusting the operating frequency by combining the rendering frequency.
In step S232, if it is determined that the difference between the rendering frequency and the preset low rendering frequency threshold is greater than the preset difference, and the rendering frequency is not greater than the preset high rendering frequency threshold and not less than the preset low rendering frequency threshold, the operating frequency of the objective function is reduced.
The low rendering frequency threshold may be a rendering frequency when the animation in the web page meets a preset minimum fluency, such as 30FPS (Frames Per Second), for an animation with a rendering frequency below 30FPS, a user may feel obvious stutter, and for an animation with a rendering frequency between 30FPS and 50FPS, fluency perceivable by the user varies from person to person due to different user sensitivity degrees. The high rendering frequency threshold may be a rendering frequency of the animation in the webpage when the animation reaches a preset perceivable fluency, such as 50 FPS.
In practical application, after the current rendering frequency of the animation in the webpage is obtained, a difference value between the rendering frequency and a preset low rendering frequency threshold value can be obtained, and the rendering frequency is compared with a preset high rendering frequency threshold value and a preset low rendering frequency threshold value.
If the difference is larger than the preset difference, and the rendering frequency is not larger than the high rendering frequency threshold and not smaller than the low rendering frequency threshold, it is determined that the current rendering frequency is larger than the rendering frequency corresponding to the lowest fluency, a larger difference exists between the current rendering frequency and the rendering frequency, a down-regulation space exists in the current rendering frequency, at the moment, the operating frequency of the objective function can be reduced, and computing resources are released by reducing the operating frequency of the objective function. If it is determined that the rendering frequency is greater than the high rendering frequency threshold, the operating frequency of the objective function may not be adjusted for the moment because the animation is still smooth.
Specifically, when the operating frequency is reduced, the operating frequency can be reduced within a preset frequency range, the operating frequency is prevented from being directly adjusted to 0, the reducing amplitude of the operating frequency can be reduced at a preset amplitude threshold value, and the phenomenon that the rendering frequency variation is too large to form an obvious image is avoided.
In step S233, if it is determined that the difference is not greater than the preset difference, or the rendering frequency is less than or equal to the low rendering frequency threshold, the target function is suspended.
If the difference is not greater than the preset difference, it may be determined that the rendering frequency is greater than the low rendering frequency threshold, but the difference between the two is not large, and at this time, if the down-adjustment is continued, the calculation resources that may be released are limited, and therefore, when the difference is less than or equal to the preset difference, the running of the objective function may be suspended.
Or, if it is determined that the rendering frequency is less than or equal to the low rendering frequency threshold, the animation is already in a stuck state, and if the running frequency is continuously adjusted downward, the sticking of the animation is more obvious, so that the running frequency can be adjusted downward to 0, and the running of the objective function is suspended.
In this disclosure, the terminal 110 may obtain a current rendering frequency of an animation in the web page, if it is determined that a difference between the rendering frequency and a preset low rendering frequency threshold is greater than a preset difference, and the rendering frequency is not greater than a preset high rendering frequency threshold and not less than a preset low rendering frequency threshold, the step of reducing the operating frequency of the objective function may be performed, if it is determined that the difference is not greater than the preset difference, or the rendering frequency is not greater than the low rendering frequency threshold, the operation of the objective function is suspended, the operating frequency may be reduced to avoid resource preemption while the animation is still being played normally, and when the animation appears in an obvious pause, the computing resource for updating and rendering the animation may be released, and other computing tasks, such as tasks related to the interactive function, assigned to the terminal 110 may be released.
In an exemplary embodiment, as shown in fig. 4, the reducing the operating frequency of the objective function may include:
in step S2311, if it is determined that there is a previous adjustment record for increasing the operating frequency of the objective function, a cumulative number of increases and a cumulative increase amplitude for the operating frequency of the objective function are determined.
As an example, the accumulated number of times of increasing may be the number of times of increasing the operation frequency of the objective function by the terminal 110 within a time range; the accumulated increasing amplitude may be an amplitude value at which the operating frequency corresponding to the accumulated increasing times is increased within the time range.
In a specific implementation, if the variation is a negative variation, the terminal 110 may determine whether there is a corresponding adjustment record for increasing the operating frequency of the objective function in the animation. If it is determined that there is an adjustment record to increase the operating frequency of the objective function, the operating frequency of the objective function may be decreased based on the adjustment record. Specifically, the terminal 110 may determine the cumulative increase number and the cumulative increase amplitude for the operating frequency of the objective function within the time range.
In step S2312, the decreasing amplitude of the current decrease is determined according to the accumulated increase times and the accumulated increase amplitude.
After the cumulative increasing times and the cumulative increasing amplitude are determined, the decreasing amplitude of the current decreasing can be determined based on the cumulative increasing times and the cumulative increasing amplitude.
In practical application, a time range corresponding to the accumulated increasing times can be determined, and the increasing frequency of the objective function is determined according to the accumulated increasing times and the time range. If the heightening frequency is smaller than the threshold value and the accumulated heightening amplitude is smaller than the preset heightening amplitude threshold value, the heightening of the target function in the past can be determined to be an accidental event, the lowering amplitude of the current heightening is further determined based on the accumulated heightening amplitude, and the running frequency of the target function is recovered.
Specifically, the operation frequency may be turned down for multiple times, for example, when the operation frequency is turned down for the first time, the reduction range may be obtained based on the preset ratio and the cumulative increase range, for example, 50% of the cumulative increase range is turned down, if the calculation resource is still insufficient within the preset time, the operation frequency may be turned down again, and the reduction range of the multiple times of turning down may be equal to the cumulative increase range. Alternatively, the operating frequency may be restored to the operating frequency before the increase at a time, i.e., the decrease amplitude may be equal to the cumulative increase amplitude.
In one example, the magnitude of the reduction may also be determined in conjunction with the amount of change in the rendering frequency when determining the magnitude of the reduction. Specifically, the variation of the rendering frequency may be inversely related to the fluency of the animation, that is, the larger the variation of the rendering frequency is, the more obvious the jerkiness of the animation is, and the lower the fluency is, and conversely, the smaller the variation of the rendering frequency is, the higher the fluency of the animation is. And different reduction amplitudes may correspond to different rendering frequency variations. Based on this, an amplitude threshold value may be set in advance, and the reduction amplitude is determined in conjunction with the amplitude threshold value.
In step S2313, the operating frequency of the objective function is adjusted to be lower using the reduction amplitude.
After the reduction amplitude of the current reduction is determined, the reduction amplitude can be adopted for adjustment, and the operating frequency of the objective function is reduced.
In the disclosure, when the operation frequency of the target function is reduced, if it is determined that the adjustment record for increasing the operation frequency of the target function exists previously, the terminal 110 may determine the cumulative increasing number and the cumulative increasing amplitude of the operation frequency of the target function, determine the decreasing amplitude of the current reducing according to the cumulative increasing number and the cumulative increasing amplitude, and decrease the operation frequency of the target function with the decreasing amplitude, so that the increased operation frequency can be adjusted back and the calculation resource can be released when the calculation resource is insufficient based on the actual operation condition of the web animation at the terminal 110.
In an exemplary embodiment, the reducing the operating frequency of the objective function may further include:
if it is determined that no adjustment record for increasing the operating frequency of the target function exists in the past, acquiring a preset decreasing amplitude, and decreasing the operating frequency of the target function according to the preset decreasing amplitude.
In a specific implementation, the reduction amplitude of the operating frequency may be preset, that is, the reduction amplitude is preset. If it is determined that there is no adjustment record for increasing the operating frequency of the objective function, the terminal 110 may obtain a preset reduction amplitude as the current reduction amplitude, and decrease the operating frequency of the objective function according to the preset reduction amplitude.
In this disclosure, when the operation frequency of the objective function is adjusted to be lower, the terminal 110 may obtain the preset adjustment range when it is determined that there is no adjustment record for increasing the operation frequency of the objective function in the past, and adjust the operation frequency of the objective function according to the preset adjustment range to be lower, so that not only the calculation resource can be released in time, but also the phenomenon that the reduction range is too large, which causes the rendering frequency to change obviously, and forms an obvious picture is blocked is avoided.
In an exemplary embodiment, before the increasing the operating frequency of the objective function, the method may further include:
acquiring the current rendering frequency of the animation in the webpage; when the rendering frequency is greater than a preset high rendering frequency threshold value, keeping the current running frequency; and when the rendering frequency is not greater than the high rendering frequency threshold and not less than a preset low rendering frequency threshold, executing the operation frequency of the objective function to be increased.
As an example, the high rendering frequency threshold may be a rendering frequency at which animations in a web page reach a preset, perceptible fluency, such as 50 FPS.
In specific implementation, under the preset sensible fluency, a user can obviously feel the fluency of the animation, and within the range of the rendering frequency corresponding to the preset sensible fluency and the rendering frequency corresponding to the highest sensible fluency, the fluency of the animation is high, so that the user feels comfortable, for example, within the range of 50-60 FPS. When the rendering frequency reaches the rendering frequency corresponding to the highest perceivable fluency, such as 60FPS, even if the operating frequency is increased again, the user is difficult to perceive the increase of fluency. Based on this, when the forward variation reaches the preset second variation threshold, the terminal 110 may obtain the current rendering frequency of the animation in the webpage, and determine the specific mode of reducing the operating frequency by combining the rendering frequency.
Specifically, after obtaining the rendering frequency of the current animation in the webpage, the rendering frequency may be compared with a preset high rendering frequency threshold. When the rendering frequency is greater than the preset high rendering frequency threshold, if the rendering frequency is greater than the high rendering frequency threshold and less than the rendering frequency corresponding to the highest perceivable fluency, the user can keep the current running frequency because the user has perceived the current animation to be fluent. If the rendering frequency is greater than the rendering frequency corresponding to the highest perceivable fluency, the user is difficult to perceive the change of the fluency even if the operation frequency is continuously increased, and the visual benefit brought by the increase of the operation frequency is reduced.
When the rendering frequency is not greater than the high rendering frequency threshold and not less than the preset low rendering frequency threshold, a user cannot obviously perceive the fluency of the current animation, and it can be determined that the fluency of the animation has a promotion space, for example, the rendering frequency is within a range of 30-0 FPS, and the fluency perceived by the user has a difference, so that the operating frequency of the objective function can be increased when the rendering frequency is not greater than the high rendering frequency threshold and not less than the low rendering frequency threshold.
In the disclosure, the terminal 110 may obtain a current rendering frequency of an animation in a webpage, and when the rendering frequency is greater than a preset high rendering frequency threshold, maintain the current operating frequency, and when the rendering frequency is not greater than the high rendering frequency threshold and not less than a low rendering frequency threshold, execute a step of determining whether an adjustment record of adjusting the operating frequency of the objective function down exists before, and may determine an adjustment manner of the operating frequency according to an actual operating condition of the animation, thereby avoiding an increase of an invalid operating frequency when the rendering frequency is higher, and saving computing resources.
In an exemplary embodiment, the increasing the operating frequency of the objective function may include:
if the adjustment record for reducing the running frequency of the objective function is determined to exist previously, determining the cumulative reducing times and the cumulative reducing amplitude of the running frequency of the objective function; determining the increasing amplitude of the current increase according to the accumulated decrease times and the accumulated decrease amplitude; and increasing the operating frequency of the objective function by adopting the increasing amplitude.
As an example, the cumulative turn-down number may be the number of times the terminal 110 turns down the operating frequency of the objective function within a time range; the cumulative reduction amplitude may be an amplitude value at which the operating frequency corresponding to the cumulative reduction number is reduced in the time range.
In practical applications, if the variation is a forward variation and the forward variation reaches the second variation threshold, the terminal 110 may determine whether there is a corresponding adjustment record for decreasing the operating frequency of the objective function in the animation. If it is determined that there is an adjustment record to turn down the operating frequency of the objective function, the operating frequency of the objective function may be turned up based on the historical adjustment record.
Specifically, the terminal 110 may determine the cumulative turn-down times and the cumulative turn-down amplitude for the operating frequency of the objective function within the time range. After determining the cumulative down number and the cumulative down amplitude, the increasing amplitude of the current up may be determined based on the cumulative down number and the cumulative down amplitude. In a specific implementation, a time range corresponding to the cumulative turn-down number may be determined, and the turn-down frequency of the objective function may be determined according to the cumulative turn-down number and the time range. If the lowering frequency is smaller than the threshold value and the accumulated lowering amplitude is smaller than the preset lowering amplitude threshold value, the lowering of the target function in the past can be determined as an accidental event, the increasing amplitude of the current raising is further determined based on the accumulated lowering amplitude, and the running frequency of the target function is recovered.
Specifically, the operating frequency may be increased for multiple times, for example, when the operating frequency is increased for the first time, the increase amplitude may be obtained based on the preset ratio and the cumulative decrease amplitude, for example, the increase amplitude is increased by 50% of the cumulative decrease amplitude, and if the computing resources are sufficient within the preset time, the operating frequency may be increased again, and the increase amplitude of the multiple times of increase may be equal to the cumulative decrease amplitude. Alternatively, the operating frequency may be restored to the operating frequency before the adjustment down at a time, i.e., the increase amplitude may be equal to the cumulative adjustment down amplitude. In one example, the magnitude of the increase may also be determined in conjunction with the amount of change in rendering frequency when determining the magnitude of the increase.
After the increase amplitude of the current increase is determined, the increase amplitude can be adopted for adjustment, and the operating frequency of the objective function is increased.
In the disclosure, when the terminal 110 increases the operating frequency of the objective function, if it is determined that the adjustment record for decreasing the operating frequency of the objective function exists previously, the cumulative decreasing number and the cumulative decreasing amplitude of the operating frequency of the objective function may be determined, the increasing amplitude of the current increasing is determined according to the cumulative decreasing number and the cumulative decreasing amplitude, and the operating frequency of the objective function is increased by using the increasing amplitude, so that the decreased operating frequency can be adjusted back when the computing resource is sufficient, the computing resource is fully utilized, and the animation effect is optimized based on the actual operating condition of the web animation at the terminal 110.
In an exemplary embodiment, the increasing the operating frequency of the objective function may further include:
if it is determined that no adjustment record for reducing the operating frequency of the objective function exists in the past, acquiring a preset increasing amplitude, and increasing the operating frequency of the objective function according to the preset increasing amplitude.
In practical applications, the increase amplitude of the operating frequency may be preset, that is, the preset increase amplitude. If it is determined that there is no adjustment record for lowering the operating frequency of the objective function, the terminal 110 may obtain a preset increase amplitude, and raise the operating frequency of the objective function according to the preset increase amplitude.
In the disclosure, when the operation frequency of the objective function is increased, if it is determined that there is no adjustment record for reducing the operation frequency of the objective function in the past, the preset increase amplitude may be obtained, and the operation frequency of the objective function is increased according to the preset increase amplitude, so that the currently idle computing resources can be fully utilized to perform animation display, and a sudden increase in the occupancy of the computing resources can be avoided.
In an exemplary embodiment, the method may further include:
acquiring an initial target function for updating the animation frame; and performing function wrapping on the target function so as to control the operating frequency of the target function through the function wrapping.
As an example, the target function may be a built-in function of a browser, for example, when the animation in the web page is Javascript animation, the solution of the present disclosure may be implemented by native Javascript programming language, and accordingly, the target function may be a built-in function requestAnimationFrame.
In a specific implementation, the terminal 110 may obtain an initial objective function for updating the animation frame, and after obtaining the objective function, may perform function packing on the objective function, and further may control the operating frequency of the objective function through the function packing when the operating frequency needs to be adjusted.
In the present disclosure, the terminal 110 may perform function packing on the objective function, and control the operating frequency of the objective function through the function packing, so as to provide a basis for dynamic adjustment of the animation operating mode.
In an exemplary embodiment, in step S210, obtaining the current operating frequency of the objective function for updating the animation frame may include the following steps:
recording the running time of the target function in each running; and determining the running frequency corresponding to the objective function according to the recently recorded running times and the running times of the objective function in the time range corresponding to the running times.
As an example, the runtime may be the time at which the objective function starts to run each time it runs. The time range corresponding to the running time may be the time taken for the objective function to run once and complete the update of the animation frame. The terminal 110 continuously updates the animation frame by continuously running the objective function, thereby forming an animation.
In a scheme for determining an animation running mode, a Web container in a native client needs to be relied on to obtain device hardware parameters, and animation special effect running is determined based on the hardware parameters. The Web container can be understood as a browser of the content of the native client, the Web container can call a data processing function provided by the native client, such as obtaining device hardware information, positioning information, making a call, and the like, and the data processing function of the native client can be indirectly called by calling the Web container in the native client in a traditional mode, so that the hardware parameter is obtained.
While in the disclosure, the terminal 110 may record the run time of each run of the objective function. Within the preset time, a plurality of recently recorded running times can be obtained, and the time range corresponding to each running time is determined. And further, the operation frequency of the objective function can be determined according to a plurality of operation times which are recorded recently and the operation times of the objective function in a time range corresponding to the operation times. Specifically, the time ranges corresponding to the respective operation times may be summed, the sum of the time ranges may be determined, the operation times of the objective function may be determined according to the number of recorded operation times, and the operation frequency may be determined according to the sum of the operation times and the time ranges.
In the method, the running time of each running of the target function can be recorded, the running frequency corresponding to the target function is determined according to a plurality of recently recorded running times and the running times of the target function in the time range corresponding to the running times, the running frequency of the target function for updating the animation frame can be directly obtained in the animation playing process, the animation running adjusting mode is determined based on the running frequency, dependence on a Web container in a native client is eliminated, no special environment dependence exists, and the method can be applied to any browser; meanwhile, the calculation process is simple, the operation burden is extremely low, and the calculation resources are saved.
It should be understood that although the various steps in the flow charts of fig. 2-4 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-4 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
FIG. 5 is a block diagram illustrating a web animation processing device according to an example embodiment. Referring to fig. 5, the apparatus includes an operating frequency acquiring unit 501, a variation determining unit 502, and an operating frequency adjusting unit 503.
The running frequency obtaining unit is configured to obtain the current running frequency of the target function for updating the animation frame under the condition that the currently displayed webpage contains the animation; the operation frequency represents the operation times of the objective function in unit time;
a variation determining unit configured to determine a variation of the operating frequency with respect to a historical operating frequency of the objective function;
an operating frequency adjusting unit configured to adjust an operating frequency of the objective function according to the variation.
In an exemplary embodiment, the operating frequency adjusting unit includes:
the operation frequency reducing module is configured to reduce the operation frequency of the objective function if the variation is a negative variation and the negative variation reaches a preset first variation threshold; the negative change amount characterizes a decrease in the operating frequency of the objective function relative to a historical operating frequency of the objective function.
In an exemplary embodiment, the operating frequency adjusting unit includes:
the operation frequency increasing module is configured to increase the operation frequency of the target function if the variation is a forward variation and the forward variation reaches a preset second variation threshold; the forward variation characterizes an increase in an operating frequency of the objective function relative to a historical operating frequency of the objective function.
In an exemplary embodiment, the operating frequency adjusting unit includes:
a first rendering frequency obtaining module, configured to obtain a current rendering frequency of the animation in the web page if the variation is a negative variation; the rendering frequency is the frequency of the browser for rendering the animation frame after the target function is updated;
a second reduction module configured to reduce the operating frequency of the objective function if it is determined that a difference between the rendering frequency and a preset low rendering frequency threshold is greater than a preset difference, and the rendering frequency is not greater than a preset high rendering frequency threshold and not less than a preset low rendering frequency threshold; the low rendering frequency threshold value is the rendering frequency when the animation in the webpage meets the preset minimum fluency, and the high rendering frequency threshold value is the rendering frequency when the animation in the webpage reaches the preset sensible fluency;
a pause module configured to pause running the objective function if it is determined that the difference is not greater than the preset difference, or the rendering frequency is less than or equal to the low rendering frequency threshold.
In an exemplary embodiment, the operating frequency reduction module includes:
a cumulative number-of-raises determination module configured to determine a cumulative number of raises and a cumulative magnitude of raises for the operating frequency of the objective function if it is determined that there has been a previous record of raising the operating frequency of the objective function;
the reducing amplitude determining module is configured to determine the reducing amplitude of the current reducing according to the accumulated increasing times and the accumulated increasing amplitude;
a first reduction module configured to reduce an operating frequency of the objective function with the reduction amplitude.
In an exemplary embodiment, the operation frequency lowering module further includes:
and the second reducing module is configured to obtain a preset reducing amplitude and reduce the operating frequency of the target function according to the preset reducing amplitude if the fact that no regulating record for increasing the operating frequency of the target function exists previously is determined.
In an exemplary embodiment, the apparatus further comprises:
the frequency acquisition module is configured to acquire the current rendering frequency of the animation in the webpage;
the operation frequency maintaining module is used for maintaining the current operation frequency when the rendering frequency is greater than a preset high rendering frequency threshold;
a frequency increasing module configured to perform the operation frequency of the target function being increased when the rendering frequency is not greater than the high rendering frequency threshold and not less than a preset low rendering frequency threshold.
In an exemplary embodiment, the operating frequency increasing module includes:
a second rendering frequency obtaining module configured to determine a cumulative number of times of lowering and a cumulative magnitude of lowering for the operating frequency of the objective function if it is determined that there is a previous adjustment record for lowering the operating frequency of the objective function;
the increasing amplitude determining module is configured to determine the increasing amplitude of the current increasing according to the accumulated decreasing times and the accumulated decreasing amplitude;
a first increasing module configured to increase an operating frequency of the objective function with the increase magnitude.
In an exemplary embodiment, the operating frequency increasing module further includes:
and the second increasing module is configured to acquire a preset increasing amplitude and increase the operating frequency of the objective function according to the preset increasing amplitude if it is determined that no adjusting record for reducing the operating frequency of the objective function exists previously.
In an exemplary embodiment, further comprising:
the target function acquisition module is configured to acquire an initial target function for updating the animation frame, wherein the target function is a built-in function of the browser;
a function wrapping module configured to function wrap the objective function to control an operating frequency of the objective function through the function wrapping.
In an exemplary embodiment, the operating frequency obtaining unit includes:
the runtime recording module is configured to record the runtime of each runtime of the target function;
and the running frequency calculation module is configured to determine the running frequency corresponding to the objective function according to a plurality of recently recorded running times and the running times of the objective function in a time range corresponding to the running times.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 6 is a block diagram illustrating an apparatus 600 for running a web animation processing method according to an example embodiment. For example, the device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a gaming console, a tablet device, a medical device, an exercise device, a personal digital assistant, and so forth.
Referring to fig. 6, device 600 may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, interface to input/output (I/O) 612, sensor component 614, and communication component 616.
The processing component 602 generally controls the overall operation of the device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operation at the device 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile storage devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
A power supply component 606 provides power to the various components of the device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 600.
The multimedia component 608 includes a screen that provides an output interface between the device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 600 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a Microphone (MIC) configured to receive external audio signals when the device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the device 600. For example, the sensor component 614 may detect an open/closed state of the device 600, the relative positioning of components, such as a display and keypad of the device 600, the sensor component 614 may also detect a change in the position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, orientation or acceleration/deceleration of the device 600, and a change in the temperature of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the device 600 and other devices in a wired or wireless manner. The device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the device 600 to perform the above-described method is also provided. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising computer programs/instructions which, when executed by a processor, implement the above-described method.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A webpage animation processing method is characterized by comprising the following steps:
under the condition that the currently displayed webpage contains the animation, acquiring the current running frequency of an objective function for updating the animation frame; the operation frequency represents the operation times of the objective function in unit time;
determining an amount of change in the operating frequency relative to a historical operating frequency of the objective function;
and adjusting the operating frequency of the objective function according to the variable quantity.
2. The method of claim 1, wherein said adjusting the operating frequency of the objective function according to the variance comprises:
if the variation is negative variation and the negative variation reaches a preset first variation threshold, reducing the operating frequency of the objective function; the negative change amount characterizes a decrease in the operating frequency of the objective function relative to a historical operating frequency of the objective function.
3. The method of claim 1, wherein said adjusting the operating frequency of the objective function according to the variance comprises:
if the variable quantity is a forward variable quantity and the forward variable quantity reaches a preset second variable quantity threshold, increasing the operating frequency of the objective function; the forward variation characterizes an increase in an operating frequency of the objective function relative to a historical operating frequency of the objective function.
4. The method of claim 1, wherein said adjusting the operating frequency of the objective function according to the variance comprises:
if the variation is negative variation, acquiring the current rendering frequency of the animation in the webpage; the rendering frequency is the frequency of the browser for rendering the animation frame after the target function is updated;
if the difference value between the rendering frequency and a preset low rendering frequency threshold value is larger than a preset difference value, and the rendering frequency is not larger than a preset high rendering frequency threshold value and not smaller than a preset low rendering frequency threshold value, reducing the operating frequency of the objective function; the low rendering frequency threshold value is the rendering frequency when the animation in the webpage meets the preset minimum fluency, and the high rendering frequency threshold value is the rendering frequency when the animation in the webpage reaches the preset sensible fluency;
and if the difference is not larger than the preset difference, or the rendering frequency is smaller than or equal to the low rendering frequency threshold, suspending the operation of the objective function.
5. The method of claim 2 or 4, wherein the tuning down the operating frequency of the objective function comprises:
if the adjustment record for increasing the operating frequency of the objective function is determined to exist previously, determining the accumulated increasing times and the accumulated increasing amplitude of the operating frequency of the objective function;
determining the reduction amplitude of the current turn-down according to the accumulated turn-up times and the accumulated turn-up amplitude;
and reducing the operating frequency of the objective function by adopting the reduction amplitude.
6. The method of claim 3, wherein prior to said adjusting up the operating frequency of the objective function, the method further comprises:
acquiring the current rendering frequency of the animation in the webpage;
when the rendering frequency is greater than a preset high rendering frequency threshold value, keeping the current running frequency;
and when the rendering frequency is not greater than the high rendering frequency threshold and not less than a preset low rendering frequency threshold, executing the operation frequency of the objective function to be increased.
7. A web animation processing apparatus, comprising:
the running frequency obtaining unit is configured to obtain the current running frequency of the target function for updating the animation frame under the condition that the currently displayed webpage contains the animation; the operation frequency represents the operation times of the objective function in unit time;
a variation determining unit configured to determine a variation of the operating frequency with respect to a historical operating frequency of the objective function;
an operating frequency adjusting unit configured to adjust an operating frequency of the objective function according to the variation.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the web page animation processing method of any one of claims 1 to 6.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the web animation processing method of any one of claims 1 to 6.
10. A computer program product comprising computer programs/instructions, characterized in that the computer programs/instructions, when executed by a processor, implement the web animation processing method of any of claims 1 to 6.
CN202110740612.4A 2021-06-30 2021-06-30 Webpage animation processing method and device, electronic equipment and storage medium Pending CN113487707A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110740612.4A CN113487707A (en) 2021-06-30 2021-06-30 Webpage animation processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110740612.4A CN113487707A (en) 2021-06-30 2021-06-30 Webpage animation processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113487707A true CN113487707A (en) 2021-10-08

Family

ID=77936868

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110740612.4A Pending CN113487707A (en) 2021-06-30 2021-06-30 Webpage animation processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113487707A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591207A (en) * 2023-10-24 2024-02-23 荣耀终端有限公司 Dynamic effect parameter determining method and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110096077A1 (en) * 2009-10-27 2011-04-28 Microsoft Corporation Controlling animation frame rate of applications
CN104221310A (en) * 2012-03-28 2014-12-17 英特尔公司 Dynamically adaptive frequency adjustments
CN107122036A (en) * 2017-04-18 2017-09-01 青岛海信移动通信技术股份有限公司 CPU frequency adjusting method and device
CN108663093A (en) * 2017-03-28 2018-10-16 北京华电滢欣科技有限公司 A kind of method and apparatus of dynamic adjustment gauge table measurement frequency
CN110673958A (en) * 2019-09-30 2020-01-10 Oppo(重庆)智能科技有限公司 Frequency modulation method, frequency modulation device, storage medium and electronic equipment
CN112363842A (en) * 2020-11-27 2021-02-12 Oppo(重庆)智能科技有限公司 Frequency adjusting method and device for graphic processor, electronic equipment and storage medium
CN112631415A (en) * 2020-12-31 2021-04-09 Oppo(重庆)智能科技有限公司 CPU frequency adjusting method, device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110096077A1 (en) * 2009-10-27 2011-04-28 Microsoft Corporation Controlling animation frame rate of applications
CN104221310A (en) * 2012-03-28 2014-12-17 英特尔公司 Dynamically adaptive frequency adjustments
CN108663093A (en) * 2017-03-28 2018-10-16 北京华电滢欣科技有限公司 A kind of method and apparatus of dynamic adjustment gauge table measurement frequency
CN107122036A (en) * 2017-04-18 2017-09-01 青岛海信移动通信技术股份有限公司 CPU frequency adjusting method and device
CN110673958A (en) * 2019-09-30 2020-01-10 Oppo(重庆)智能科技有限公司 Frequency modulation method, frequency modulation device, storage medium and electronic equipment
CN112363842A (en) * 2020-11-27 2021-02-12 Oppo(重庆)智能科技有限公司 Frequency adjusting method and device for graphic processor, electronic equipment and storage medium
CN112631415A (en) * 2020-12-31 2021-04-09 Oppo(重庆)智能科技有限公司 CPU frequency adjusting method, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李谦,伍卫国,曹莹方,王蕾: "面向能耗优化的云渲染系统任务调度策略", 西安交通大学学报, vol. 50, no. 2 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591207A (en) * 2023-10-24 2024-02-23 荣耀终端有限公司 Dynamic effect parameter determining method and electronic equipment

Similar Documents

Publication Publication Date Title
CN110611829B (en) Video preloading method and device, electronic equipment and storage medium
CN109157839A (en) Frame per second regulates and controls method, apparatus, storage medium and terminal
CN113766324B (en) Video playing control method and device, computer equipment and storage medium
CN112565868B (en) Video playing method and device and electronic equipment
CN113391684A (en) Temperature control method, temperature control device, and storage medium
CN113760080A (en) Display method, display device and storage medium
CN115719586A (en) Screen refresh rate adjusting method and device, electronic equipment and storage medium
CN113487707A (en) Webpage animation processing method and device, electronic equipment and storage medium
CN112866612B (en) Frame insertion method, device, terminal and computer readable storage medium
CN114442792A (en) Method and device for adjusting operating frequency of processor and storage medium
CN110069310B (en) Method and device for switching desktop wallpaper and storage medium
CN115695699A (en) Display frame rate adjusting method and device, terminal and storage medium
CN114442789A (en) Dark screen control method, device, equipment and storage medium
CN114253385A (en) Power consumption management method and device of mobile terminal and computer readable storage medium
CN108874482B (en) Image processing method and device
CN115248711A (en) Method and device for adjusting refresh rate of display screen, terminal and storage medium
CN113241044A (en) Screen brightness adjusting method, device, equipment and storage medium
CN111261035B (en) Screen display method and device
CN109166512B (en) Display screen brightness adjusting method and device and electronic equipment
CN114690975B (en) Dynamic effect processing method and related device
CN116610202A (en) Equipment control method and device, storage medium and electronic equipment
CN114082177A (en) Terminal device control method and device, electronic device and storage medium
CN115934012A (en) Screen refresh rate adjusting method and device, mobile terminal and storage medium
CN113467900A (en) Terminal, information processing method, device and storage medium
CN112464125A (en) Page display method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination