WO2020233056A1 - H5 page-based animation display method, apparatus and device, and storage medium - Google Patents
H5 page-based animation display method, apparatus and device, and storage medium Download PDFInfo
- Publication number
- WO2020233056A1 WO2020233056A1 PCT/CN2019/120918 CN2019120918W WO2020233056A1 WO 2020233056 A1 WO2020233056 A1 WO 2020233056A1 CN 2019120918 W CN2019120918 W CN 2019120918W WO 2020233056 A1 WO2020233056 A1 WO 2020233056A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- animation
- page
- display
- display information
- sequence
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
Definitions
- This application relates to the technical field of software applications, and in particular to an animation display method, device, equipment and storage medium based on H5 pages.
- H5 pages HTML5 pages
- the main purpose of this application is to provide an animation display method, device, device and storage medium based on H5 page, which aims to solve the problem of slow opening speed, slow animation execution, page elements, and page elements based on H5 page development. Technical problem of poor display effect.
- this application provides an animation display method based on H5 page, the method includes the following steps:
- the animation element is animatedly displayed according to the target display information and the animation sequence.
- this application also proposes an animation display device based on H5 page, the device includes:
- the information acquisition module is used to acquire the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;
- a rule adjustment module configured to extract a terminal identifier corresponding to the display terminal from the device information
- the rule adjustment module is further configured to use the terminal identifier as a key object to find a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;
- the rule adjustment module is further configured to adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information
- the animation acquisition module is used to acquire the element attributes of all page elements corresponding to the application to be displayed, detect whether there is an animation tag in the element attribute, and if it exists, determine that the page element contains an animation element. Preloading, and determining the animation sequence corresponding to the animation element according to the loading result;
- the animation execution module is used to perform animation display on the animation element according to the target display information and the animation sequence.
- this application also proposes an animation display device based on H5 pages, the device including: a memory, a processor, and computer-readable instructions stored on the memory and executable by the processor , Wherein when the computer-readable instructions are executed by the processor, the steps of the H5 page-based animation display method as described above are implemented.
- this application also proposes a storage medium storing computer-readable instructions, where the computer-readable instructions are executed by a processor to implement the H5 page-based
- the animation shows the steps of the method.
- FIG. 1 is a schematic structural diagram of an H5 page-based animation display device in a hardware operating environment related to a solution of an embodiment of the present application;
- FIG. 2 is a schematic flowchart of the first embodiment of the animation display method based on H5 page of this application;
- FIG. 3 is a schematic flowchart of a second embodiment of an animation display method based on an H5 page of this application;
- FIG. 4 is a schematic flowchart of a third embodiment of an animation display method based on an H5 page of this application;
- FIG. 5 is a structural block diagram of the first embodiment of the animation display device based on the H5 page of this application.
- FIG. 1 is a schematic structural diagram of an H5 page-based animation display device in a hardware operating environment involved in a solution of an embodiment of the application.
- the H5 page-based animation display device may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), communication bus 1002, user interface 1003, network interface 1004, memory 1005.
- the communication bus 1002 is used to implement connection and communication between these components.
- the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
- the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface).
- WIreless-FIdelity WI-FI
- the memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, can also be a stable non-volatile memory (Non-Volatile Memory, NVM), such as disk storage.
- RAM Random Access Memory
- NVM Non-Volatile Memory
- the memory 1005 may also be a storage device independent of the foregoing processor 1001.
- FIG. 1 does not constitute a limitation on the animation display device based on the H5 page, and may include more or less components than shown in the figure, or a combination of certain components, or different Component arrangement.
- the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and computer readable instructions.
- the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with users; this application is based on the H5 page animation display device
- the processor 1001 and the memory 1005 may be set in an animation display device based on the H5 page.
- the animation display device based on the H5 page calls the computer readable instructions stored in the memory 1005 through the processor 1001, and executes the instructions provided in the embodiments of the present application.
- the animation display method based on H5 page is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with users; this application is based on the H5 page animation display device
- the processor 1001 and the memory 1005 may be set in an animation display device based on the H5 page.
- the animation display device based on the H5 page calls the computer readable instructions stored in the memory 1005 through the processor 1001, and executes the instructions provided in the embodiments of the present application.
- FIG. 2 is a schematic flowchart of a first embodiment of an animation display method based on an H5 page in this application.
- the H5 page-based animation display method includes the following steps:
- Step S10 Obtain device information of the display terminal and display information of the H5 page to be displayed by the application to be displayed;
- the execution subject of the method in this embodiment may be a browser client (hereinafter referred to as a browser) loaded on a display terminal (for example, a smart phone, a tablet computer, or a personal computer).
- the device information may be device attribute information or parameters of the display terminal, such as operating system type (IOS or Android), screen resolution, terminal identification (such as hardware identification number, international mobile equipment identification code), etc.
- the H5 page display information is the display standard parameters used to display the application page of the application, such as the aspect ratio of the display area, the page aspect ratio, font format, font size, etc.
- the browser when the browser receives the application start instruction input by the user, in response to the start instruction, obtain the device information of the display terminal where the application to be displayed is located, and the information of the H5 page that displays the application to be displayed. Display information.
- Step S20 Extract the terminal identifier corresponding to the display terminal from the device information
- the terminal identifier may be a character that can characterize the uniqueness of the terminal device, such as a device hardware identification code, a factory serial number, etc., and of course, may also be a device model.
- Step S30 Use the terminal identifier as the key object to search for the target page adjustment strategy corresponding to the key object in the pre-built key-value pair of the terminal identifier and the page adjustment strategy;
- the browser can use the acquired terminal identifier as the key object to find the target page adjustment strategy corresponding to the key object in the pre-built key-value pair of the terminal identifier and the page adjustment strategy, and the target page adjustment strategy has been achieved.
- Quick search for page adjustment strategies can be used.
- Step S40 Adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information
- the corresponding device hardware parameters or attributes are also different. If the browser loads the application page corresponding to the App directly on the H5 page without adapting it according to the device attributes of the display terminal, it will cause the page displayed on the H5 page to appear stuck, not smooth or even display asymmetrical happening.
- the browser in this embodiment can compare the obtained device information with the H5 page display information, obtain the display parameters that differ between the two to determine the corresponding target page adjustment strategy, and then according to the corresponding The target page adjustment strategy of the H5 page adjusts the display parameters in the H5 page display information to obtain target display information that is adapted to the current H5 page.
- the browser after the browser obtains the target page adjustment strategy, it can adjust the H5 page display information according to the target page adjustment strategy to obtain the target display information.
- the actual page aspect ratio of the displayed page is 2:3, and the preset page aspect ratio in the H5 page display information is 2.5:3.
- the browser can change the preset page The value of the aspect ratio is modified to the value corresponding to the actual page aspect ratio to complete the information adjustment.
- Step S50 Obtain element attributes of all page elements corresponding to the application to be displayed, and detect whether there are animation tags in the element attributes;
- the browser may first detect whether the page element corresponding to the application to be displayed contains an animation element, if it does, obtain the animation sequence corresponding to the animation element, and then execute the animation element according to the animation sequence to avoid When the animation element is executed, freezes and frame loss occur.
- the browser may obtain the element attributes of all page elements corresponding to the application to be displayed, and detect whether there are animation tags (such as video tags, flash tags, gif tags) in the element attributes.
- animation tags such as video tags, flash tags, gif tags
- Step S60 if it exists, determine that the page element contains an animation element, preload the animation element, and determine the animation sequence corresponding to the animation element according to the loading result;
- the browser can first arbitrarily select a canvas container, preload the animation elements, and preload the animation elements by calling the preset RequestAnimationFrame function.
- the execution situation during the loading process is monitored to obtain the loading result; then the animation frame sequence contained in the loading result is read, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence.
- the pre-loading may be to load each frame of pictures in the animation element into the selected canvas container one by one in the order of execution of the animation.
- Step S70 Perform animation display on the animation element according to the target display information and the animation sequence.
- JS animation is JavaScript Animation
- JavaScript animation can control animation during animation playback, such as "start, pause, playback, terminate, cancel" and other operations can be achieved, but its disadvantage is that JavaScript runs in the main thread of the browser, and when the main thread
- JavaScript scripts, style calculations, layouts, and drawing tasks that need to be run, they will interfere with the execution of the animation and cause the thread to block, resulting in frame loss and animation freezes.
- CSS CSS Style Sheets
- the browser in this embodiment adaptively adjusts the H5 page display information to obtain the target display information, and then displays the page elements in the application page to be displayed according to the target display information.
- the browser in this embodiment will also call the RequestAnimationFrame function to monitor the display process of the animation elements, so that the animation elements are displayed one by one according to the animation sequence acquired in advance, preventing animation The picture freezes or drops frames.
- the display information of the H5 page is adjusted according to the device information to obtain target display information that matches the current terminal page.
- the adjusted target display information and animation displays the animation, which not only guarantees the display effect of the page elements, but also avoids the stalling and frame loss during the execution of the animation elements.
- FIG. 3 is a schematic flowchart of a second embodiment of the animation display method based on the H5 page of this application.
- the method further includes:
- Step S301 when the target page adjustment strategy corresponding to the key object is not found, read the display parameters corresponding to the display device from the device information;
- the browser does not find the target page adjustment strategy corresponding to the key object in the pre-built key-value pair, it indicates that the developer may not configure the corresponding page adjustment strategy for the display terminal in advance. Then, the display parameters corresponding to the display device can be read from the device information, and then the H5 page display information can be adjusted in real time according to the read display parameters.
- Step S302 Determine the actual page aspect ratio corresponding to the H5 page according to the display parameters, and adjust the preset page aspect ratio in the H5 page display information based on the actual page aspect ratio to obtain a target display information.
- the browser can determine the actual page aspect ratio corresponding to the current H5 page according to the data in the display parameters, and then compare the actual page aspect ratio based on the actual page aspect ratio. Adjust the preset page aspect ratio in the H5 page display information.
- the above page aspect ratio is only one of the more important parameters in the display information of the H5 page in this embodiment.
- the browser can also compare other page elements corresponding to the H5 page, such as font format and font, according to the display parameters.
- the size is adjusted adaptively, and the adjustment principle and the above-mentioned page aspect ratio adjustment method type are not repeated here.
- the display parameters corresponding to the display device are read from the device information; the actual page aspect ratio corresponding to the H5 page is determined according to the display parameters, and is based on the actual page width and height Adjust the preset page aspect ratio in the H5 page display information to obtain the target display information, so as to achieve the smooth acquisition of the target display information and ensure the display effect of the page elements.
- FIG. 4 is a schematic flowchart of the third embodiment of the animation display method based on the H5 page of this application.
- the step of reading the animation frame sequence contained in the loading result and determining the animation sequence corresponding to the animation element according to the animation frame sequence includes:
- Step S601 Read the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal;
- the frame rate is the frequency (rate) at which the image continuously appears on the display in units of frames, in Hz (hertz).
- the screen refresh rate is also called the screen refresh rate.
- the 120Hz high refresh rate display means that the physical refresh rate of the display is limited to 120 frames per second. The lower the refresh rate, the more flickering, pause, and jitter the image will be. , The faster the glasses fatigue; the higher the refresh rate, the better the stability of the displayed image (picture).
- the screen refresh rate of the display terminal defaults to 60Hz.
- the callback function of the page display in this type of display terminal needs to be executed every 16.7ms, but in actual situations not all display terminals correspond to The screen refresh rate is 60Hz. If the difference in the screen refresh rate of the display terminal is not considered, the callback function is still executed in a time period of 16.7ms, which may cause the animation effect to freeze and drop frames, which affects the user experience.
- the browser in this embodiment will also obtain the screen refresh rate corresponding to the display terminal to determine the time period when the callback function is executed.
- Step S602 Determine the execution period of the RequestAnimationFrame function according to the screen refresh rate
- Step S603 Obtain the time node corresponding to each frame of animation in the animation frame sequence when it is executed, and determine the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node;
- the animation frame sequence is the corresponding execution sequence when each frame of animation is executed.
- the browser can determine the animation frame set corresponding to each execution cycle according to the currently determined execution cycle and the execution time node. For example, if the browser currently determines that the execution period is 3 seconds, "Picture 1, Picture 2 and Picture 3" will be executed in the same execution period, that is, the animation frame set includes Picture 1, Picture 2, and Picture 3.” Three collection elements.
- the animation frame sequence b contains picture 1 ⁇ 48.
- Step S604 Obtain the execution time period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution time period.
- the execution period corresponding to each animation frame set can be determined according to the total duration of the animation, and then the animation element corresponding to the animation element can be determined according to the execution period. Animation sequence.
- the browser in this embodiment can also call the RequestAnimationFrame function so that the JS animation and CSS animation contained in the animation element are executed synchronously, that is, the animation actions that can be combined are combined in the same rendering cycle for screen rendering And show.
- this embodiment can also implement the routing class by using the transition& component in the Vue plug-in The effect of sliding the Tab left and right.
- two classes classes
- v-enter and v-enter-active can be added to page elements through the transition& component.
- the v-enter class is deleted. After the transition is over, Then delete v-enter-active, so as to realize the left and right sliding switch of the page, and there is no jam.
- This embodiment reads the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal; determines the execution cycle of the RequestAnimationFrame function according to the screen refresh rate; obtains the corresponding time node when each frame of animation in the animation frame sequence is executed, Determine the animation frame set corresponding to each execution cycle according to the execution cycle and execution time node; obtain the execution time period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution time period, effectively avoiding the time when the animation element is executed.
- the situation of pauses and dropped frames improves the user experience.
- the embodiment of the present application also proposes a storage medium, and the storage medium may be a non-volatile readable storage medium.
- the storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the animation display method based on the H5 page as described above are realized.
- FIG. 5 is a structural block diagram of the first embodiment of the animation display device based on the H5 page of this application.
- the H5 page-based animation display device proposed in the embodiment of the present application includes:
- the information acquisition module 501 is used to acquire the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;
- the rule adjustment module 502 is configured to extract the terminal identifier corresponding to the display terminal from the device information
- the rule adjustment module 502 is further configured to use the terminal identifier as a key object to search for a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;
- the rule adjustment module 502 is further configured to adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information;
- the animation acquisition module 503 is used to acquire the element attributes of all page elements corresponding to the application to be displayed, detect whether there is an animation tag in the element attribute, and if it exists, determine that the page element contains an animation element.
- the element is preloaded, and the animation sequence corresponding to the animation element is determined according to the loading result;
- the animation execution module 504 is configured to perform animation display on the animation element according to the target display information and the animation sequence.
- the display information of the H5 page is adjusted according to the device information to obtain target display information that matches the current terminal page.
- the adjusted target display information and animation displays the animation, which not only guarantees the display effect of the page elements, but also avoids the stalling and frame loss during the execution of the animation elements.
- the rule adjustment module 502 is further configured to read the display parameters corresponding to the display device from the device information when the target page adjustment strategy corresponding to the key object is not found;
- the display parameter determines the actual page aspect ratio corresponding to the H5 page, and adjusts the preset page aspect ratio in the H5 page display information based on the actual page aspect ratio to obtain target display information.
- the animation acquisition module 503 is configured to preload the animation elements, call the preset RequestAnimationFrame function to monitor the execution of the animation element preloading process, to obtain the loading results;
- the animation frame sequence contained in the loading result is determined, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence.
- the animation acquisition module 503 is configured to read the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal; determine the execution period of the RequestAnimationFrame function according to the screen refresh rate; Acquire the time node corresponding to each frame of animation in the animation frame sequence when it is executed, determine the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node; obtain the execution period corresponding to each animation frame set , And determine the animation sequence corresponding to the animation element according to the execution period.
- the animation execution module 504 is configured to display the page element according to the target display information; call the RequestAnimationFrame function to monitor the display process of the animation element, so that the animation element is The animation sequence is displayed one by one.
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Processing Or Creating Images (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
An H5 page-based animation display method, apparatus and device, and a storage medium. The method comprises: acquiring device information about a display terminal, and display information about an H5 page for displaying an application to be displayed (S10); adjusting the display information about the H5 page according to a target page adjustment policy to acquire target display information (S40); detecting whether a page element corresponding to said application contains an animation element, if so, acquiring an animation sequence corresponding to the animation element; then performing animation display on the animation element according to the target display information and the animation sequence (S70). As the display information about the H5 page is adjusted, to obtain target display information conforming to the current terminal page, and meanwhile, when it is detected that an animation element exists in the page of said application, the animation is displayed according to the adjusted target display information and the animation sequence of the animation element, the display effect of the page elements is ensured, and stuttering and frame loss during the execution of the animation element is avoided.
Description
本申请要求于2019年5月21日提交中国专利局、申请号为201910426696.7、发明名称为“基于H5页面的动画显示方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 21, 2019, the application number is 201910426696.7, and the invention title is "H5 page-based animation display method, device, equipment and storage medium", and its entire content Incorporated in the application by reference
技术领域Technical field
本申请涉及软件应用技术领域,尤其涉及一种基于H5页面的动画显示方法、装置、设备及存储介质。This application relates to the technical field of software applications, and in particular to an animation display method, device, equipment and storage medium based on H5 pages.
背景技术Background technique
随着计算机软件技术的快速发展,各式各样的应用程序(Application,App)已经成为了大众生活中不可或缺的一部分,这些App在日常生活中为大众的衣食住行都提供了便利。由于App的种类繁多,且功能不一,出于网络流量以及设备内存的考虑,用户不可能将所有的功能的App都下载到手机上进行使用,因此很多App服务商都采用将自身提供的App通过HTML5页面(简称H5页面)的方式提供给用户使用,以免去用户下载App耗费网络流量的顾虑。但目前市场类似应用程序功能的H5页面大都是简单的模仿,且模仿效果不佳,并存在打开速度慢,动画执行卡顿,页面在不同机型上显示效果有差异等诸多缺陷。With the rapid development of computer software technology, various applications (Apps) have become an indispensable part of people's lives. These apps provide convenience for people's daily life. Due to the wide variety of apps and different functions, due to network traffic and device memory considerations, it is impossible for users to download all functional apps to their mobile phones for use. Therefore, many App service providers use their own apps to pass HTML5 pages (referred to as H5 pages) are provided to users to avoid users' worries about downloading App and consuming network traffic. However, most of the H5 pages with similar application functions in the market are simple imitations, and the imitation effect is not good, and there are many defects such as slow opening speed, animation execution stalls, and page display effects on different models.
发明内容Summary of the invention
本申请的主要目的在于提供了一种基于H5页面的动画显示方法、装置、设备及存储介质,旨在解决现有的基于H5页面开发的应用程序,开启速度慢、动画执行卡顿、页面元素显示效果不佳的技术问题。The main purpose of this application is to provide an animation display method, device, device and storage medium based on H5 page, which aims to solve the problem of slow opening speed, slow animation execution, page elements, and page elements based on H5 page development. Technical problem of poor display effect.
为实现上述目的,本申请提供了一种基于H5页面的动画显示方法,所述方法包括以下步骤:In order to achieve the above objective, this application provides an animation display method based on H5 page, the method includes the following steps:
获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;Obtain the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;
从所述设备信息中提取所述显示终端对应的终端标识;Extract the terminal identifier corresponding to the display terminal from the device information;
将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;Using the terminal identifier as a key object to search for a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;
根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;Adjusting the display information of the H5 page according to the target page adjustment strategy to obtain target display information;
获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签;Obtaining element attributes of all page elements corresponding to the application to be displayed, and detecting whether there are animation tags in the element attributes;
若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;If it exists, determine that the page element contains an animation element, preload the animation element, and determine the animation sequence corresponding to the animation element according to the loading result;
根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation element is animatedly displayed according to the target display information and the animation sequence.
此外,为实现上述目的,本申请还提出一种基于H5页面的动画显示装置,所述装置包括:In addition, in order to achieve the above object, this application also proposes an animation display device based on H5 page, the device includes:
信息获取模块,用于获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;The information acquisition module is used to acquire the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;
规则调整模块,用于从所述设备信息中提取所述显示终端对应的终端标识;A rule adjustment module, configured to extract a terminal identifier corresponding to the display terminal from the device information;
所述规则调整模块,还用于将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;The rule adjustment module is further configured to use the terminal identifier as a key object to find a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;
所述规则调整模块,还用于根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;The rule adjustment module is further configured to adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information;
动画获取模块,用于获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签,若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;The animation acquisition module is used to acquire the element attributes of all page elements corresponding to the application to be displayed, detect whether there is an animation tag in the element attribute, and if it exists, determine that the page element contains an animation element. Preloading, and determining the animation sequence corresponding to the animation element according to the loading result;
动画执行模块,用于根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation execution module is used to perform animation display on the animation element according to the target display information and the animation sequence.
此外,为实现上述目的,本申请还提出一种基于H5页面的动画显示设备,所述设备包括:存储器、处理器及存储在所述存储器上并可被所述处理器执行的计算机可读指令,其中所述计算机可读指令被所述处理器执行时,实现如上文所述的基于H5页面的动画显示方法的步骤。In addition, in order to achieve the above purpose, this application also proposes an animation display device based on H5 pages, the device including: a memory, a processor, and computer-readable instructions stored on the memory and executable by the processor , Wherein when the computer-readable instructions are executed by the processor, the steps of the H5 page-based animation display method as described above are implemented.
此外,为实现上述目的,本申请还提出一种存储介质,所述存储介质上存储有计算机可读指令,其中所述计算机可读指令被处理器执行时,实现如上文所述的基于H5页面的动画显示方法的步骤。In addition, in order to achieve the above object, this application also proposes a storage medium storing computer-readable instructions, where the computer-readable instructions are executed by a processor to implement the H5 page-based The animation shows the steps of the method.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其他特征和优点将从说明书、附图以及权利要求书变得明显。The details of one or more embodiments of the application are set forth in the following drawings and description. Other features and advantages of this application will become apparent from the description, drawings and claims.
附图说明Description of the drawings
图1是本申请实施例方案涉及的硬件运行环境的基于H5页面的动画显示设备的结构示意图;FIG. 1 is a schematic structural diagram of an H5 page-based animation display device in a hardware operating environment related to a solution of an embodiment of the present application;
图2为本申请基于H5页面的动画显示方法第一实施例的流程示意图;2 is a schematic flowchart of the first embodiment of the animation display method based on H5 page of this application;
图3为本申请基于H5页面的动画显示方法第二实施例的流程示意图;FIG. 3 is a schematic flowchart of a second embodiment of an animation display method based on an H5 page of this application;
图4为本申请基于H5页面的动画显示方法第三实施例的流程示意图;4 is a schematic flowchart of a third embodiment of an animation display method based on an H5 page of this application;
图5为本申请基于H5页面的动画显示装置第一实施例的结构框图。FIG. 5 is a structural block diagram of the first embodiment of the animation display device based on the H5 page of this application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the application, and not used to limit the application.
参照图1,图1为本申请实施例方案涉及的硬件运行环境的基于H5页面的动画显示设备结构示意图。Referring to FIG. 1, FIG. 1 is a schematic structural diagram of an H5 page-based animation display device in a hardware operating environment involved in a solution of an embodiment of the application.
如图1所示,该基于H5页面的动画显示设备可以包括:处理器1001,例如中央处理器(Central
Processing
Unit,CPU),通信总线1002、用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如无线保真(WIreless-FIdelity,WI-FI)接口)。存储器1005可以是高速的随机存取存储器(Random
Access Memory,RAM)存储器,也可以是稳定的非易失性存储器(Non-Volatile
Memory,NVM),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in Figure 1, the H5 page-based animation display device may include: a processor 1001, such as a central processing unit (Central
Processing
Unit, CPU), communication bus 1002, user interface 1003, network interface 1004, memory 1005. Among them, the communication bus 1002 is used to implement connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random
Access Memory, RAM) memory, can also be a stable non-volatile memory (Non-Volatile
Memory, NVM), such as disk storage. Optionally, the memory 1005 may also be a storage device independent of the foregoing processor 1001.
本领域技术人员可以理解,图1中示出的结构并不构成对基于H5页面的动画显示设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 1 does not constitute a limitation on the animation display device based on the H5 page, and may include more or less components than shown in the figure, or a combination of certain components, or different Component arrangement.
如图1所示,作为一种存储介质的存储器1005中可以包括操作系统、数据存储模块、网络通信模块、用户接口模块以及计算机可读指令。As shown in FIG. 1, the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and computer readable instructions.
在图1所示的基于H5页面的动画显示设备中,网络接口1004主要用于与网络服务器进行数据通信;用户接口1003主要用于与用户进行数据交互;本申请基于H5页面的动画显示设备中的处理器1001、存储器1005可以设置在基于H5页面的动画显示设备中,所述基于H5页面的动画显示设备通过处理器1001调用存储器1005中存储的计算机可读指令,并执行本申请实施例提供的基于H5页面的动画显示方法。In the H5 page-based animation display device shown in FIG. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with users; this application is based on the H5 page animation display device The processor 1001 and the memory 1005 may be set in an animation display device based on the H5 page. The animation display device based on the H5 page calls the computer readable instructions stored in the memory 1005 through the processor 1001, and executes the instructions provided in the embodiments of the present application. The animation display method based on H5 page.
本申请实施例提供了一种基于H5页面的动画显示方法,参照图2,图2为本申请基于H5页面的动画显示方法第一实施例的流程示意图。An embodiment of the present application provides an animation display method based on an H5 page. Referring to FIG. 2, FIG. 2 is a schematic flowchart of a first embodiment of an animation display method based on an H5 page in this application.
本实施例中,所述基于H5页面的动画显示方法包括以下步骤:In this embodiment, the H5 page-based animation display method includes the following steps:
步骤S10:获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;Step S10: Obtain device information of the display terminal and display information of the H5 page to be displayed by the application to be displayed;
需要说明的是,本实施例方法的执行主体可以是装载在显示终端(例如智能手机、平板电脑、个人电脑)上的浏览器客户端(以下简称浏览器)。所述设备信息可以是显示终端的设备属性信息或参数,例如操作系统类型(IOS或Android)、屏幕分辨率、终端标识(如硬件识别号、国际移动设备识别码)等。所述H5页面显示信息,即用于对应用程序进行应用页面显示的显示标准参数,例如显示区域的宽高比、页面宽高比,字体格式、字体大小等。It should be noted that the execution subject of the method in this embodiment may be a browser client (hereinafter referred to as a browser) loaded on a display terminal (for example, a smart phone, a tablet computer, or a personal computer). The device information may be device attribute information or parameters of the display terminal, such as operating system type (IOS or Android), screen resolution, terminal identification (such as hardware identification number, international mobile equipment identification code), etc. The H5 page display information is the display standard parameters used to display the application page of the application, such as the aspect ratio of the display area, the page aspect ratio, font format, font size, etc.
在具体实现中,浏览器在接收到用户输入的应用程序开启指令时,响应于该开启指令获取待显示应用程序所在显示终端的设备信息,以及对所述待显示应用程序进行显示的H5页面的显示信息。In a specific implementation, when the browser receives the application start instruction input by the user, in response to the start instruction, obtain the device information of the display terminal where the application to be displayed is located, and the information of the H5 page that displays the application to be displayed. Display information.
步骤S20:从所述设备信息中提取所述显示终端对应的终端标识;Step S20: Extract the terminal identifier corresponding to the display terminal from the device information;
应理解的是,所述终端标识可以是能够表征终端设备唯一性的字符,例如设备硬件识别码、出厂序列号等,当然也可以是设备型号。It should be understood that the terminal identifier may be a character that can characterize the uniqueness of the terminal device, such as a device hardware identification code, a factory serial number, etc., and of course, may also be a device model.
需要说明的是,由于显示终端的机型不同,它们各自对应的显示参数也不同,为提高应用页面的显示效率,研发人员可预先为不同设备的不同机型(例如华为-12345、小米-12345、iPhone-12345等)配置相应的H5页面的页面调整策略,然后建立一个终端标识和页面调整策略之间的映射关系,以使得浏览器在从设备信息中提取到显示终端对应的终端标识后,根据该映射关系迅速的获取对应的页面调整策略。It should be noted that due to the different models of display terminals, their corresponding display parameters are also different. In order to improve the display efficiency of the application page, R&D personnel can pre-set different models of different devices (such as Huawei-12345, Xiaomi-12345) , IPhone-12345, etc.) Configure the page adjustment strategy of the corresponding H5 page, and then establish a mapping relationship between the terminal ID and the page adjustment strategy, so that the browser can extract the terminal ID corresponding to the display terminal from the device information. According to the mapping relationship, the corresponding page adjustment strategy is quickly obtained.
步骤S30:将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;Step S30: Use the terminal identifier as the key object to search for the target page adjustment strategy corresponding to the key object in the pre-built key-value pair of the terminal identifier and the page adjustment strategy;
需要说明的是,考虑到键值对便于维护,且易于研发人员修改配置,本实施例中,所述映射关系优选通过键值对的方式来实现,例如“key
=value”,其中“key”即键对象,可以是所述终端标识;“value”即值对象,则可以是所述终端标识对应的页面调整策略。It should be noted that, considering that key-value pairs are easy to maintain and easy for developers to modify the configuration, in this embodiment, the mapping relationship is preferably implemented by key-value pairs, such as "key
=value", where "key" is a key object, which may be the terminal identifier; "value" is a value object, which may be a page adjustment strategy corresponding to the terminal identifier.
在具体实现中,浏览器可将获取到的所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略,已实现对目标页面调整策略的快速查找。In a specific implementation, the browser can use the acquired terminal identifier as the key object to find the target page adjustment strategy corresponding to the key object in the pre-built key-value pair of the terminal identifier and the page adjustment strategy, and the target page adjustment strategy has been achieved. Quick search for page adjustment strategies.
步骤S40:根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;Step S40: Adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information;
应理解的是,不同类型的显示终端由于机型的不同,对应的设备硬件参数或属性也不相同。若浏览器在将App对应的应用页面直接加载在H5页面,而不根据显示终端的设备属性进行适应性调整,将会导致通过H5页面展示出的页面出现卡顿、不流畅甚至显示不对称的情况。It should be understood that, due to different models of different types of display terminals, the corresponding device hardware parameters or attributes are also different. If the browser loads the application page corresponding to the App directly on the H5 page without adapting it according to the device attributes of the display terminal, it will cause the page displayed on the H5 page to appear stuck, not smooth or even display asymmetrical Happening.
为了避免上述情况,本实施例中浏览器可将获取到的设备信息和H5页面显示信息进行比较,获取两者之间存在差异的显示参数以确定对应的目标页面调整策略,然后根据所述对应的目标页面调整策略对所述H5页面显示信息中的显示参数进行调整,以获取适配当前H5页面的目标显示信息。例如,应用程序H5页面的显示参数中,研发人员可能给页面的html和body增加了height:
100%,而这一参数设定将会导致IOS上页面滑动的卡顿问题,但这类问题对应的目标页面调整策略配置可以是通过将body和html的height:
100%去除掉,又或是在滚动的canvas容器中增加:-webkit-overflow-scrolling: touch或者给body增加:body
{overflow-x: hidden},进而克服上述缺陷。In order to avoid the above situation, the browser in this embodiment can compare the obtained device information with the H5 page display information, obtain the display parameters that differ between the two to determine the corresponding target page adjustment strategy, and then according to the corresponding The target page adjustment strategy of the H5 page adjusts the display parameters in the H5 page display information to obtain target display information that is adapted to the current H5 page. For example, in the display parameters of the H5 page of an application, developers may add height to the html and body of the page:
100%, and this parameter setting will cause the page sliding stuck problem on IOS, but the target page adjustment strategy configuration corresponding to this kind of problem can be through the height of body and html:
Remove 100%, or add to the scrolling canvas container: -webkit-overflow-scrolling: touch or add: body to the body
{overflow-x: hidden} to overcome the above-mentioned shortcomings.
在具体实现中,浏览器在获取到所述目标页面调整策略后,即可根据目标页面调整策略对H5页面显示信息进行调整,以获取目标显示信息。例如目标页面调整策略中,显示页面的实际页面宽高比是2:3,而H5页面显示信息中的预设页面宽高比是2.5:3,此时浏览器则可以将所述预设页面宽高比的数值修改为所述实际页面宽高比对应的数值,以完成信息调整。In a specific implementation, after the browser obtains the target page adjustment strategy, it can adjust the H5 page display information according to the target page adjustment strategy to obtain the target display information. For example, in the target page adjustment strategy, the actual page aspect ratio of the displayed page is 2:3, and the preset page aspect ratio in the H5 page display information is 2.5:3. At this time, the browser can change the preset page The value of the aspect ratio is modified to the value corresponding to the actual page aspect ratio to complete the information adjustment.
步骤S50:获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签;Step S50: Obtain element attributes of all page elements corresponding to the application to be displayed, and detect whether there are animation tags in the element attributes;
应理解的是,大多数的应用程序页面元素中都会内置动画元素,以提高用户使用感。本实施例中,浏览器可先检测待显示应用程序对应的页面元素中是否含有动画元素,若含有则获取所述动画元素对应的动画序列,然后根据所述动画序列来执行动画元素,以避免所述动画元素被执行过程中出现卡顿、丢帧的情况。It should be understood that most of the application page elements will have built-in animation elements to improve user experience. In this embodiment, the browser may first detect whether the page element corresponding to the application to be displayed contains an animation element, if it does, obtain the animation sequence corresponding to the animation element, and then execute the animation element according to the animation sequence to avoid When the animation element is executed, freezes and frame loss occur.
具体的,浏览器可获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签(例如video标签、flash标签、gif标签)。Specifically, the browser may obtain the element attributes of all page elements corresponding to the application to be displayed, and detect whether there are animation tags (such as video tags, flash tags, gif tags) in the element attributes.
步骤S60:若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;Step S60: if it exists, determine that the page element contains an animation element, preload the animation element, and determine the animation sequence corresponding to the animation element according to the loading result;
应理解的是,所谓动画其实是由一帧一帧的图片拼接而成,这些图片在被连续播放时即形成了动画效果。在JS(JavaScript)语言中,通过给image对象的源文件(src)属性赋值一个图片的统一资源定位符(URL),就可以启动图片的加载。It should be understood that the so-called animation is actually a splicing of pictures frame by frame, and these pictures form an animation effect when they are played continuously. In the JS (JavaScript) language, by assigning a uniform resource locator (URL) of the image to the source file (src) attribute of the image object, the loading of the image can be started.
进一步地,本方案中为了能够实现对动画元素动画序列的准确获取,浏览器可先任意选取一个canvas容器,对所述动画元素进行预加载,并通过调用预设RequestAnimationFrame函数对所述动画元素预加载过程中的执行情况进行监听,以获取加载结果;然后再读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列。其中,所述预加载可以是将动画元素中的每一帧图片按动画执行顺序一张一张的加载到选取的canvas容器中。Further, in order to achieve accurate acquisition of the animation sequence of the animation elements in this solution, the browser can first arbitrarily select a canvas container, preload the animation elements, and preload the animation elements by calling the preset RequestAnimationFrame function. The execution situation during the loading process is monitored to obtain the loading result; then the animation frame sequence contained in the loading result is read, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence. Wherein, the pre-loading may be to load each frame of pictures in the animation element into the selected canvas container one by one in the order of execution of the animation.
步骤S70:根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。Step S70: Perform animation display on the animation element according to the target display information and the animation sequence.
需要说明的是,通常情况下H5页面中需要展示的动画元素可能有多个(如JS动画、CSS动画),所述JS动画,即JavaScript
动画,JavaScript动画可以在动画播放过程中对动画进行控制,如“开始、暂停、回放、终止、取消”等操作都可实现,但其缺点在于JavaScript在浏览器的主线程中运行,而当主线程中还有其它需要运行的JavaScript脚本、样式计算、布局、绘制任务等任务时,将会对动画的执行过程形成干扰从而导致线程可能出现阻塞,造成丢帧、动画卡顿的情况。同样的,CSS(Cascading
Style
Sheets,指层叠样式表)动画的优点在于浏览器可以对动画进行优化,但其缺点在于CSS动画只能暂停,不能在动画中寻找一个特定的时间点,不能在半路反转动画,也不能变换时间尺度,以及在特定的位置添加回调函数或是绑定回放事件,且无进度报告。It should be noted that under normal circumstances, there may be multiple animation elements that need to be displayed in the H5 page (such as JS animation, CSS animation). The JS animation is JavaScript
Animation, JavaScript animation can control animation during animation playback, such as "start, pause, playback, terminate, cancel" and other operations can be achieved, but its disadvantage is that JavaScript runs in the main thread of the browser, and when the main thread When there are other tasks such as JavaScript scripts, style calculations, layouts, and drawing tasks that need to be run, they will interfere with the execution of the animation and cause the thread to block, resulting in frame loss and animation freezes. Similarly, CSS (Cascading
Style
Sheets, refers to cascading style sheets) The advantage of animation is that the browser can optimize the animation, but its disadvantage is that CSS animation can only be paused, cannot find a specific time point in the animation, cannot reverse the animation halfway, nor can it transform Time scale, as well as adding callback functions at specific locations or binding playback events, and no progress report.
为了克服上述缺陷,本实施例中浏览器在对H5页面显示信息进行适应性调整获取到所述目标显示信息后,即可根据所述目标显示信息对待显示应用程序应用页面中的页面元素进行显示,同时为保证动画元素的执行效果,本实施例浏览器还将调用RequestAnimationFrame函数对所述动画元素的显示过程进行监听,以使得所述动画元素按照事先获取到的动画序列逐一进行显示,防止动画画面卡顿、丢帧的情况发生。In order to overcome the above shortcomings, the browser in this embodiment adaptively adjusts the H5 page display information to obtain the target display information, and then displays the page elements in the application page to be displayed according to the target display information. At the same time, in order to ensure the execution effect of the animation elements, the browser in this embodiment will also call the RequestAnimationFrame function to monitor the display process of the animation elements, so that the animation elements are displayed one by one according to the animation sequence acquired in advance, preventing animation The picture freezes or drops frames.
本实施例根据设备信息对H5页面显示信息进行调整,以获取到符合当前终端页面的目标显示信息,同时在检测到待显示应用程序页面中存在动画元素时,根据调整好的目标显示信息以及动画元素的动画序列对动画进行显示,既保证了页面元素的显示效果,也能避免动画元素执行时卡顿、丢帧的情况。In this embodiment, the display information of the H5 page is adjusted according to the device information to obtain target display information that matches the current terminal page. At the same time, when an animation element is detected in the application page to be displayed, the adjusted target display information and animation The animation sequence of the element displays the animation, which not only guarantees the display effect of the page elements, but also avoids the stalling and frame loss during the execution of the animation elements.
参考图3,图3为本申请基于H5页面的动画显示方法第二实施例的流程示意图。Referring to FIG. 3, FIG. 3 is a schematic flowchart of a second embodiment of the animation display method based on the H5 page of this application.
基于上述第一实施例,在本实施例中,所述步骤S30之后,还包括:Based on the above first embodiment, in this embodiment, after the step S30, the method further includes:
步骤S301:在未查找到所述键对象对应的目标页面调整策略时,从所述设备信息中读取所述显示设备对应的显示参数;Step S301: when the target page adjustment strategy corresponding to the key object is not found, read the display parameters corresponding to the display device from the device information;
应理解的是,若浏览器在预先构建的键值对中未查找到键对象对应的目标页面调整策略时,表明研发人员事先可能未为该显示终端配置相应的页面调整策略,此时浏览器则可从所述设备信息中读取所述显示设备对应的显示参数,然后根据读取到的显示参数对H5页面显示信息进行即时调整。It should be understood that if the browser does not find the target page adjustment strategy corresponding to the key object in the pre-built key-value pair, it indicates that the developer may not configure the corresponding page adjustment strategy for the display terminal in advance. Then, the display parameters corresponding to the display device can be read from the device information, and then the H5 page display information can be adjusted in real time according to the read display parameters.
步骤S302:根据所述显示参数确定H5页面对应的实际页面宽高比,并基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息。Step S302: Determine the actual page aspect ratio corresponding to the H5 page according to the display parameters, and adjust the preset page aspect ratio in the H5 page display information based on the actual page aspect ratio to obtain a target display information.
在具体实现中,浏览器在获取到显示设备对应的显示参数后,即可根据显示参数中的数据确定当前H5页面对应的实际页面宽高比,然后基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整。In a specific implementation, after obtaining the display parameters corresponding to the display device, the browser can determine the actual page aspect ratio corresponding to the current H5 page according to the data in the display parameters, and then compare the actual page aspect ratio based on the actual page aspect ratio. Adjust the preset page aspect ratio in the H5 page display information.
当然,上述页面宽高比只是本实施例H5页面显示信息中较为重要的参数之一,本实施例中浏览器还可以根据所述显示参数对H5页面对应的其它页面元素,例如字体格式、字体大小进行适应性调整,其调整原理与上述页面宽高比的调整方式类型,此处不再赘述。Of course, the above page aspect ratio is only one of the more important parameters in the display information of the H5 page in this embodiment. In this embodiment, the browser can also compare other page elements corresponding to the H5 page, such as font format and font, according to the display parameters. The size is adjusted adaptively, and the adjustment principle and the above-mentioned page aspect ratio adjustment method type are not repeated here.
本实施例在未查找到键对象对应的目标页面调整策略时,从设备信息中读取显示设备对应的显示参数;根据显示参数确定H5页面对应的实际页面宽高比,并基于实际页面宽高比对H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息,从而能够实现对目标显示信息的顺利获取,保证页面元素的显示效果。In this embodiment, when the target page adjustment strategy corresponding to the key object is not found, the display parameters corresponding to the display device are read from the device information; the actual page aspect ratio corresponding to the H5 page is determined according to the display parameters, and is based on the actual page width and height Adjust the preset page aspect ratio in the H5 page display information to obtain the target display information, so as to achieve the smooth acquisition of the target display information and ensure the display effect of the page elements.
参考图4,图4为本申请基于H5页面的动画显示方法第三实施例的流程示意图。Referring to FIG. 4, FIG. 4 is a schematic flowchart of the third embodiment of the animation display method based on the H5 page of this application.
基于上述各实施例,在本实施例中所述读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列的步骤,包括:Based on the foregoing embodiments, in this embodiment, the step of reading the animation frame sequence contained in the loading result and determining the animation sequence corresponding to the animation element according to the animation frame sequence includes:
步骤S601:读取所述加载结果中包含的动画帧序列以及所述显示终端对应的屏幕刷新率;Step S601: Read the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal;
应理解的是,帧率(Frame
rate)是以帧为单位的图像连续出现在显示器上的频率(速率),以Hz(赫兹)为单位。而屏幕刷新率也叫屏幕刷新频率,比如120Hz的高刷新率显示屏,就是指显示器的物理刷新速度上限为1秒钟120张,刷新频率越低,图像闪烁、停顿、和抖动的就越厉害,眼镜疲劳得越快;刷新率越高,所显示的图像(画面)稳定性就越好。It should be understood that the frame rate (Frame
rate) is the frequency (rate) at which the image continuously appears on the display in units of frames, in Hz (hertz). The screen refresh rate is also called the screen refresh rate. For example, the 120Hz high refresh rate display means that the physical refresh rate of the display is limited to 120 frames per second. The lower the refresh rate, the more flickering, pause, and jitter the image will be. , The faster the glasses fatigue; the higher the refresh rate, the better the stability of the displayed image (picture).
通常情况下,显示终端的屏幕刷新率都默认为60Hz,为保证画面流畅,这类显示终端中页面显示的回调函数需要每16.7ms就被执行一次,而实际情况下并非所有的显示终端对应的屏幕刷新率都为60Hz,若不考虑显示终端屏幕刷新率的差异,仍旧按照16.7ms的时间周期来执行回调函数,就可能造成动画效果卡顿、丢帧的情况,影响用户体验。Normally, the screen refresh rate of the display terminal defaults to 60Hz. In order to ensure the smoothness of the screen, the callback function of the page display in this type of display terminal needs to be executed every 16.7ms, but in actual situations not all display terminals correspond to The screen refresh rate is 60Hz. If the difference in the screen refresh rate of the display terminal is not considered, the callback function is still executed in a time period of 16.7ms, which may cause the animation effect to freeze and drop frames, which affects the user experience.
考虑到上述情形,本实施例中浏览器在读取到加载结果中包含的动画帧序列后,还将获取显示终端对应的屏幕刷新率从而确定回调函数被执行时的时间周期。Considering the above situation, after reading the animation frame sequence contained in the loading result, the browser in this embodiment will also obtain the screen refresh rate corresponding to the display terminal to determine the time period when the callback function is executed.
步骤S602:根据所述屏幕刷新率确定所述RequestAnimationFrame函数的执行周期;Step S602: Determine the execution period of the RequestAnimationFrame function according to the screen refresh rate;
应理解的是,通常情况下RequestAnimationFrame函数可用来决定回调函数的执行时机。例如,若屏幕刷新率是60Hz,那么回调函数就每16.7ms被执行一次,若屏幕果刷新率是75Hz,那么回调函数被执行时的时间周期就为1000/75=13.3ms。换言之,RequestAnimationFrame函数能够使得回调函数执行的步调跟着系统的刷新步调一致,从而保证回调函数在屏幕每一次的刷新间隔中只被执行一次,这样就不会引起丢帧现象,也不会导致动画出现卡顿的问题。It should be understood that in general, the RequestAnimationFrame function can be used to determine the timing of execution of the callback function. For example, if the screen refresh rate is 60Hz, then the callback function will be executed every 16.7ms. If the screen refresh rate is 75Hz, the time period when the callback function is executed is 1000/75=13.3ms. In other words, the RequestAnimationFrame function can make the callback function execute at the same pace as the system refresh, so as to ensure that the callback function is executed only once in each refresh interval of the screen, so that it will not cause frame loss or animation. Caton problem.
在具体实现中,浏览器可根据获取到的屏幕刷新率确定所述RequestAnimationFrame函数执行回调函数时的执行周期。其中,所述执行周期=1000/屏幕刷新率。In a specific implementation, the browser can determine the execution cycle of the RequestAnimationFrame function when the callback function is executed according to the acquired screen refresh rate. Wherein, the execution cycle=1000/screen refresh rate.
步骤S603:获取所述动画帧序列中每一帧动画被执行时对应的时间节点,根据所述执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集;Step S603: Obtain the time node corresponding to each frame of animation in the animation frame sequence when it is executed, and determine the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node;
应理解的是,所述动画帧序列,即每一帧动画被执行时对应的执行顺序。在获取到一段动画后,浏览器即可根据这段动画的总时长来分别确定每一帧动画被执行时对应的时间节点,例如动画a包括三帧图片“图片1、图片2和图片3”,且动画a的总时长为3秒钟,若帧率为1Hz,则执行周期为1000/1=1000ms=1秒,那么“图片1、图片2和图片3”被执行时对应的时间节点分别为“00:00:01、00:00:02和00:00:03”。It should be understood that the animation frame sequence is the corresponding execution sequence when each frame of animation is executed. After obtaining a piece of animation, the browser can determine the corresponding time node when each frame of animation is executed according to the total duration of the animation. For example, animation a includes three frames of pictures "Picture 1, Picture 2 and Picture 3" , And the total duration of animation a is 3 seconds, if the frame rate is 1Hz, the execution cycle is 1000/1=1000ms=1 second, then the corresponding time nodes when "Picture 1, Picture 2 and Picture 3" are executed It is "00:00:01, 00:00:02, and 00:00:03".
进一步地,浏览器在获取到动画帧序列中每一帧动画被执行时对应的时间节点后,即可根据当前确定的执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集。例如,浏览器当前确定出的执行周期为3秒,则“图片1、图片2和图片3”将在同一执行周期内被执行,即所述动画帧集包括图片1、图片2和图片3”三个集合元素。又例如,动画帧序列b中包含图片1~
48,在屏幕刷新率为60Hz时,动画帧序列b每一执行周期(16.7ms)对应的动画帧集为四个:图片0~12、图片13~24、图片25~36和图片37~48,当执行周期为13.3ms时,则对应的动画帧集可能就减少为三个:图片0~16、图片16~32和图片33~48。Further, after acquiring the time node corresponding to each frame of animation in the animation frame sequence, the browser can determine the animation frame set corresponding to each execution cycle according to the currently determined execution cycle and the execution time node. For example, if the browser currently determines that the execution period is 3 seconds, "Picture 1, Picture 2 and Picture 3" will be executed in the same execution period, that is, the animation frame set includes Picture 1, Picture 2, and Picture 3." Three collection elements. For another example, the animation frame sequence b contains picture 1~
48. When the screen refresh rate is 60Hz, there are four animation frame sets corresponding to each execution cycle (16.7ms) of animation frame sequence b: picture 0~12, picture 13~24, picture 25~36 and picture 37~48 When the execution cycle is 13.3ms, the corresponding animation frame set may be reduced to three: picture 0~16, picture 16~32 and picture 33~48.
步骤S604:获取各动画帧集对应的执行时段,并根据所述执行时段确定所述动画元素对应的动画序列。Step S604: Obtain the execution time period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution time period.
在具体实现中,在获取到每一执行周期对应的动画帧集后,即可根据动画的总时长来确定各动画帧集对应的执行时段,然后根据所述执行时段确定所述动画元素对应的动画序列。In specific implementation, after obtaining the animation frame set corresponding to each execution cycle, the execution period corresponding to each animation frame set can be determined according to the total duration of the animation, and then the animation element corresponding to the animation element can be determined according to the execution period. Animation sequence.
进一步地,为保证流畅的动画效果,本实施例中浏览器也可调用RequestAnimationFrame函数使得动画元素中包含的JS动画和CSS动画同步执行,即将能够合并的动画动作合并在同一渲染周期内进行画面渲染并显示。Further, in order to ensure a smooth animation effect, the browser in this embodiment can also call the RequestAnimationFrame function so that the JS animation and CSS animation contained in the animation element are executed synchronously, that is, the animation actions that can be combined are combined in the same rendering cycle for screen rendering And show.
进一步地,考虑到现有的H5页面在模拟App的产品页面时,用户无法通过在显示屏上左右滑动来实现页面切换,因此本实施例也可通过使用Vue插件中的transition&组件来实现路由类Tab左右滑动切换的效果。具体的,可通过transition&组件给页面元素加上v-enter,v-enter-active两个类(class),当页面切换到下一帧时,删掉v-enter这个class.在过渡结束之后,再删掉v-enter-active,从而实现页面的左右滑动切换,且无卡顿现象。Further, considering that when the existing H5 page simulates the App product page, the user cannot switch the page by sliding left and right on the display screen, so this embodiment can also implement the routing class by using the transition& component in the Vue plug-in The effect of sliding the Tab left and right. Specifically, two classes (classes), v-enter and v-enter-active, can be added to page elements through the transition& component. When the page switches to the next frame, the v-enter class is deleted. After the transition is over, Then delete v-enter-active, so as to realize the left and right sliding switch of the page, and there is no jam.
本实施例读取加载结果中包含的动画帧序列以及显示终端对应的屏幕刷新率;根据屏幕刷新率确定RequestAnimationFrame函数的执行周期;获取动画帧序列中每一帧动画被执行时对应的时间节点,根据执行周期以及执行时间节点确定每一执行周期对应的动画帧集;获取各动画帧集对应的执行时段,并根据执行时段确定动画元素对应的动画序列,有效的避免了动画元素被执行时卡顿、丢帧的情况,提高了用户体验。This embodiment reads the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal; determines the execution cycle of the RequestAnimationFrame function according to the screen refresh rate; obtains the corresponding time node when each frame of animation in the animation frame sequence is executed, Determine the animation frame set corresponding to each execution cycle according to the execution cycle and execution time node; obtain the execution time period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution time period, effectively avoiding the time when the animation element is executed. The situation of pauses and dropped frames improves the user experience.
此外,本申请实施例还提出一种存储介质,所述存储介质可以为非易失性可读存储介质。In addition, the embodiment of the present application also proposes a storage medium, and the storage medium may be a non-volatile readable storage medium.
所述存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上文所述的基于H5页面的动画显示方法的步骤。The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the animation display method based on the H5 page as described above are realized.
其中,该计算机可读指令被执行时所实现的方法可参照本申请基于H5页面的动画显示方法的各个实施例,此处不再赘述。For the method implemented when the computer-readable instruction is executed, refer to the various embodiments of the animation display method based on the H5 page of this application, which will not be repeated here.
参照图5,图5为本申请基于H5页面的动画显示装置第一实施例的结构框图。Referring to FIG. 5, FIG. 5 is a structural block diagram of the first embodiment of the animation display device based on the H5 page of this application.
如图5所示,本申请实施例提出的基于H5页面的动画显示装置包括: As shown in FIG. 5, the H5 page-based animation display device proposed in the embodiment of the present application includes:
信息获取模块501,用于获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;The information acquisition module 501 is used to acquire the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;
规则调整模块502,用于从所述设备信息中提取所述显示终端对应的终端标识;The rule adjustment module 502 is configured to extract the terminal identifier corresponding to the display terminal from the device information;
所述规则调整模块502,还用于将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;The rule adjustment module 502 is further configured to use the terminal identifier as a key object to search for a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;
所述规则调整模块502,还用于根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;The rule adjustment module 502 is further configured to adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information;
动画获取模块503,用于获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签,若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;The animation acquisition module 503 is used to acquire the element attributes of all page elements corresponding to the application to be displayed, detect whether there is an animation tag in the element attribute, and if it exists, determine that the page element contains an animation element. The element is preloaded, and the animation sequence corresponding to the animation element is determined according to the loading result;
动画执行模块504,用于根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation execution module 504 is configured to perform animation display on the animation element according to the target display information and the animation sequence.
本实施例根据设备信息对H5页面显示信息进行调整,以获取到符合当前终端页面的目标显示信息,同时在检测到待显示应用程序页面中存在动画元素时,根据调整好的目标显示信息以及动画元素的动画序列对动画进行显示,既保证了页面元素的显示效果,也能避免动画元素执行时卡顿、丢帧的情况。In this embodiment, the display information of the H5 page is adjusted according to the device information to obtain target display information that matches the current terminal page. At the same time, when an animation element is detected in the application page to be displayed, the adjusted target display information and animation The animation sequence of the element displays the animation, which not only guarantees the display effect of the page elements, but also avoids the stalling and frame loss during the execution of the animation elements.
基于本申请上述基于H5页面的动画显示装置第一实施例,提出本申请基于H5页面的动画显示装置的第二实施例。Based on the first embodiment of the animation display device based on the H5 page of the present application, a second embodiment of the animation display device based on the H5 page of the present application is proposed.
在本实施例中,所述规则调整模块502,还用于在未查找到所述键对象对应的目标页面调整策略时,从所述设备信息中读取所述显示设备对应的显示参数;根据所述显示参数确定H5页面对应的实际页面宽高比,并基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息。In this embodiment, the rule adjustment module 502 is further configured to read the display parameters corresponding to the display device from the device information when the target page adjustment strategy corresponding to the key object is not found; The display parameter determines the actual page aspect ratio corresponding to the H5 page, and adjusts the preset page aspect ratio in the H5 page display information based on the actual page aspect ratio to obtain target display information.
进一步地,所述动画获取模块503,用于对所述动画元素进行预加载,调用预设RequestAnimationFrame函数对所述动画元素预加载过程中的执行情况进行监听,以获取加载结果;读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列。Further, the animation acquisition module 503 is configured to preload the animation elements, call the preset RequestAnimationFrame function to monitor the execution of the animation element preloading process, to obtain the loading results; The animation frame sequence contained in the loading result is determined, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence.
进一步地,所述动画获取模块503,用于读取所述加载结果中包含的动画帧序列以及所述显示终端对应的屏幕刷新率;根据所述屏幕刷新率确定所述RequestAnimationFrame函数的执行周期;获取所述动画帧序列中每一帧动画被执行时对应的时间节点,根据所述执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集;获取各动画帧集对应的执行时段,并根据所述执行时段确定所述动画元素对应的动画序列。Further, the animation acquisition module 503 is configured to read the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal; determine the execution period of the RequestAnimationFrame function according to the screen refresh rate; Acquire the time node corresponding to each frame of animation in the animation frame sequence when it is executed, determine the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node; obtain the execution period corresponding to each animation frame set , And determine the animation sequence corresponding to the animation element according to the execution period.
进一步地,所述动画执行模块504,用于根据所述目标显示信息对所述页面元素进行显示;调用所述RequestAnimationFrame函数对所述动画元素的显示过程进行监听,以使得所述动画元素按照所述动画序列逐一进行显示。Further, the animation execution module 504 is configured to display the page element according to the target display information; call the RequestAnimationFrame function to monitor the display process of the animation element, so that the animation element is The animation sequence is displayed one by one.
本申请基于H5页面的动画显示装置的其他实施例或具体实现方式可参照上述各方法实施例,此处不再赘述。For other embodiments or specific implementations of the animation display device based on the H5 page of the present application, reference may be made to the foregoing method embodiments, which will not be repeated here.
Claims (20)
- 一种基于H5页面的动画显示方法,其中,所述方法包括: An animation display method based on H5 page, wherein the method includes:获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;Obtain the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;从所述设备信息中提取所述显示终端对应的终端标识;Extract the terminal identifier corresponding to the display terminal from the device information;将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;Using the terminal identifier as a key object to search for a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;Adjusting the display information of the H5 page according to the target page adjustment strategy to obtain target display information;获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签;Obtaining element attributes of all page elements corresponding to the application to be displayed, and detecting whether there are animation tags in the element attributes;若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;If it exists, determine that the page element contains an animation element, preload the animation element, and determine the animation sequence corresponding to the animation element according to the loading result;根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation element is animatedly displayed according to the target display information and the animation sequence.
- 如权利要求1所述的方法,其中,所述将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略的步骤之后,所述方法还包括:The method of claim 1, wherein after the step of using the terminal identifier as a key object to find the target page adjustment strategy corresponding to the key object in the pre-built key-value pair of the terminal identifier and the page adjustment strategy , The method further includes:在未查找到所述键对象对应的目标页面调整策略时,从所述设备信息中读取所述显示设备对应的显示参数;When the target page adjustment strategy corresponding to the key object is not found, read the display parameters corresponding to the display device from the device information;根据所述显示参数确定H5页面对应的实际页面宽高比,并基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息。The actual page aspect ratio corresponding to the H5 page is determined according to the display parameters, and the preset page aspect ratio in the H5 page display information is adjusted based on the actual page aspect ratio to obtain target display information.
- 如权利要求1所述的方法,其中,所述对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列的步骤,包括:The method of claim 1, wherein the step of preloading the animation element and determining the animation sequence corresponding to the animation element according to the loading result comprises:对所述动画元素进行预加载,调用预设RequestAnimationFrame函数对所述动画元素预加载过程中的执行情况进行监听,以获取加载结果;Preloading the animation element, calling a preset RequestAnimationFrame function to monitor the execution of the animation element preloading process to obtain the loading result;读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列。The animation frame sequence contained in the loading result is read, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence.
- 如权利要求3所述的方法,其中,所述读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列的步骤,包括:5. The method of claim 3, wherein the step of reading the animation frame sequence contained in the loading result and determining the animation sequence corresponding to the animation element according to the animation frame sequence comprises:读取所述加载结果中包含的动画帧序列以及所述显示终端对应的屏幕刷新率;Reading the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal;根据所述屏幕刷新率确定所述RequestAnimationFrame函数的执行周期;Determine the execution cycle of the RequestAnimationFrame function according to the screen refresh rate;获取所述动画帧序列中每一帧动画被执行时对应的时间节点,根据所述执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集;Acquiring the time node corresponding to each frame of animation in the animation frame sequence when being executed, and determining the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node;获取各动画帧集对应的执行时段,并根据所述执行时段确定所述动画元素对应的动画序列。Acquire the execution period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution period.
- 如权利要求4所述的方法,其中,所述根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示的步骤,包括:5. The method according to claim 4, wherein the step of displaying the animation elements according to the target display information and the animation sequence comprises:根据所述目标显示信息对所述页面元素进行显示;Displaying the page element according to the target display information;调用所述RequestAnimationFrame函数对所述动画元素的显示过程进行监听,以使得所述动画元素按照所述动画序列逐一进行显示。The RequestAnimationFrame function is called to monitor the display process of the animation elements, so that the animation elements are displayed one by one according to the animation sequence.
- 一种基于H5页面的动画显示装置,其中,所述装置包括:An animation display device based on H5 page, wherein the device includes:信息获取模块,用于获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;The information acquisition module is used to acquire the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;规则调整模块,用于从所述设备信息中提取所述显示终端对应的终端标识;A rule adjustment module, configured to extract a terminal identifier corresponding to the display terminal from the device information;所述规则调整模块,还用于将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;The rule adjustment module is further configured to use the terminal identifier as a key object to find a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;所述规则调整模块,还用于根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;The rule adjustment module is further configured to adjust the display information of the H5 page according to the target page adjustment strategy to obtain target display information;动画获取模块,用于获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签,若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;The animation acquisition module is used to acquire the element attributes of all page elements corresponding to the application to be displayed, detect whether there is an animation tag in the element attribute, and if it exists, determine that the page element contains an animation element. Preloading, and determining the animation sequence corresponding to the animation element according to the loading result;动画执行模块,用于根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation execution module is used to perform animation display on the animation element according to the target display information and the animation sequence.
- 如权利要求6所述的装置,其中,所述规则调整模块,还用于在未查找到所述键对象对应的目标页面调整策略时,从所述设备信息中读取所述显示设备对应的显示参数;根据所述显示参数确定H5页面对应的实际页面宽高比,并基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息。The apparatus according to claim 6, wherein the rule adjustment module is further configured to read the display device corresponding to the display device from the device information when the target page adjustment strategy corresponding to the key object is not found. Display parameters; determine the actual page aspect ratio corresponding to the H5 page according to the display parameters, and adjust the preset page aspect ratio in the H5 page display information based on the actual page aspect ratio to obtain the target display information.
- 如权利要求6所述的装置,其中,所述动画获取模块,还用于对所述动画元素进行预加载,调用预设RequestAnimationFrame函数对所述动画元素预加载过程中的执行情况进行监听,以获取加载结果;读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列。The device of claim 6, wherein the animation acquisition module is further configured to preload the animation elements, call a preset RequestAnimationFrame function to monitor the execution of the animation element preloading process, and Obtain the loading result; read the animation frame sequence contained in the loading result, and determine the animation sequence corresponding to the animation element according to the animation frame sequence.
- 如权利要求8所述的装置,其中,所述动画获取模块,还用于读取所述加载结果中包含的动画帧序列以及所述显示终端对应的屏幕刷新率;根据所述屏幕刷新率确定所述RequestAnimationFrame函数的执行周期;获取所述动画帧序列中每一帧动画被执行时对应的时间节点,根据所述执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集;获取各动画帧集对应的执行时段,并根据所述执行时段确定所述动画元素对应的动画序列。The device according to claim 8, wherein the animation acquisition module is further configured to read the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal; determine according to the screen refresh rate The execution cycle of the RequestAnimationFrame function; obtain the time node corresponding to each frame of the animation in the animation frame sequence when it is executed, and determine the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node; The execution period corresponding to each animation frame set, and the animation sequence corresponding to the animation element is determined according to the execution period.
- 如权利要求8所述的装置,其中,所述动画执行模块,还用于根据所述目标显示信息对所述页面元素进行显示;调用所述RequestAnimationFrame函数对所述动画元素的显示过程进行监听,以使得所述动画元素按照所述动画序列逐一进行显示。8. The device of claim 8, wherein the animation execution module is further configured to display the page elements according to the target display information; call the RequestAnimationFrame function to monitor the display process of the animation elements, So that the animation elements are displayed one by one according to the animation sequence.
- 一种基于H5页面的动画显示设备,其中,所述设备包括:存储器、处理器及存储在所述存储器上并可被所述处理器执行的计算机可读指令,其中所述计算机可读指令被所述处理器执行时,实现如下步骤:An animation display device based on H5 pages, wherein the device includes: a memory, a processor, and computer-readable instructions stored on the memory and executable by the processor, wherein the computer-readable instructions are When the processor executes, the following steps are implemented:获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;Obtain the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;从所述设备信息中提取所述显示终端对应的终端标识;Extract the terminal identifier corresponding to the display terminal from the device information;将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;Using the terminal identifier as a key object to search for a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;Adjusting the display information of the H5 page according to the target page adjustment strategy to obtain target display information;获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签;Obtaining element attributes of all page elements corresponding to the application to be displayed, and detecting whether there are animation tags in the element attributes;若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;If it exists, determine that the page element contains an animation element, preload the animation element, and determine the animation sequence corresponding to the animation element according to the loading result;根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation element is animatedly displayed according to the target display information and the animation sequence.
- 如权利要求11所述的设备,其中,所述将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略的步骤之后,所述方法还包括:The device according to claim 11, wherein after the step of using the terminal identifier as the key object to find the target page adjustment strategy corresponding to the key object in the pre-built key-value pair of the terminal identifier and the page adjustment strategy , The method further includes:在未查找到所述键对象对应的目标页面调整策略时,从所述设备信息中读取所述显示设备对应的显示参数;When the target page adjustment strategy corresponding to the key object is not found, read the display parameters corresponding to the display device from the device information;根据所述显示参数确定H5页面对应的实际页面宽高比,并基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息。The actual page aspect ratio corresponding to the H5 page is determined according to the display parameters, and the preset page aspect ratio in the H5 page display information is adjusted based on the actual page aspect ratio to obtain target display information.
- 如权利要求11所述的设备,其中,所述对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列的步骤,包括:11. The device of claim 11, wherein the step of preloading the animation element and determining the animation sequence corresponding to the animation element according to the loading result comprises:对所述动画元素进行预加载,调用预设RequestAnimationFrame函数对所述动画元素预加载过程中的执行情况进行监听,以获取加载结果;Preloading the animation element, calling a preset RequestAnimationFrame function to monitor the execution of the animation element preloading process to obtain the loading result;读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列。The animation frame sequence contained in the loading result is read, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence.
- 如权利要求13所述的设备,其中,所述读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列的步骤,包括:The device according to claim 13, wherein the step of reading the animation frame sequence contained in the loading result and determining the animation sequence corresponding to the animation element according to the animation frame sequence comprises:读取所述加载结果中包含的动画帧序列以及所述显示终端对应的屏幕刷新率;Reading the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal;根据所述屏幕刷新率确定所述RequestAnimationFrame函数的执行周期;Determine the execution cycle of the RequestAnimationFrame function according to the screen refresh rate;获取所述动画帧序列中每一帧动画被执行时对应的时间节点,根据所述执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集;Acquiring the time node corresponding to each frame of animation in the animation frame sequence when being executed, and determining the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node;获取各动画帧集对应的执行时段,并根据所述执行时段确定所述动画元素对应的动画序列。Acquire the execution period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution period.
- 如权利要求14所述的设备,其中,所述根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示的步骤,包括:The device according to claim 14, wherein the step of performing animation display on the animation element according to the target display information and the animation sequence comprises:根据所述目标显示信息对所述页面元素进行显示;Displaying the page element according to the target display information;调用所述RequestAnimationFrame函数对所述动画元素的显示过程进行监听,以使得所述动画元素按照所述动画序列逐一进行显示。The RequestAnimationFrame function is called to monitor the display process of the animation elements, so that the animation elements are displayed one by one according to the animation sequence.
- 一种存储介质,其中,所述存储介质上存储有计算机可读指令,其中所述计算机可读指令被处理器执行时,实现如下步骤:A storage medium, wherein computer readable instructions are stored on the storage medium, and when the computer readable instructions are executed by a processor, the following steps are implemented:获取显示终端的设备信息,以及对待显示应用程序进行显示的H5页面显示信息;Obtain the device information of the display terminal and the display information of the H5 page displayed by the application to be displayed;从所述设备信息中提取所述显示终端对应的终端标识;Extract the terminal identifier corresponding to the display terminal from the device information;将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略;Using the terminal identifier as a key object to search for a target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy;根据所述目标页面调整策略对所述H5页面显示信息进行调整,以获取目标显示信息;Adjusting the display information of the H5 page according to the target page adjustment strategy to obtain target display information;获取待显示应用程序对应的所有页面元素的元素属性,检测所述元素属性中是否存在动画标签;Obtaining element attributes of all page elements corresponding to the application to be displayed, and detecting whether there are animation tags in the element attributes;若存在,则判定所述页面元素中含有动画元素,对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列;If it exists, determine that the page element contains an animation element, preload the animation element, and determine the animation sequence corresponding to the animation element according to the loading result;根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示。The animation element is animatedly displayed according to the target display information and the animation sequence.
- 如权利要求16所述的存储介质,其中,所述将所述终端标识作为键对象在预先构建的终端标识和页面调整策略的键值对中查找所述键对象对应的目标页面调整策略的步骤之后,所述方法还包括:The storage medium according to claim 16, wherein the step of using the terminal identifier as a key object to find the target page adjustment strategy corresponding to the key object in a pre-built key-value pair of the terminal identifier and the page adjustment strategy After that, the method further includes:在未查找到所述键对象对应的目标页面调整策略时,从所述设备信息中读取所述显示设备对应的显示参数;When the target page adjustment strategy corresponding to the key object is not found, read the display parameters corresponding to the display device from the device information;根据所述显示参数确定H5页面对应的实际页面宽高比,并基于所述实际页面宽高比对所述H5页面显示信息中的预设页面宽高比进行调整,以获取目标显示信息。The actual page aspect ratio corresponding to the H5 page is determined according to the display parameters, and the preset page aspect ratio in the H5 page display information is adjusted based on the actual page aspect ratio to obtain target display information.
- 如权利要求16所述的存储介质,其中,所述对所述动画元素进行预加载,并根据加载结果确定所述动画元素对应的动画序列的步骤,包括:15. The storage medium of claim 16, wherein the step of preloading the animation element and determining the animation sequence corresponding to the animation element according to the loading result comprises:对所述动画元素进行预加载,调用预设RequestAnimationFrame函数对所述动画元素预加载过程中的执行情况进行监听,以获取加载结果;Preloading the animation element, calling a preset RequestAnimationFrame function to monitor the execution of the animation element preloading process to obtain the loading result;读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列。The animation frame sequence contained in the loading result is read, and the animation sequence corresponding to the animation element is determined according to the animation frame sequence.
- 如权利要求18所述的存储介质,其中,所述读取所述加载结果中包含的动画帧序列,根据所述动画帧序列确定所述动画元素对应的动画序列的步骤,包括:15. The storage medium of claim 18, wherein the step of reading the animation frame sequence contained in the loading result and determining the animation sequence corresponding to the animation element according to the animation frame sequence comprises:读取所述加载结果中包含的动画帧序列以及所述显示终端对应的屏幕刷新率;Reading the animation frame sequence contained in the loading result and the screen refresh rate corresponding to the display terminal;根据所述屏幕刷新率确定所述RequestAnimationFrame函数的执行周期;Determine the execution cycle of the RequestAnimationFrame function according to the screen refresh rate;获取所述动画帧序列中每一帧动画被执行时对应的时间节点,根据所述执行周期以及所述执行时间节点确定每一执行周期对应的动画帧集;Acquiring the time node corresponding to each frame of animation in the animation frame sequence when being executed, and determining the animation frame set corresponding to each execution cycle according to the execution cycle and the execution time node;获取各动画帧集对应的执行时段,并根据所述执行时段确定所述动画元素对应的动画序列。Acquire the execution period corresponding to each animation frame set, and determine the animation sequence corresponding to the animation element according to the execution period.
- 如权利要求19所述的存储介质,其中,所述根据所述目标显示信息和所述动画序列对所述动画元素进行动画显示的步骤,包括:22. The storage medium of claim 19, wherein the step of displaying the animation elements according to the target display information and the animation sequence comprises:根据所述目标显示信息对所述页面元素进行显示;Displaying the page element according to the target display information;调用所述RequestAnimationFrame函数对所述动画元素的显示过程进行监听,以使得所述动画元素按照所述动画序列逐一进行显示。 The RequestAnimationFrame function is called to monitor the display process of the animation elements, so that the animation elements are displayed one by one according to the animation sequence. To
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910426696.7A CN110297996B (en) | 2019-05-21 | 2019-05-21 | Animation display method, device, equipment and storage medium based on H5 page |
CN201910426696.7 | 2019-05-21 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020233056A1 true WO2020233056A1 (en) | 2020-11-26 |
Family
ID=68026961
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/120918 WO2020233056A1 (en) | 2019-05-21 | 2019-11-26 | H5 page-based animation display method, apparatus and device, and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110297996B (en) |
WO (1) | WO2020233056A1 (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112464125A (en) * | 2020-12-07 | 2021-03-09 | 北京小米松果电子有限公司 | Page display method and device, electronic equipment and storage medium |
CN112559137A (en) * | 2020-12-26 | 2021-03-26 | 北京国腾联信科技有限公司 | H5 container configuration method and device |
CN113050944A (en) * | 2021-04-21 | 2021-06-29 | 山东浪潮通软信息科技有限公司 | Front-end page generation method and device and computer readable medium |
CN113568550A (en) * | 2021-06-23 | 2021-10-29 | 深圳震有科技股份有限公司 | Animation display method and device based on animation component and terminal equipment |
CN113791962A (en) * | 2021-09-22 | 2021-12-14 | 北京字节跳动网络技术有限公司 | Method and device for determining frame rate of picture |
CN114491372A (en) * | 2022-02-08 | 2022-05-13 | 北京有竹居网络技术有限公司 | Page processing method and device, electronic equipment and storage medium |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110297996B (en) * | 2019-05-21 | 2023-09-01 | 深圳壹账通智能科技有限公司 | Animation display method, device, equipment and storage medium based on H5 page |
CN111611506A (en) * | 2020-05-22 | 2020-09-01 | 维沃移动通信有限公司 | Page loading method and device, electronic equipment and medium |
CN111984448B (en) * | 2020-08-14 | 2023-12-12 | 北京达佳互联信息技术有限公司 | Page calling method, device, equipment and storage medium |
CN112052416A (en) * | 2020-08-26 | 2020-12-08 | 腾讯科技(上海)有限公司 | Method and device for displaying image elements |
CN112328351A (en) * | 2020-11-25 | 2021-02-05 | Oppo广东移动通信有限公司 | Animation display method, animation display device and terminal equipment |
CN112947818A (en) * | 2021-02-07 | 2021-06-11 | 深圳市大梦龙途文化传播有限公司 | List-based information display method, system, device and storage medium |
CN113608809B (en) * | 2021-08-04 | 2023-07-18 | 北京百度网讯科技有限公司 | Layout method, device, equipment, storage medium and program product of components |
CN114090918A (en) * | 2021-10-25 | 2022-02-25 | 青岛海尔科技有限公司 | Parameter adjusting method, device, storage medium and electronic device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8675605B2 (en) * | 2011-06-02 | 2014-03-18 | Broadcom Corporation | Frequency hopping in license-exempt/shared bands |
CN106408629A (en) * | 2015-08-03 | 2017-02-15 | 博雅网络游戏开发(深圳)有限公司 | Animation rendering method and device |
CN107797801A (en) * | 2017-10-20 | 2018-03-13 | 江苏电力信息技术有限公司 | A kind of adaptation method based on a variety of interface of mobile terminal |
CN108196964A (en) * | 2017-12-29 | 2018-06-22 | 北京奇虎科技有限公司 | A kind of method and apparatus by Streams Module |
CN110297996A (en) * | 2019-05-21 | 2019-10-01 | 深圳壹账通智能科技有限公司 | Cartoon display method, device, equipment and storage medium based on the H5 page |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8366552B2 (en) * | 2002-12-10 | 2013-02-05 | Ol2, Inc. | System and method for multi-stream video compression |
CN106997348A (en) * | 2016-01-22 | 2017-08-01 | 腾讯科技(深圳)有限公司 | A kind of data method for drafting and device |
CN105912336A (en) * | 2016-04-11 | 2016-08-31 | 江苏中威科技软件系统有限公司 | Multi-screen adaptive method for mobile terminal front-end development |
CN108021666A (en) * | 2017-12-04 | 2018-05-11 | 北京百度网讯科技有限公司 | Page adaptation method and apparatus |
CN109002282B (en) * | 2018-07-26 | 2020-11-03 | 京东数字科技控股有限公司 | Method and device for realizing animation effect in web page development |
-
2019
- 2019-05-21 CN CN201910426696.7A patent/CN110297996B/en active Active
- 2019-11-26 WO PCT/CN2019/120918 patent/WO2020233056A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8675605B2 (en) * | 2011-06-02 | 2014-03-18 | Broadcom Corporation | Frequency hopping in license-exempt/shared bands |
CN106408629A (en) * | 2015-08-03 | 2017-02-15 | 博雅网络游戏开发(深圳)有限公司 | Animation rendering method and device |
CN107797801A (en) * | 2017-10-20 | 2018-03-13 | 江苏电力信息技术有限公司 | A kind of adaptation method based on a variety of interface of mobile terminal |
CN108196964A (en) * | 2017-12-29 | 2018-06-22 | 北京奇虎科技有限公司 | A kind of method and apparatus by Streams Module |
CN110297996A (en) * | 2019-05-21 | 2019-10-01 | 深圳壹账通智能科技有限公司 | Cartoon display method, device, equipment and storage medium based on the H5 page |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112464125A (en) * | 2020-12-07 | 2021-03-09 | 北京小米松果电子有限公司 | Page display method and device, electronic equipment and storage medium |
CN112559137A (en) * | 2020-12-26 | 2021-03-26 | 北京国腾联信科技有限公司 | H5 container configuration method and device |
CN113050944A (en) * | 2021-04-21 | 2021-06-29 | 山东浪潮通软信息科技有限公司 | Front-end page generation method and device and computer readable medium |
CN113050944B (en) * | 2021-04-21 | 2024-01-26 | 浪潮通用软件有限公司 | Front-end page generation method, device and computer readable medium |
CN113568550A (en) * | 2021-06-23 | 2021-10-29 | 深圳震有科技股份有限公司 | Animation display method and device based on animation component and terminal equipment |
CN113568550B (en) * | 2021-06-23 | 2024-01-05 | 深圳震有科技股份有限公司 | Animation display method and device based on animation component and terminal equipment |
CN113791962A (en) * | 2021-09-22 | 2021-12-14 | 北京字节跳动网络技术有限公司 | Method and device for determining frame rate of picture |
CN114491372A (en) * | 2022-02-08 | 2022-05-13 | 北京有竹居网络技术有限公司 | Page processing method and device, electronic equipment and storage medium |
CN114491372B (en) * | 2022-02-08 | 2023-09-08 | 北京有竹居网络技术有限公司 | Page processing method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110297996B (en) | 2023-09-01 |
CN110297996A (en) | 2019-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020233056A1 (en) | H5 page-based animation display method, apparatus and device, and storage medium | |
WO2017206456A1 (en) | Method and apparatus for presenting video image in video call | |
WO2015065006A1 (en) | Multimedia apparatus, online education system, and method for providing education content thereof | |
WO2013118988A1 (en) | Method and apparatus for interoperably performing services and system supporting the same | |
WO2018196617A1 (en) | Page loading method, system, server and terminal | |
WO2018205413A1 (en) | Audio volume adjustment method and terminal, and computer-readable storage medium | |
US10949490B2 (en) | Method and apparatus for displaying webpage content | |
EP3363192A1 (en) | Apparatus and method for providing dynamic panorama function | |
WO2017213439A1 (en) | Method and apparatus for generating image by using multi-sticker | |
WO2014027773A1 (en) | Device and method for providing responsive user interface, and recording medium readable by electronic device for same | |
WO2020077832A1 (en) | Cloud desktop access method, apparatus and device, and storage medium | |
WO2019037542A1 (en) | Television source preview method and apparatus, and computer-readable storage medium | |
WO2015064840A1 (en) | Server and method for providing student-tailored learning service | |
WO2012119498A1 (en) | Method, system and computer storage medium for displaying microblog wall | |
WO2018040174A1 (en) | Method and apparatus for setting preview resolution, and terminal | |
WO2016195219A1 (en) | Display device and method of controlling the same | |
WO2017052072A1 (en) | Image display apparatus and operation method therefor | |
WO2016090775A1 (en) | Synchronous operation method and system for short message data | |
WO2020237859A1 (en) | Data migration method employing nbd device, apparatus, device, and storage medium | |
WO2017160028A1 (en) | Object management and visualization using a computing device | |
WO2014126331A1 (en) | Display apparatus and control method thereof | |
WO2016114462A1 (en) | User interface method for video file block combination | |
CN113868575A (en) | Webpage same-screen method and system | |
JP5303534B2 (en) | Appearance information processing apparatus and method | |
JP6133460B1 (en) | Operation support system, operation support program, and operation support method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19929323 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 010322) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19929323 Country of ref document: EP Kind code of ref document: A1 |