Invention content
This specification embodiment provides generation method, device and the electronic equipment of animation in a kind of page, existing for solving
There is the technical issues of multiple animations are performed simultaneously caused page interim card in technology, improves the fluency of page presentation.
In a first aspect, this specification embodiment provides a kind of generation method of animation in the page, the method includes:
When carrying out page presentation, obtain described in the object content being demonstrated in the page and the object content and display
The distance between current display window of the page, the object content include picture and/or chart;
According to the distance, the generation frequency of the object content, the distance and generation frequency negative correlation are obtained;
According to the generation frequency, the corresponding animation of the object content is generated.
Optionally, the method further includes:
When the position of the current display window changes, obtains and do not complete animation and update the unfinished animation
The distance between corresponding Target Photo and the current display window;According to updated distance, updates described do not complete and move
The generation frequency of picture.
Optionally, according to the distance, the generation frequency of the object content is obtained, including:
λ/2 f=m
Wherein, f indicates that the generation frequency, λ indicate predeterminated frequency, and m indicates the distance, when the object content is in institute
State m=0 when in current display window.
Optionally, the method further includes:
When showing the object content in the current display window, the corresponding animation of the object content, institute are shown
The broadcasting frequency for stating animation is λ.
Optionally, before at a distance from the acquisition object content is between the current display window for showing the page,
The method further includes:
Judge whether the quantity of the object content is more than given threshold;
If so, executing the behaviour for obtaining the distance between the object content and the current display window of the display page
Make.
Second aspect, this specification embodiment also provide a kind of generation method of animation in the page, the method includes:
Browser obtains the object content being demonstrated in webpage when carrying out web page display, and the object content includes figure
Piece and/or chart;
Judge whether the quantity of the object content is more than given threshold;
If so, obtaining the object content and showing the distance between the current display window of the webpage;
According to the distance, the generation frequency of the object content, the distance and generation frequency negative correlation are obtained;
According to the generation frequency, the corresponding animation of the object content is generated.
Optionally, according to the distance, the generation frequency of the object content is obtained, including:
λ/2 f=m
Wherein, f indicates that the generation frequency, λ indicate predeterminated frequency, and m indicates the distance, when the object content is in institute
State m=0 when in current display window.
The third aspect, this specification embodiment provide a kind of generating means of animation in the page, and described device includes:
Acquiring unit, for when carrying out page presentation, acquisition to be demonstrated in the object content in the page and the target
The distance between the current display window for holding and showing the page, the object content include picture and/chart;
Computing unit, for according to the distance, obtaining the generation frequency of the object content, the distance and the life
At frequency negative correlation;
Generation unit, for according to the generation frequency, generating the corresponding animation of the object content.
Optionally, described device further includes:
Updating unit, for when the position of the current display window changes, obtaining unfinished animation and updating
The distance between the corresponding object content of unfinished animation and the current display window;
The generation unit is additionally operable to update the life of the Target Photo and/or object diagram according to updated distance
At frequency.
Optionally, the computing unit, which is used to be calculated according to following formula, obtains the distance:
λ/2 f=m
Wherein, f indicates that the generation frequency, λ indicate predeterminated frequency, and m indicates the distance, when the object content is in institute
State m=0 when in current display window.
Optionally, described device further includes:
Broadcast unit shows the object content when for showing the object content in the current display window
The broadcasting frequency of corresponding animation, the animation is λ.
Optionally, described device further includes:
Judging unit, at a distance from the acquisition object content between the current display window for showing the page
Before, judge whether the quantity of the object content is more than given threshold;
If so, executing the behaviour for obtaining the distance between the object content and the current display window of the display page
Make.
Fourth aspect, this specification embodiment provide a kind of generating means of animation in the page, and described device includes:
Acquisition module obtains the object content being demonstrated in webpage, the mesh for browser when carrying out web page display
It includes picture and/or chart to mark content;
Judgment module, for judging whether the quantity of the object content is more than given threshold;
The acquisition module is additionally operable to, in the case where the judging result is to be, obtain the object content and display institute
State the distance between the current display window of webpage;
Computing module, for according to the distance, obtaining the generation frequency of the object content, the distance and the life
At frequency negative correlation;
Generation module, for according to the generation frequency, generating the corresponding animation of the object content.
Optionally, the calculating single mode block, which is used to be calculated according to following formula, obtains the distance:
λ/2 f=m
Wherein, f indicates that the generation frequency, λ indicate predeterminated frequency, and m indicates the distance, when the object content is in institute
State m=0 when in current display window.
5th aspect, this specification embodiment provide a kind of computer readable storage medium, are stored thereon with computer journey
Sequence, the program realize following steps when being executed by processor:
When carrying out page presentation, obtains the object content being demonstrated in the page and the object content and show the page
The distance between the current display window in face, the object content include picture and/or chart;
According to the distance, the generation frequency of the object content, the distance and generation frequency negative correlation are obtained;
According to the generation frequency, the corresponding animation of the object content is generated.
6th aspect, this specification embodiment provide a kind of electronic equipment, include memory and one or one
Above program, one of them either more than one program be stored in memory and be configured to by one or one with
It includes the instruction for being operated below that upper processor, which executes the one or more programs,:
When carrying out page presentation, obtains the object content being demonstrated in the page and the object content and show the page
The distance between the current display window in face, the object content include picture and/or chart;
According to the distance, the generation frequency of the object content, the distance and generation frequency negative correlation are obtained;
According to the generation frequency, the corresponding animation of the object content is generated.
Said one in this specification embodiment or multiple technical solutions, at least have the following technical effect that:
This specification embodiment provides a kind of generation method of animation in the page, and when carrying out page presentation, acquisition is opened up
Show that the object content in the page includes between picture and/or chart and object content and the current display window for showing the page
Distance;According to the distance, the generation frequency of object content is obtained, distance and generation frequency are negatively correlated;According to corresponding generation
Frequency, generate the corresponding animation of object content, i.e. the generation frequency of animation with the increase at a distance from display window and gradually
It reduces, to reduce the performance consumption that the same time generates animation, is performed simultaneously to solve multiple animations in the prior art
The technical issues of caused page interim card, improves the fluency of page presentation.
Specific implementation mode
To keep the purpose, technical scheme and advantage of this specification embodiment clearer, below in conjunction with this specification reality
The attached drawing in example is applied, the technical solution in this specification embodiment is clearly and completely described, it is clear that described reality
It is this specification a part of the embodiment to apply example, instead of all the embodiments.The embodiment of base in this manual, this field are general
The every other embodiment that logical technical staff is obtained without creative efforts belongs to this specification protection
Range.
Generation method, device and the electronic equipment of animation in this specification embodiment provides a kind of page, for solving
Caused by multiple animations are performed simultaneously in the prior art the technical issues of page interim card, the fluency of page presentation is improved.
Below in conjunction with the accompanying drawings to the main realization principle of this specification embodiment technical solution, specific implementation mode and its right
The advantageous effect that should be able to reach is explained in detail.
The embodiment of the present application provides a kind of generation method of animation in the page, can be applied to browser, can also apply
Page presentation in general APP.Referring to FIG. 1, the generation method of animation includes in the page:
S110:When carrying out page presentation, obtains the object content being demonstrated in the page and the object content and show
Show the distance between the current display window of the page;
S120:According to the distance, the generation frequency of the object content is obtained, the distance is negative with the generation frequency
It is related;
S130:According to the generation frequency, the corresponding animation of the object content is generated.
Under normal conditions, can include in one or more target in a page in order to provide the bandwagon effect of the page
Appearance needs to carry out animation, common, including picture and/or chart need to carry out animation, to carry out animated show.Below to scheme
The generation method of above-mentioned animation is illustrated for piece, chart.
When carrying out page presentation, need first to generate corresponding picture, chart according to page data, and to picture, chart
Carry out animation.When carrying out animation to chart, execute S110 obtain be demonstrated picture in the page and/or chart and picture and/
Or respective the distance between the current display window m with the display page of chart.It can be according to the suffix name of picture, chart in the page
It identifies and obtains corresponding picture, chart, and the coordinate of the coordinate and current display serial ports according to picture, chart in the page obtains
Obtain distance m.
Wherein, it can be obtained by following either type when obtaining distance m.Mode one obtains picture or chart distance
The length distance L of the top margin of current display window is used as distance m.It is mode two, the height h of current display window is single as distance
Position, the ratio calculated between each picture and/or each chart length distance L and height h away from current display window take downwards
It is whole:M=floor (L/h), floor (x) they are downward bracket function, such as:Assuming that h=5cm, L=8cm, then m=floor
(L/h)=1.
Obtain picture and/or chart respectively between current display window at a distance from after, continue to execute S120 according to
The distance m obtained obtains the generation frequency of corresponding picture and/or chart, gradually reduces the picture remote apart from current display window
And/or the generation frequency of chart.The picture and/or chart remoter apart from current display window, subsequent time be demonstrated can
Energy property is with regard to smaller, and the requirement to the generation frequency of its animation is lower, and the generation frequency for reducing its animation advantageously reduces currently
Moment generates the performance consumption of animation.
Specifically, the generation frequency for obtaining each picture, chart can be calculated by following formula:
λ/2 f=m
Wherein, f indicates to generate frequency, and λ indicates predeterminated frequency, m indicate picture or chart and current display window away from
From the m=0 when picture and/or chart are in current display window.Frequency when λ can be according to animation play is set,
Such as:Smooth animation needs to be kept for 60 frames/second, then λ could be provided as 60 frames/second.The display diagram in current display window
When piece and/or chart, broadcasting frequency λ may be used to show each picture and/or the corresponding animation of chart, ensure page presentation
Process is smooth.
It is of course also possible to by formula f=λ/(2*m), alternatively, f=f1+*λ/2m(f1Indicate preset minimum generation frequency
Rate, such as 1 frame/second) to calculate to obtain generate frequency, as long as can make the picture remoter apart from current display window, chart it is dynamic
Picture generation frequency is lower, and the embodiment of the present application is not intended to limit the specific calculation for generating frequency.
After S120 gets each picture and/or the corresponding generation frequency of chart, S130 is executed according to each picture
And/or the generation frequency of chart, to the picture and/or chart progress animation in the page.Such as:Assuming that graph A distance in the page
The distance of current display window is 0, and distances of the chart B apart from current display window is that 2, λ is 60 frames/second, then graph A, B
It is respectively 60 frames/second, 15 frames/second to generate frequency, then the performance consumption that animation is generated in the synchronization page be then 75 frames/
Second, relative to 120 frames of the performance consumption/second for generating animation according to same frequency simultaneously, performance consumption substantially reduces.
The generation method of animation in the page that above-described embodiment provides, to the drop of the animation performance consumption of the page of more charts
Inefficient fruit is very prominent, can apply the generation method of animation in the page for more chart pages.Specifically, can be with
Before S120, judge whether the quantity of the picture and/or chart in current page is more than given threshold;If so, executing S120
Each picture and/or the distance between chart and current display window are obtained, and then executes S130 and is generated according to the distance of acquisition
Each picture and/or the corresponding animation of chart;If it is not, can then be carried out according to existing animation producing scheme.Such as:With one
For having 20 charts in the page, in the case that every 2 charts calculate acquiescence in a display window, the frequency of drafting is
20*60=1200 frames/second, after having used method provided in this embodiment, the frequency of drafting is:2*60+2*30+2*15+2*8+
2*4+2*2+8*1=246 frames/second, wherein minimum frequency of drawing is 1 frame/second, animation producing scheme provided in this embodiment with it is existing
There is technology to compare, expense is only the 1/5 of the prior art.
In specific implementation process, the page is when being shown, user's often dragging according to the demand of oneself frequently
The progress bar of current display window, to change the position of current display window.When the position of current display window changes,
It obtains and does not complete animation, and update and do not complete the distance between the corresponding object content of animation and current display window;According to more
Distance after new updates the generation frequency for not completing animation.Such as:Assuming that the t1 moment, picture A apart from current display window away from
From being 2, the generation frequency of animation is 15 frames/second, and t2 moment users change the position of current display window, picture A and change
The distance of current display window afterwards is 0, then the corresponding animation producing frequencies of update picture A are 60 frames/second, to be rapidly completed
Animation is simultaneously shown.
The generation method of animation in the page is completely illustrated with a complete example below:
Assuming that when browser carries out web page display, first, the object content being demonstrated in webpage is obtained.Next, it is determined that
Whether the quantity of object content is more than given threshold in webpage, and wherein given threshold can be most more than in current display window
The amount for the object content that can be accommodated such as > 3.Further, if the determination result is YES, then it obtains object content in webpage and shows
Show the distance between the current display window of webpage m;According to distance m, the generation frequency of each object content in the page is obtained, is made
It obtains distance m and generates frequency negative correlation, such as according to λ/2 formula f=mIt calculates to obtain and generates frequency, f indicates to generate frequency, and λ is indicated
Predeterminated frequency, the m=0 when object content is in current display window;And then according to the generation frequency of acquisition, generate each target
The corresponding animation of content.
Referring to FIG. 2, in a kind of page provided based on above-described embodiment animation generation method, the present embodiment is also corresponding
A kind of generating means of animation in the page are provided, which includes:
Acquiring unit 21, for when carrying out page presentation, obtaining object content and the target being demonstrated in the page
Content and the distance between the current display window for showing the page, the object content includes picture and/or chart;
Computing unit 22, for according to the distance, obtaining the generation frequency of the object content, the distance with it is described
It is negatively correlated to generate frequency;
Generation unit 23, for according to the generation frequency, generating the corresponding animation of the object content.
As an alternative embodiment, described device further includes:
Updating unit 24 is obtained and is not completed animation and more for when the position of the current display window changes
New the distance between the unfinished corresponding object content of animation and the current display window;
The generation unit 23 is additionally operable to according to updated distance, updates the Target Photo and/or object diagram
Generate frequency.
It wherein, can basis when computing unit 22 is at a distance from calculating picture and/or table are between current display window
Following formula carries out:
λ/2 f=m
Wherein, f indicates that the generation frequency, λ indicate predeterminated frequency, and m indicates the distance, when the object content is in institute
State m=0 when in current display window.
As an alternative embodiment, described device can also include:
Broadcast unit 25 is shown when for showing the object content in the current display window in the target
Hold corresponding animation, the broadcasting frequency of the animation is λ.
As an alternative embodiment, described device can also include:
Judging unit 26, for obtain between the object content and the current display window of the display page away from
From before, judge the object content quantity whether be more than given threshold;The object content and display are obtained if so, executing
The operation of the distance between the current display window of the page.
Referring to FIG. 3, the also corresponding generating means for providing animation in another page of this specification embodiment, described device
Including:
Acquisition module 31 obtains the object content being demonstrated in webpage for browser when carrying out web page display, described
Object content includes picture and/or chart;
Judgment module 32, for judging whether the quantity of the object content is more than given threshold;
The acquisition module 31 is additionally operable to, in the case where the judging result is to be, obtain the object content and display
The distance between current display window of the webpage;
Computing module 33, for according to the distance, obtaining the generation frequency of the object content, the distance with it is described
It is negatively correlated to generate frequency;
Generation module 34, for according to the generation frequency, generating the corresponding animation of the object content.
Wherein, the computing module 33, which is specifically used for being calculated according to following formula, obtains the distance:
λ/2 f=m
Wherein, f indicates that the generation frequency, λ indicate predeterminated frequency, and m indicates the distance, when the object content is in institute
State m=0 when in current display window.
About the device in above-described embodiment, wherein each unit executes the concrete mode of operation in method
It is described in detail in embodiment, no longer elaborates herein.
Said one in this specification embodiment or multiple technical solutions, at least have the following technical effect that:
This specification embodiment obtains the object content and object content being demonstrated in the page when carrying out page presentation
With the distance between the current display window of the display page;According to the distance, the generation frequency of object content, distance and life are obtained
At frequency negative correlation;According to corresponding generation frequency, generate the corresponding animation of object content, i.e., the generation frequency of animation with
The increase of the distance of display window and gradually reduce, to reduce the performance consumption that same time generates animation, to solve
Caused by multiple animations are performed simultaneously in the prior art the technical issues of page interim card, the fluency of page presentation is improved.
Referring to FIG. 4, being that a kind of electronics for realizing data query method shown according to an exemplary embodiment is set
Standby 700 block diagram.For example, electronic equipment 700 can be computer, and database console, tablet device, personal digital assistant
Deng.
With reference to Fig. 4, electronic equipment 700 may include following one or more components:Processing component 702, memory 704,
Power supply module 706, multimedia component 708, the interface 710 and communication component 712 of input/output (I/O).
The integrated operation of 702 usual control electronics 700 of processing component is such as grasped with display, data communication, and record
Make associated operation.Processing element 702 may include one or more processors 720 to execute instruction, above-mentioned to complete
The all or part of step of method.In addition, processing component 702 may include one or more modules, it is convenient for 702 He of processing component
Interaction between other assemblies.
Memory 704 is configured as storing various types of data to support the operation in equipment 700.These data are shown
Example includes the instruction for any application program or method that are operated on electronic equipment 700, contact data, telephone directory number
According to, message, picture, video etc..Memory 704 can by any kind of volatibility or non-volatile memory device or they
Combination realize, such as static RAM (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable
Programmable read only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, quick flashing
Memory, disk or CD.
Power supply module 706 provides electric power for the various assemblies of electronic equipment 700.Power supply module 706 may include power supply pipe
Reason system, one or more power supplys and other generated with for electronic equipment 700, management and the associated component of distribution electric power.
I/O interfaces 710 provide interface between processing component 702 and peripheral interface module, and above-mentioned peripheral interface module can
To be keyboard, click wheel, button etc..These buttons may include but be not limited to:Home button, volume button, start button and lock
Determine button.
Communication component 712 is configured to facilitate the communication of wired or wireless way between electronic equipment 700 and other equipment.
Electronic equipment 700 can access the wireless network based on communication standard, such as WiFi, 2G or 3G or combination thereof.Show at one
In example property embodiment, communication component 712 receives broadcast singal or broadcast from external broadcasting management system via broadcast channel
Relevant information.In one exemplary embodiment, the communication component 712 further includes near-field communication (NFC) module, short to promote
Cheng Tongxin.For example, radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band can be based in NFC module
(UWB) technology, bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, electronic equipment 700 can be by one or more application application-specific integrated circuit (ASIC), number
Word signal processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array
(FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing the above method.
In the exemplary embodiment, it includes the non-transitorycomputer readable storage medium instructed, example to additionally provide a kind of
Such as include the memory 704 of instruction, above-metioned instruction can be executed by the processor 720 of electronic equipment 700 to complete the above method.Example
Such as, the non-transitorycomputer readable storage medium can be ROM, it is random access memory (RAM), CD-ROM, tape, soft
Disk and optical data storage devices etc..
A kind of non-transitorycomputer readable storage medium, when the instruction in the storage medium is by the processing of mobile terminal
When device executes so that electronic equipment is able to carry out a kind of generation method of animation in the page, the method includes:
When carrying out page presentation, obtains the object content being demonstrated in the page and the object content and show the page
The distance between the current display window in face, the object content include picture and/or chart;According to the distance, institute is obtained
State the generation frequency of object content, the distance and generation frequency negative correlation;According to the generation frequency, the mesh is generated
Mark the corresponding animation of content.
It should be understood that the invention is not limited in the precision architectures for being described above and being shown in the accompanying drawings, and
And various modifications and changes may be made without departing from the scope thereof.The scope of the present invention is limited only by the attached claims
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention.