CN110517341A - The physics animation effect implementation method and device of view - Google Patents

The physics animation effect implementation method and device of view Download PDF

Info

Publication number
CN110517341A
CN110517341A CN201810488881.4A CN201810488881A CN110517341A CN 110517341 A CN110517341 A CN 110517341A CN 201810488881 A CN201810488881 A CN 201810488881A CN 110517341 A CN110517341 A CN 110517341A
Authority
CN
China
Prior art keywords
rigid body
state
interaction
interactive
original state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810488881.4A
Other languages
Chinese (zh)
Other versions
CN110517341B (en
Inventor
白宏伟
马千里
刘卫程
贺浩
牛之奎
周敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810488881.4A priority Critical patent/CN110517341B/en
Publication of CN110517341A publication Critical patent/CN110517341A/en
Application granted granted Critical
Publication of CN110517341B publication Critical patent/CN110517341B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/802D [Two Dimensional] animation, e.g. using sprites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2213/00Indexing scheme for animation
    • G06T2213/12Rule based animation

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses the physics animation effect implementation methods and device of a kind of view, are related to field of computer technology.One specific embodiment of this method comprises determining that whether the new boundary after interactive rigid body changes according to preset rules exceeds screen border;If so, the rigid body of the mobile interaction, so that the rigid body is located in screen border on the new boundary after changing according to preset rules;It determines that the rigid body of interaction changes according to preset rules whether to collide with the rigid body of surrounding later;If so, the rigid body that the mobile rigid body with the interaction collides, and change interactive rigid body according to preset rules, to realize physics animation effect.The embodiment can simulate the flashing of itself (amplification and diminution) of multiple rigid bodies, amplification can be focused when interacting with user, and the animation effect mutually collided, squeezed with periphery rigid body is realized in the process, and these effects meet the expection of user's physical knowledge.

Description

The physics animation effect implementation method and device of view
Technical field
The present invention relates to field of computer technology more particularly to the physics animation effect implementation methods and dress of a kind of view It sets.
Background technique
Animation effect is always very important part in human-computer interaction, animation different from inflexible, lofty display effect The addition of effect allows interaction to become more friendly, reasonably user can be allowed to obtain more pleasant usage experience using animation.
It is with Android (operating system of freedom and open source code based on Linux, be mainly used for mobile device) Example, Android itself support a variety of animation effects, for example, change in location, along the overturning of a certain reference axis, shape scaling and color Variation etc..(box2d is one rigid for simulating 2D to certain third-party physical engine such as jbox2d for supporting Android platform The C++ engine of body object, it is a powerful open source physics game engine, for simulating the movement of 2D Rigid Bodies and collision, Jbox2d is the box2d of java version) can support the definition (such as round and polygon) of most of rigid body, the realization of gravity, The physical characteristics such as collision, speed and acceleration between object calculating etc..
In realizing process of the present invention, at least there are the following problems in the prior art for inventor's discovery:
The collision between object is not supported in the animation of Android itself, and the animation effect of each object is only itself The change of shape, also without the concept of physical world and boundary;
The physical engines such as Jbox2d are mostly the open source solution that individual developer provides, and there is no complete and lasting skills Art supports that the original design intention of these physical engines is mostly to realize building for gaming world.In addition, jbox2d engine is for more There are more problem, (round rigid body radius is certain, therefore the collision calculation of round rigid body for the more complicated rigid body interaction such as side shape When institute it is shaped in it is simplest), it may appear that calculate mistake situations such as occur, poor user experience.
Summary of the invention
In view of this, the embodiment of the present invention provides the physics animation effect implementation method and device of a kind of view, Neng Goumo The flashing of itself (amplification and diminution) for intending multiple rigid bodies, can focus amplification, and realize in the process when interacting with user The animation effect mutually collided, squeezed with periphery rigid body, and these effects meet the expection of user's physical knowledge.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of physics animation effect of view is provided Fruit implementation method, comprising: determine whether the new boundary after the rigid body of interaction changes according to preset rules exceeds screen border;If It is then to move the rigid body of the interaction, so that new boundary of the rigid body after changing according to preset rules is located at screen side In boundary;It determines that the rigid body of interaction changes according to preset rules whether to collide with the rigid body of surrounding later;If so, it is mobile with The rigid body that the rigid body of the interaction collides, and change interactive rigid body according to preset rules, to realize that physics animation is imitated Fruit.
Optionally, the preset rules include: that the area of interactive rigid body is become N times of original state, wherein N is Positive number greater than 1.
Optionally, the method also includes: state after interactive rigid body changes according to preset rules keeps default After time, the rigid body of the interaction is reverted into original state.
Whether collide packet with the rigid body of surrounding later optionally it is determined that the rigid body of interaction changes according to preset rules It includes: determining the coordinate value on the new boundary after the rigid body of interaction changes according to preset rules;It determines around the rigid body of the interaction The coordinate value on the boundary of rigid body;According to coordinate value, determine the rigid body of interaction according to preset rules change later whether with surrounding Rigid body collides.
Optionally, the method also includes: when there is no interaction rigid body when, all rigid bodies are according to the period 1 initial It is converted between state and deflated state;When there is the rigid body of interaction, all rigid bodies are according to second in addition to interactive rigid body Period converts between original state and deflated state, wherein second round is greater than the period 1.
Optionally, the transformation between original state and deflated state is continuous.
Optionally, it includes: rigid body in initial shape that rigid body converts between original state and deflated state according to the period 1 State is kept for t1 seconds, becomes deflated state from original state by t2 seconds, is kept for t3 seconds in deflated state, by t4 seconds by diminution shape State becomes original state;
It includes: that rigid body is kept in original state that rigid body converts between original state and deflated state according to second round T1 ' the second becomes deflated state from original state by the t2 ' second, is kept for the t3 ' second in deflated state, by the t4 ' second by deflated state Become original state.
Optionally, when there is the rigid body of interaction, all rigid bodies are according to second round first in addition to interactive rigid body It is converted between beginning state and deflated state and includes:
When determining that the rigid body of interaction is triggered interactive, the state of each rigid body in addition to interactive rigid body and time Stamp, wherein the timestamp is used to record the time that variation is reduced in the triggering of rigid body the last time;
According to first time, the state and timestamp, the first delay of each rigid body is determined, wherein when first Between refer to that interactive rigid body is triggered the interactive time;
It is delayed according to first, after the first delay, each rigid body in addition to interactive rigid body is according to the Two cycles convert between original state and deflated state;
When there is no the rigid body of interaction, all rigid bodies convert between original state and deflated state according to the period 1 Include:
The rigid body of interaction when reverting to original state by the state after changing according to preset rules is determined, except interactive rigid The state and timestamp of each rigid body except body, wherein the timestamp is reduced for recording the triggering of rigid body the last time The time of variation;
According to the second time, the state and timestamp, the second delay of each rigid body is determined, wherein when second Between when referring to that interactive rigid body reverts to original state by the state after changing according to preset rules;
It is delayed according to second, after the second delay, each rigid body in addition to interactive rigid body is according to the One period converted between original state and deflated state.
Optionally, when interactive rigid body is triggered interactive, and the rigid body in addition to interactive rigid body is in deflated state When, first delay determines according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When interactive rigid body is triggered interaction constantly, and the rigid body in addition to interactive rigid body is in original state, institute The first delay is stated to determine according to the following formula (2-1) or (2-2):
Td=Ta-(ta- T1) if Ta≥(ta-T1) (2-1)
Td=Tb-(ta- T1) if Ta< (ta-T1) (2-2)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and remove the rigid of interaction When rigid body except body is in deflated state, second delay determines according to the following formula (3):
Td'=(t2 '+t3 ')-(tb-T1) (3)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and remove the rigid of interaction When rigid body except body is in original state, second delay determines according to the following formula (4):
Td'=Tb-(tb-T1) (4)
Wherein, TdIndicate the first delay, Td' indicate the second delay, taIt indicates at the first time, tbIndicate the second time, T1 table Show timestamp, TaIndicate period 1, TbIndicate second round.
Optionally, the shape of rigid body is rectangle.
To achieve the above object, according to another aspect of an embodiment of the present invention, a kind of physics animation effect of view is provided Fruit realization device, comprising: new boundary determining module, the new boundary after changing for determining interactive rigid body according to preset rules Whether screen border is exceeded;Interaction mobile module, for moving the rigid body of the interaction, so that the rigid body is according to default rule New boundary after then changing is located in screen border;Determining module is collided, for determining the rigid body of interaction according to preset rules Whether variation collides later with the rigid body of surrounding;Effect realizes module, touches for the mobile rigid body with the interaction The rigid body hit, and change interactive rigid body according to default rule, to realize physics animation effect.
Optionally, the preset rules include: that the area of interactive rigid body is become N times of original state, and N is greater than 1 Positive number.
Optionally, described device further includes recovery module, for after interactive rigid body changes according to preset rules After state keeps preset time, the rigid body of the interaction is reverted into original state.
Optionally, the collision determining module is also used to: being determined new after the rigid body of interaction changes according to preset rules The coordinate value on boundary;Determine the coordinate value on the boundary of the rigid body around the rigid body of the interaction;According to coordinate value, the rigid of interaction is determined Body changes whether collide with the rigid body of surrounding later according to preset rules.
Optionally, the effect realizes that module is also used to: when there is no the rigid body of interaction, all rigid bodies were according to first week Phase converts between original state and deflated state;When there is the rigid body of interaction, all rigid bodies in addition to interactive rigid body It is converted between original state and deflated state according to second round, wherein second round is greater than the period 1.
Optionally, the transformation between original state and deflated state is continuous.
Optionally, it includes: the rigid body first that rigid body converts between original state and deflated state according to the period 1 Beginning state is kept for t1 seconds, becomes deflated state from original state by t2 seconds, is kept for t3 seconds in deflated state, by t4 seconds by contracting Small state becomes original state;It includes: the rigid body that rigid body converts between original state and deflated state according to second round It is kept for the t1 ' second in original state, deflated state is become from original state by the t2 ' second, kept for the t3 ' second in deflated state, passed through T4 ' the second becomes original state from deflated state.
Optionally, the effect realizes that module is also used to:
When determining that the rigid body of interaction is triggered interactive, the state of each rigid body in addition to interactive rigid body and time Stamp, wherein the timestamp is used to record the time that variation is reduced in the triggering of rigid body the last time;
According to first time, the state and timestamp, the first delay of each rigid body is determined, wherein when first Between refer to that interactive rigid body is triggered the interactive time;
It is delayed according to first, after the first delay, each rigid body in addition to interactive rigid body is according to the Two cycles convert between original state and deflated state;And
The rigid body of interaction when reverting to original state by the state after changing according to preset rules is determined, except interactive rigid The state and timestamp of each rigid body except body, wherein the timestamp is reduced for recording the triggering of rigid body the last time The time of variation;
According to the second time, the state and timestamp, the second delay of each rigid body is determined, wherein when second Between when referring to that interactive rigid body reverts to original state by the state after changing according to preset rules;
It is delayed according to second, after the second delay, each rigid body in addition to interactive rigid body is according to the One period converted between original state and deflated state.
Optionally, when interactive rigid body is triggered interactive, and the rigid body in addition to interactive rigid body is in deflated state When, first delay determines according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When interactive rigid body is triggered interaction constantly, and the rigid body in addition to interactive rigid body is in original state, institute The first delay is stated to determine according to the following formula (2-1) or (2-2):
Td=Ta-(ta- T1) if Ta≥(ta-T1) (2-1)
Td=Tb-(ta- T1) if Ta< (ta-T1) (2-2)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and remove the rigid of interaction When rigid body except body is in deflated state, second delay determines according to the following formula (3):
Td'=(t2 '+t3 ')-(tb-T1) (3)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and remove the rigid of interaction When rigid body except body is in original state, second delay determines according to the following formula (4):
Td'=Tb-(tb-T1) (4)
Wherein, TdIndicate the first delay, Td' indicate the second delay, taIt indicates at the first time, tbIndicate the second time, T1 table Show timestamp, TaIndicate period 1, TbIndicate second round.
Optionally, the shape of rigid body is rectangle.
To achieve the above object, another aspect according to an embodiment of the present invention, provides a kind of electronic equipment, comprising: one A or multiple processors;Storage device, for storing one or more programs, when one or more of programs are one Or multiple processors execute, so that one or more of processors realize the physics animation effect of the view of the embodiment of the present invention Implementation method.
To achieve the above object, according to an embodiment of the present invention in another aspect, provide a kind of computer-readable medium, On be stored with computer program, when described program is executed by processor realize the embodiment of the present invention view physics animation effect Implementation method.
One embodiment in foregoing invention have the following advantages that or the utility model has the advantages that because using determine interaction rigid body by Whether can exceed screen border according to the new boundary after preset rules variation;If so, the rigid body of the mobile interaction, so that institute Rigid body is stated to be located in screen border on the new boundary after changing according to preset rules;Determine the rigid body of interaction according to preset rules Whether variation collides later with the rigid body of surrounding;If so, the rigid body that the mobile rigid body with the interaction collides, and Change interactive rigid body according to preset rules, to realize the technological means of physics animation effect, so handing over when interacting with user Mutual rigid body can focus amplification, and realize the animation effect mutually collided, squeezed with periphery rigid body in the process, and this A little effects meet the expection of user's physical knowledge.Therefore the realization of the physics animation effect of view provided by the embodiment of the present invention Method can simulate the flashing of itself (amplification and the contracting of multiple rigid bodies in the case where not depending on any third party's physical engine It is small), and the physics animation effect of Rigid Body Collision is realized, and simplify clash logic on the basis of guaranteeing animation effect; And the embodiment of the present invention can be used and assert and verify to each logical point, ensure that the correctness of logic and timing, keeps away There is unpredictable exception after exempting from animation long-play, also ensures when user has new demand to animation effect, it can Neatly to configure and modify according to new demand;The dynamic in each rigid body translation period is calculated, also ensures that each rigid body becomes That changes is logically independent, therefore the transformation of all rigid bodies is independent at random, and the user experience is improved.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the schematic diagram of the main flow of the physics animation effect implementation method of view according to an embodiment of the present invention;
Fig. 2 be the physics animation effect implementation method of view according to an embodiment of the present invention rigid body according to the period 1 into The timing diagram of row periodic flicker;
Fig. 3 is the timing of the rigid body flashing of the physics animation effect implementation method of view according to an embodiment of the invention Figure;
Fig. 4-1 be the physics animation effect implementation method of view according to another embodiment of the present invention rigid body flashing when Sequence figure;
Fig. 4-2 be the physics animation effect implementation method of the view of another embodiment according to the present invention rigid body flashing when Sequence figure;
Fig. 5 is the timing of the rigid body flashing of the physics animation effect implementation method of the view of another embodiment according to the present invention Figure;
Fig. 6 is the timing of the rigid body flashing of the physics animation effect implementation method of view according to yet another embodiment of the invention Figure;
Fig. 7 is the schematic diagram of the main modular of the physics animation effect realization device of view according to an embodiment of the present invention;
Fig. 8 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 9 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 1 is the schematic diagram of the main flow of the physics animation effect implementation method of view according to an embodiment of the present invention, As shown in Figure 1, this method comprises:
Step S101: determine whether the new boundary after the rigid body of interaction changes according to preset rules exceeds screen border;
Step S102: if so, the rigid body of the mobile interaction, so that the rigid body according to preset rules after changing New boundary be located in screen border;
Step S103: it determines that the rigid body of interaction changes according to preset rules and whether collides later with the rigid body of surrounding;
Step S104: if so, the rigid body that the mobile rigid body with the interaction collides, and make interactive rigid body according to Preset rules variation, to realize physics animation effect.
In embodiments of the present invention, the rigid body of multiple carrying commodity pictures shows on the screen of a display device, wherein The quantity of rigid body and position can be according to application demand flexible settings.The rigid body refers to ideal rigid body (rigid body), in object It manages in the world, ideal rigid body is a kind of finite size, can ignore the solid of deformation.Interaction can be screen taps, be clicked Rigid body then be known as interaction rigid body.In the present embodiment, the shape of the rigid body is rectangle, then the rigid body is properly termed as rectangle Rigid body, the boundary of rigid body refer to four sides of rigid body, can use coordinate value expression.
For step S101, preset rules may include: that the area of interactive rigid body is become N times of original state, In, N is the positive number greater than 1, such as N=2 or N=2.3.State after interactive rigid body becomes larger according to preset rules can claim For the interactive state that becomes larger.
Determine whether new boundary after the rigid body of interaction changes according to preset rules can beyond the process of screen border To comprise the following processes:
The coordinate value on the new boundary after the rigid body of interaction changes according to preset rules is determined, to determine the first range;
The coordinate value of screen border is determined, to determine the second range;
Judge whether the first range exceeds the second range;
If so, the new boundary after the rigid body of determining interaction changes according to preset rules can exceed screen border;If it is not, Then determine the new boundary after the rigid body of interaction changes according to preset rules without departing from screen border.
For step S102, the new boundary after rigid body for determining interaction changes according to preset rules can exceed screen side When boundary, then the rigid body of the interaction is moved, so that its new boundary after changing according to preset rules is located within screen border.Tool Body, if the rigid body of interaction change according to preset rules after top beyond screen border, can in a reverse direction i.e. to The rigid body of the lower movement interaction;If the left side after the rigid body of interaction changes according to preset rules exceeds screen border, to the right The rigid body of the mobile interaction;Other both sides are similar, and details are not described herein by the present invention.Further, when new boundary exceeds screen side M centimetres of boundary can then move M centimetres in the opposite direction, wherein M is positive number.
When determine interaction rigid body change according to preset rules after new boundary without departing from screen border when, then skip Step S102 executes step S103.
For step S103, determines that the rigid body of interaction changes according to preset rules and whether touch later with the rigid body of surrounding The process hit may include:
Determine the coordinate value on the new boundary after the rigid body of interaction changes according to preset rules;
Determine the coordinate value on the boundary of the rigid body around the rigid body of the interaction;
According to coordinate value, determines that the rigid body of interaction changes according to preset rules and whether touch later with the rigid body of surrounding It hits.
In the present embodiment, all rigid bodies are all rectangle rigid bodies, then can by judgement interaction rigid body it is upper and lower, left, Whether the rigid body of right four direction with it has conflicting for boundary, with determine the rigid body of interaction according to preset rules change later whether It collides with the rigid body of surrounding.
For step S104, when there is the rigid body to collide with the rigid body interacted, then moves and sent out with the rigid body interacted The rigid body of raw collision, and change interactive rigid body according to preset rules, to realize physics animation effect.
In the present embodiment, interactive rigid body is when interaction becomes larger, if the new boundary after its interaction becomes larger does not surpass Screen border out, and have with the rigid body of surrounding and conflict, then interactive rigid body is not moved, i.e., does not move the centre bit of interactive rigid body It sets, and mobile surrounding rigid body.The interaction for example, rigid body 1 is triggered, interaction become larger after rigid body 1 new boundary without departing from Screen border;The new boundary of rigid body 1 and the boundary of the rigid body 2 above it clash, then rigid body 2 is marked using itself as judgement Standard, how much calculating will not just collide with the rigid body 1 of lower section if moving up.In the present embodiment, it may not be necessary to which judgement is rigid Whether the boundary of body 2 after movement can exceed screen border.
In an alternate embodiment of the invention, state after interactive rigid body changes according to preset rules keep preset time it Afterwards, i.e., interaction is become larger into rigid body in the interactive state holding preset time that becomes larger, is then first by the rigid body reply that the interaction becomes larger Beginning state.Wherein, preset time can be according to application demand flexible setting.In the present embodiment, under preset time can be equal to Second round in text.
After the rigid body that interaction becomes larger returns to original state, if position movement occurs when interaction becomes larger for rigid body, Return it into initial position;If movement also has occurred in surrounding rigid body, the rigid body for occurring mobile is moved back to initial position.
The physics animation effect implementation method of the view of the embodiment of the present invention, when interacting with user, interactive rigid body can Amplification is focused, and realizes the animation effect mutually collided, squeezed with periphery rigid body in the process, and these effects meet The expection of user's physical knowledge.
In an alternate embodiment of the invention, the method also includes:
When there is no the rigid body of interaction, all rigid bodies become between original state and deflated state according to the period 1 It changes;
When exist interaction rigid body when, in addition to interactive rigid body all rigid bodies according to second round original state with It is converted between deflated state, wherein second round is greater than the period 1.
Wherein, the transformation between original state and deflated state is continuous.
It includes: rigid body in original state holding t1 that rigid body converts between original state and deflated state according to the period 1 Second, deflated state is become from original state by t2 seconds, is kept for t3 seconds in deflated state, was become just by t4 seconds from deflated state Beginning state;
It includes: that rigid body is kept in original state that rigid body converts between original state and deflated state according to second round T1 ' the second becomes deflated state from original state by the t2 ' second, is kept for the t3 ' second in deflated state, by the t4 ' second by deflated state Become original state.
In an alternate embodiment of the invention, the primary attribute animation mechanism of Android can be used to realize, by amplifying, reducing And the transformation of the variation completion status of transparent value.And it can use the state change of timed task control rigid body, wherein attribute Animation refers to the animation interface that Android is provided, and can complete view (view) some attribute (position within one section of specified time Set, size, transparent value etc.) gradual change.Transparent value is that 1 expression is normal visible (can block subsequent background completely);Transparent value is 0 Indicate fully transparent;Transparent value indicates partially transparent between 1 and 0, and transparent value is bigger, opaquer.Timed task refers to The timer for the certain movements of periodic triggers that can be created by developer in Android, can set the starting time, week Phase and the movement needed to be implemented.Once starting, if do not intervened, meeting circular flow always is gone down.
Specifically, all rigid bodies in original state and reduce shape according to the period 1 when there is no the rigid body of interaction It is converted between state, i.e., all rigid bodies carry out periodic flicker according to the period 1, and follow following rule: rigid body is in initial shape State keeps t1 seconds (such as 2 seconds), becomes deflated state from original state by t2 seconds (such as 0.5 second), keeps in deflated state T3 seconds (such as 0.5 second), original state is become from deflated state by t4 seconds (such as 0.5 second).That is period 1 Ta=3.5s. The initial time that all rigid bodies carry out state transformation is random (i.e. all rigid body flashing initial times are random), and can be in interaction After can dynamically change, a kind of animation effect flashed at random can be shown to user in this way, improves user experience.
Specifically, between t20 to t21, rigid body is in original state with reference to Fig. 2, triggers and reduce in t21 moment rigid body Variation (i.e. animation is reduced in rigid body triggering), between t21 to t22, rigid body, which reduces, becomes deflated state, In from original state Between t22 to t23, rigid body keeps deflated state, and between t23 to t24, rigid body becomes original state from deflated state.Wherein, T21-t20=t1, t22-t21=t2, t23-t22=t3, t24-t23=t1.Between t21 to t22 between t23 to t24 There is animation, the picture carried between t22 to t23 between t20 to t21 remains unchanged.In the picture of t22 moment rigid body carrying It can switch over.
When there is the rigid body of interaction, interactive rigid body becomes larger according to preset rules, such as becomes initial shape by 0.5 second 2 times of state, and show additional information (such as commodity details and purchase two dimensional code);All rigid bodies are pressed in addition to interactive rigid body It is converted between original state and deflated state according to second round, i.e., rigid body all in addition to interactive rigid body is according to second week Phase carries out periodic flicker, and follows following rule: rigid body keeps t1 ' second (such as 4 seconds) in original state, by t2 ' second (example Such as 1 second) deflated state become from original state, t3 ' second (such as 1 second) is kept in deflated state, by t4 ' second (such as 1 second) Original state is become from deflated state.That is second round Tb=7s.
After the rigid body that becomes larger of interaction restores to original state, all rigid bodies including the rigid body to become larger comprising the interaction Flicker cycle become the period 1.
In an alternate embodiment of the invention, there are following situations: during rigid body A interaction becomes larger, another rigid body B is touched again Hair interaction.Then rigid body A can become original state, and rigid body B can substitute rigid body A and become larger.Specifically, 2 independent ranks can be divided into Section: the 1st stage first restored rigid body A to original state, and all rigid bodies are moved to initial position;2nd stage, according to step Rapid S101-S104 independently calculates the interaction and collision of rigid body B, and completes to move, to realize physics animation effect.
In an alternate embodiment of the invention, when there is the rigid body of interaction, all rigid bodies are according to the in addition to interactive rigid body Two cycles convert between original state and deflated state
When determining that the rigid body of interaction is triggered interactive, the state of each rigid body in addition to interactive rigid body and time Stamp, wherein the timestamp is used to record the time that variation is reduced in the triggering of rigid body the last time;
According to first time, the state and timestamp, the first delay of each rigid body is determined, wherein when first Between refer to that interactive rigid body is triggered the interactive time;
It is delayed according to first, after the first delay, each rigid body in addition to interactive rigid body is according to the Two cycles convert between original state and deflated state;
When there is no the rigid body of interaction, all rigid bodies convert between original state and deflated state according to the period 1 Include:
The rigid body of interaction when reverting to original state by the state after changing according to preset rules is determined, except interactive rigid The state and timestamp of each rigid body except body, wherein the timestamp is reduced for recording the triggering of rigid body the last time The time of variation;
According to the second time, the state and timestamp, the second delay of each rigid body is determined, wherein when second Between when referring to that interactive rigid body reverts to original state by the state after changing according to preset rules;
It is delayed according to second, after the second delay, each rigid body in addition to interactive rigid body is according to the One period converted between original state and deflated state.
In the present embodiment, two variables can be set, one of variable can be used to record the current state of rigid body, Another variable can be used to record the time that variation is reduced in triggering every time, and real-time update.In the present embodiment, using timing The variation of task control rigid body state, after cancelling timed task, if the rigid body triggered diminution animation, it is fixed only to stop When task, without stopping the animation that has begun, therefore final rigid body can be completed to reduce animation, and rest on deflated state, institute To refer to Fig. 2, when rigid body is between t21-t23, which is in deflated state;When rigid body is in t20-t21 or t23- When between t24, rigid body is in original state.
In an alternate embodiment of the invention, according to current time, the state and timestamp, the delay of each rigid body is determined The process of time includes following 4 kinds of situations:
1. when interactive rigid body is triggered interactive, and when the rigid body in addition to interactive rigid body is in deflated state, institute The first delay is stated to determine according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
After a delay, the above-mentioned rigid body in deflated state is according to second round between original state and deflated state Transformation, i.e., after a delay, the above-mentioned rigid body in deflated state starts to become original state from deflated state that (starting is become greater to The animation of original state).
2. when interactive rigid body is triggered interactive, and when the rigid body in addition to interactive rigid body is in original state, institute The first delay is stated to determine according to the following formula (2-1) or (2-2):
Td=Ta-(ta- T1) if Ta≥(ta-T1) (2-1)
Td=Tb-(ta- T1) if Ta< (ta-T1) (2-2)
After a delay, the above-mentioned rigid body in original state is according to second round between original state and deflated state Transformation, i.e., after a delay, the above-mentioned rigid body in original state starts to become deflated state from original state that (starting narrows down to The animation of deflated state).
3. when interactive rigid body reverts to original state by the state after changing according to preset rules, and except interaction When rigid body except rigid body is in deflated state, second delay determines according to the following formula (3):
Td'=(t2 '+t3 ')-(tb-T1) (3)
After a delay, the above-mentioned rigid body in deflated state is according to the period 1 between original state and deflated state Transformation, i.e., after a delay, the above-mentioned rigid body in deflated state starts to become original state from deflated state that (starting is become greater to The animation of original state).
4. the state after rigid body of interaction according to preset rules by changing reverts to original state, and removes the rigid of interaction When rigid body except body is in original state, second delay determines according to the following formula (3):
Td'=Tb-(tb-T1) (4)
After a delay, the above-mentioned rigid body in original state is according to the period 1 between original state and deflated state Transformation, i.e., after a delay, the above-mentioned rigid body in original state starts to become deflated state from original state that (starting narrows down to The animation of deflated state).
Wherein, TdIndicate the first delay, Td' indicate the second delay, taIt indicates at the first time, tbIndicate the second time, T1 table Show timestamp, TaIndicate period 1, TbIndicate second round.
For the 1st kind of situation, Fig. 3 is please referred to.For Fig. 3, current time ta(being ta in figure), rigid body 2 touches at this time Hair interaction becomes larger, i.e., is at the first time ta.The time that animation is reduced in the last triggering of rigid body 1 is T1, and rigid body 1 is according to the at this time One period carried out periodic flicker and was in deflated state, and delay time T is calculated according to formula (1)d, then rigid body 1 needs In TdLater, it is converted between original state and deflated state according to second round, i.e., rigid body 1 is in TdLater, trigger become larger it is dynamic It draws.Wherein, T1-t30=t1, t31-T1=t2, t32-t31=t3, t33-t32=t4 ', t34-t33=t1 ', t35-t34= t2’。
For the formula (2-1) in the 2nd kind of situation, Fig. 4-1, current time t are please referred toa(being ta in figure), just at this time The triggering interaction of body 2 becomes larger, i.e., is at the first time ta.The time that animation is reduced in the last triggering of rigid body 1 is T1, at this time rigid body 1 Periodic flicker is carried out according to the period 1 and is in original state, and delay time T is calculated according to formula (2-1)d, then just Body 1 is needed in TdLater, it is converted between original state and deflated state according to second round, i.e., rigid body 1 is in TdLater, it triggers The animation to become smaller.Wherein, T1-t40=t1, t41-T1=t2, t42-t41=t3, t43-t42=t4, t44-t43=t1 ', T45-t44=t2 '.
For the formula (2-2) in the 2nd kind of situation, Fig. 4-2 is please referred to, at the T1 moment, variation is reduced in the triggering of certain rigid body 3, and And it was changed between original state and deflated state with second round, then the timestamp that rigid body 3 records at this time is T1.When When to time point ta, the rigid body 4 that interaction becomes larger, which reaches preset time, becomes original state from the interaction state that becomes larger, and rigid body 3 is in Original state, then then rigid body 3 can determine that rigid body 3 will be according to first at the t44 ' moment according to above formula (4) the computation delay time Period changes between original state and deflated state.But ta ' at the time of before reaching t44 ', another 5 quilt of rigid body Triggering interaction becomes larger, due to rigid body 3 at this time be change between original state and deflated state according to second round, so (t '-T1) necessarily greater than the period 1, so at this time should be according to formula (2-2) the computation delay time, and in delay time Change between original state and deflated state according to second round later, i.e., in t64 ' according to second round in initial shape Change between state and deflated state.Wherein, t41 '-T1=t2 ', t42 '-t41 '=t3 ', t43 '-t42 '=t4 ', t44 '- T43 '=t1 ', t45 '-t44 '=t2 ', t46 '-t46 '=t3 '.
For the 3rd kind of situation, referring to FIG. 5, current time is tb(being tb in figure), interactive rigid body 2 is by pressing at this time Original state is reverted to according to the state after preset rules variation, i.e. the second time is tb.The last triggering of rigid body 1 is reduced dynamic The time of picture is T1, and rigid body 1 carries out periodic flicker according to second round and is in deflated state at this time, is counted according to formula (3) Calculation obtains delay time Td', then rigid body 1 is needed in Td' later, become between original state and deflated state according to the period 1 It changes, i.e., rigid body 1 is in Td' later, trigger the animation to become smaller.Wherein, T1-t50=t1 ', t51-T1=t2 ', t52-t51=t3 ', T53-t52=t4 ', t54-t53=t1, t55-t54=t2.
For the 4th kind of situation, referring to FIG. 6, current time is tb(being tb in figure), interactive rigid body 2 is by pressing at this time Original state is reverted to according to the state after preset rules variation, i.e., is at the first time tb.The last triggering of rigid body 1 is reduced dynamic The time of picture is T1, and rigid body 1 carries out periodic flicker according to second round and is in original state at this time, is counted according to formula (4) Calculation obtains delay time Td', then rigid body 1 is needed in Td' later, become between original state and deflated state according to the period 1 It changes, i.e., rigid body 1 is in Td' later, trigger the animation to become smaller.Wherein, T1-t60=t2 ', t61-T1=t3 ', t62-t61=t4 ', T63-t62=t1 ', t64-t63=t2, t65-t64=t3.
The physics animation effect implementation method of the view of the embodiment of the present invention, when interacting with user, interactive rigid body can Amplification is focused, and realizes the animation effect mutually collided, squeezed with periphery rigid body in the process, and these effects meet The expection of user's physical knowledge.Therefore the implementation method of the physics animation effect of view provided by the embodiment of the present invention, not In the case where relying on any third party's physical engine, the flashing of itself (amplification and diminution) of multiple rigid bodies can be simulated, and real Show the physics animation effect of Rigid Body Collision, and simplifies clash logic on the basis of guaranteeing animation effect;And this hair Bright embodiment, which can be used, to be asserted and verifies to each logical point, be ensure that the correctness of logic and timing, is avoided animation long There is unpredictable exception after time operation, also ensures when user has new demand to animation effect, it can be neatly It configures and modifies according to new demand;The dynamic in each rigid body translation period is calculated, also ensures the logic of each rigid body translation It is independent, therefore the transformation of all rigid bodies is independent at random, the user experience is improved.
Fig. 7 is the signal of the main modular of the physics animation effect realization device 700 of view according to an embodiment of the present invention Figure.As shown in fig. 7, the device 700 includes:
New boundary determining module 701, whether the new boundary after changing for determining interactive rigid body according to preset rules Screen border can be exceeded;
Interaction mobile module 702, for moving the rigid body of the interaction, so that the rigid body changes according to preset rules New boundary later is located in screen border;
Determining module 703 is collided, whether the rigid body for determining interaction is rigid with surrounding later according to preset rules variation Body collides;
Effect realizes module 704, for the rigid body that the mobile rigid body with the interaction collides, and makes interactive rigid body Change according to default rule, to realize physics animation effect.
Optionally, the preset rules include: that the area of interactive rigid body is become N times of original state, and N is greater than 1 Positive number.
Optionally, described device 700 further includes recovery module, for after interactive rigid body changes according to preset rules State keep preset time after, the rigid body of the interaction is reverted into original state.
Optionally, the collision determining module 703 is also used to: after determining that the rigid body of interaction changes according to preset rules The coordinate value on new boundary;Determine the coordinate value on the boundary of the rigid body around the rigid body of the interaction;According to coordinate value, interaction is determined Rigid body changes whether collide with the rigid body of surrounding later according to preset rules.
Optionally, the effect realizes that module is also used to: when there is no the rigid body of interaction, all rigid bodies were according to first week Phase converts between original state and deflated state;When there is the rigid body of interaction, all rigid bodies in addition to interactive rigid body It is converted between original state and deflated state according to second round, wherein second round is greater than the period 1.
Optionally, the transformation between original state and deflated state is continuous.
Optionally, it includes: the rigid body first that rigid body converts between original state and deflated state according to the period 1 Beginning state is kept for t1 seconds, becomes deflated state from original state by t2 seconds, is kept for t3 seconds in deflated state, by t4 seconds by contracting Small state becomes original state;It includes: the rigid body that rigid body converts between original state and deflated state according to second round It is kept for the t1 ' second in original state, deflated state is become from original state by the t2 ' second, kept for the t3 ' second in deflated state, passed through T4 ' the second becomes original state from deflated state.
Optionally, the effect realizes that module 704 is also used to: when determining that the rigid body of interaction is triggered interactive, except interactive The state and timestamp of each rigid body except rigid body, wherein the timestamp is for recording the triggering contracting of rigid body the last time The time of small variation;According to first time, the state and timestamp, the first delay of each rigid body is determined, wherein the One delay refers to that interactive rigid body is triggered the interactive time;It is delayed according to first, after the first delay, except friendship Each rigid body except mutual rigid body converts between original state and deflated state according to second round;And
The rigid body of interaction when reverting to original state by the state after changing according to preset rules is determined, except interactive rigid The state and timestamp of each rigid body except body, wherein the timestamp is reduced for recording the triggering of rigid body the last time The time of variation;According to the second time, the state and timestamp, the second delay of each rigid body is determined, wherein second When time refers to that interactive rigid body reverts to original state by the state after changing according to preset rules;According to second be delayed into Line delay, after the second delay, each rigid body in addition to interactive rigid body in original state and is reduced according to the period 1 It is converted between state.
Optionally, when interactive rigid body is triggered interactive, and the rigid body in addition to interactive rigid body is in deflated state When, first delay determines according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When interactive rigid body is triggered interaction constantly, and the rigid body in addition to interactive rigid body is in original state, institute The first delay is stated to determine according to the following formula (2-1) or (2-2):
Td=Ta-(ta- T1) if Ta≥(ta-T1) (2-1)
Td=Tb-(ta- T1) if Ta< (ta-T1) (2-2)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and remove the rigid of interaction When rigid body except body is in deflated state, second delay determines according to the following formula (3):
Td'=(t2 '+t3 ')-(tb-T1) (3)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and remove the rigid of interaction When rigid body except body is in original state, second delay determines according to the following formula (4):
Td'=Tb-(tb-T1) (4)
Wherein, TdIndicate the first delay, Td' indicate the second delay, taIt indicates at the first time, tbIndicate the second time, T1 table Show timestamp, TaIndicate period 1, TbIndicate second round.
Optionally, the shape of rigid body is rectangle.
The physics animation effect realization device of the view of the embodiment of the present invention, can simulate the flashing of itself of multiple rigid bodies (amplification and diminution), can focus amplification, and realize in the process and mutually collide, squeeze with periphery rigid body when interacting with user Animation effect, and these effects meet the expection of user's physical knowledge.Therefore view provided by the embodiment of the present invention The implementation method of physics animation effect realizes the object of Rigid Body Collision in the case where not depending on any third party's physical engine Animation effect is managed, and simplifies clash logic on the basis of guaranteeing animation effect;And the embodiment of the present invention can be used It asserts and each logical point is verified, ensure that the correctness of logic and timing, occur not after avoiding animation long-play Predictable exception also ensures when user has new demand to animation effect, can neatly according to new demand configuration and Modification;The dynamic in each rigid body translation period is calculated, also ensures the logically independent of each rigid body translation, therefore all rigid bodies Transformation be it is independent and random, the user experience is improved.
Method provided by the embodiment of the present invention can be performed in above-mentioned apparatus, has the corresponding functional module of execution method and has Beneficial effect.The not technical detail of detailed description in the present embodiment, reference can be made to method provided by the embodiment of the present invention.
Fig. 8 is shown can be using the physics animation effect implementation method of the view of the embodiment of the present invention or the physics of view The exemplary system architecture 800 of animation effect realization device.
As shown in figure 8, system architecture 800 may include terminal device 801,802,803, network 804 and server 805. Network 804 between terminal device 801,802,803 and server 805 to provide the medium of communication link.Network 804 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 801,802,803 and be interacted by network 804 with server 805, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 801,802,803 The application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform software etc..
Terminal device 801,802,803 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 805 can be to provide the server of various services, such as utilize terminal device 801,802,803 to user The shopping class website browsed provides the back-stage management server supported.Back-stage management server can believe the product received The data such as breath inquiry request carry out the processing such as analyzing, and processing result (such as target push information, product information) is fed back to Terminal device.
It should be noted that the physics animation effect implementation method of view provided by the embodiment of the present invention is generally by servicing Device 805 executes, and correspondingly, the physics animation effect realization device of view is generally positioned in server 805.
It should be understood that the number of terminal device, network and server in Fig. 8 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 9, it illustrates the computer systems 900 for the terminal device for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Terminal device shown in Fig. 9 is only an example, function to the embodiment of the present invention and should not use model Shroud carrys out any restrictions.
As shown in figure 9, computer system 900 includes central processing unit (CPU) 901, it can be read-only according to being stored in Program in memory (ROM) 902 or be loaded into the program in random access storage device (RAM) 903 from storage section 908 and Execute various movements appropriate and processing.In RAM 903, also it is stored with system 900 and operates required various programs and data. CPU 901, ROM 902 and RAM 903 are connected with each other by bus 904.Input/output (I/O) interface 905 is also connected to always Line 904.
I/O interface 905 is connected to lower component: the importation 906 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 907 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 908 including hard disk etc.; And the communications portion 909 of the network interface card including LAN card, modem etc..Communications portion 909 via such as because The network of spy's net executes communication process.Driver 910 is also connected to I/O interface 905 as needed.Detachable media 911, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 910, in order to read from thereon Computer program be mounted into storage section 908 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.In In such embodiment, which can be downloaded and installed from network by communications portion 909, and/or from can Medium 911 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 901, system of the invention is executed The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet It includes sending module, obtain module, determining module and first processing module.Wherein, the title of these modules is under certain conditions simultaneously The restriction to the unit itself is not constituted, for example, sending module is also described as " sending picture to the server-side connected The module of acquisition request ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtaining the equipment includes:
Determine whether the new boundary after the rigid body of interaction changes according to preset rules exceeds screen border;
If so, the rigid body of the mobile interaction, so that new boundary of the rigid body after changing according to preset rules In screen border;
It determines that the rigid body of interaction changes according to preset rules whether to collide with the rigid body of surrounding later;
If so, the rigid body that the mobile rigid body with the interaction collides, and make interactive rigid body according to preset rules Variation, to realize physics animation effect.
The technical solution of the embodiment of the present invention, when interacting with user, interactive rigid body can focus amplification, and in this process The animation effect that middle realization is mutually collided, squeezed with periphery rigid body, and these effects meet the expection of user's physical knowledge.Cause The implementation method of the physics animation effect of view provided by this embodiment of the present invention is not depending on any third party's physical engine In the case where, the flashing of itself (amplification and diminution) of multiple rigid bodies can be simulated, and realize the physics animation of Rigid Body Collision Effect, and clash logic is simplified on the basis of guaranteeing animation effect;And the embodiment of the present invention can be used and assert pair Each logical point is verified, and ensure that the correctness of logic and timing, avoids occurring after animation long-play unpredictable Exception, also ensure when user has new demand to animation effect, can neatly according to new demand configure and modify;It is right The dynamic in each rigid body translation period calculates, and also ensures the logically independent of each rigid body translation, therefore the transformation of all rigid bodies It is independent at random, the user experience is improved.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (13)

1. a kind of physics animation effect implementation method of view characterized by comprising
Determine whether the new boundary after the rigid body of interaction changes according to preset rules exceeds screen border;
If so, the rigid body of the mobile interaction, so that new boundary of the rigid body after changing according to preset rules is located at In screen border;
It determines that the rigid body of interaction changes according to preset rules whether to collide with the rigid body of surrounding later;
If so, the rigid body that the mobile rigid body with the interaction collides, and change interactive rigid body according to preset rules, To realize physics animation effect.
2. the method according to claim 1, wherein the preset rules include: by the area of interactive rigid body Become N times of original state, wherein N is the positive number greater than 1.
3. the method according to claim 1, wherein the method also includes:
It is after the state after interactive rigid body changes according to preset rules keeps preset time, the rigid body of the interaction is extensive It is again original state.
4. according to the method described in claim 2, it is characterized in that, determine the rigid body of interaction is later according to preset rules variation The no rigid body with surrounding, which collides, includes:
Determine the coordinate value on the new boundary after the rigid body of interaction changes according to preset rules;
Determine the coordinate value on the boundary of the rigid body around the rigid body of the interaction;
According to coordinate value, determines that the rigid body of interaction changes according to preset rules and whether collide later with the rigid body of surrounding.
5. according to the method described in claim 4, it is characterized in that, the method also includes:
When there is no the rigid body of interaction, all rigid bodies convert between original state and deflated state according to the period 1;
When there is the rigid body of interaction, all rigid bodies in original state and are reduced according to second round in addition to interactive rigid body It is converted between state, wherein second round is greater than the period 1.
6. according to the method described in claim 5, it is characterized in that, the transformation between original state and deflated state is continuous 's.
7. according to the method described in claim 6, it is characterized in that, rigid body is according to the period 1 in original state and deflated state Between transformation to include: rigid body kept for t1 seconds in original state, deflated state is become from original state by t2 seconds, in deflated state It is kept for t3 seconds, original state is become from deflated state by t4 seconds;
Rigid body converts between original state and deflated state according to second round, and to include: rigid body kept for the t1 ' second in original state, Deflated state is become from original state by the t2 ' second, is kept for the t3 ' second in deflated state, is become just by the t4 ' second from deflated state Beginning state.
8. the method according to the description of claim 7 is characterized in that
When there is the rigid body of interaction, all rigid bodies in original state and are reduced according to second round in addition to interactive rigid body It is converted between state and includes:
When determining that the rigid body of interaction is triggered interactive, the state and timestamp of each rigid body in addition to interactive rigid body, In, the timestamp is used to record the time that variation is reduced in the triggering of rigid body the last time;
According to first time, the state and timestamp, the first delay of each rigid body is determined, wherein be at the first time Refer to that the rigid body of interaction is triggered the interactive time;
It is delayed according to first, after the first delay, each rigid body in addition to interactive rigid body is according to second week Phase converts between original state and deflated state;
When there is no the rigid body of interaction, all rigid bodies convert packet according to the period 1 between original state and deflated state It includes:
Determine the rigid body of interaction when reverting to original state by the state after changing according to preset rules, except interactive rigid body it The state and timestamp of outer each rigid body, wherein the timestamp reduces variation for recording the triggering of rigid body the last time Time;
According to the second time, the state and timestamp, the second delay of each rigid body is determined, wherein the second time was When referring to that the rigid body of interaction reverts to original state by the state after changing according to preset rules;
It is delayed according to second, after the second delay, each rigid body in addition to interactive rigid body was according to first week Phase converts between original state and deflated state.
9. according to the method described in claim 8, it is characterized in that,
When interactive rigid body is triggered interactive, and when the rigid body in addition to interactive rigid body is in deflated state, described first Delay determines according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When interactive rigid body is triggered interaction constantly, and when the rigid body in addition to interactive rigid body is in original state, described the One delay determines according to the following formula (2-1) or (2-2):
Td=Ta-(ta- T1) if Ta≥(ta-T1) (2-1)
Td=Tb-(ta- T1) if Ta< (ta-T1) (2-2)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and except interaction rigid body it When outer rigid body is in deflated state, second delay determines according to the following formula (3):
Td'=(t2 '+t3 ')-(tb-T1) (3)
When interactive rigid body reverts to original state by the state after changing according to preset rules, and except interaction rigid body it When outer rigid body is in original state, second delay determines according to the following formula (4):
Td'=Tb-(tb-T1) (4)
Wherein, TdIndicate the first delay, Td' indicates the second delay, taIt indicates at the first time, tbIndicated for the second time, when T1 is indicated Between stab, TaIndicate period 1, TbIndicate second round.
10. -9 described in any item methods according to claim 1, which is characterized in that the shape of rigid body is rectangle.
11. a kind of physics animation effect realization device of view characterized by comprising
Whether new boundary determining module, the new boundary after the rigid body for determining interaction changes according to preset rules exceed screen Boundary;
Interaction mobile module, for moving the rigid body of the interaction, so that the rigid body according to preset rules after changing New boundary is located in screen border;
Determining module is collided, whether is touched later with the rigid body of surrounding for determining that the rigid body of interaction changes according to preset rules It hits;
Effect realizes module, for the rigid body that the mobile rigid body with the interaction collides, and makes interactive rigid body according to pre- If rule variation, to realize physics animation effect.
12. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now method as described in any in claim 1-10.
13. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor The method as described in any in claim 1-10 is realized when row.
CN201810488881.4A 2018-05-21 2018-05-21 Method and device for realizing physical animation effect of view Active CN110517341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810488881.4A CN110517341B (en) 2018-05-21 2018-05-21 Method and device for realizing physical animation effect of view

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810488881.4A CN110517341B (en) 2018-05-21 2018-05-21 Method and device for realizing physical animation effect of view

Publications (2)

Publication Number Publication Date
CN110517341A true CN110517341A (en) 2019-11-29
CN110517341B CN110517341B (en) 2024-07-16

Family

ID=68621858

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810488881.4A Active CN110517341B (en) 2018-05-21 2018-05-21 Method and device for realizing physical animation effect of view

Country Status (1)

Country Link
CN (1) CN110517341B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002342770A (en) * 2001-05-14 2002-11-29 Nec Corp Animation control system
US20060262113A1 (en) * 2005-03-23 2006-11-23 Electronic Arts Inc. Computer simulation of body dynamics including a solver that solves for position-based constraints
CN104407696A (en) * 2014-11-06 2015-03-11 北京京东尚科信息技术有限公司 Virtual ball simulation and control method of mobile device
CN104461443A (en) * 2014-12-31 2015-03-25 广州视源电子科技股份有限公司 Method and system for realizing animation effect
CN105868425A (en) * 2015-01-19 2016-08-17 北京大学 Multi-rigid-body impact simulation method based on accurate wave effect
CN107134004A (en) * 2017-03-31 2017-09-05 武汉斗鱼网络科技有限公司 A kind of method and device that spheroid motion is simulated in Flash animations

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002342770A (en) * 2001-05-14 2002-11-29 Nec Corp Animation control system
US20060262113A1 (en) * 2005-03-23 2006-11-23 Electronic Arts Inc. Computer simulation of body dynamics including a solver that solves for position-based constraints
CN104407696A (en) * 2014-11-06 2015-03-11 北京京东尚科信息技术有限公司 Virtual ball simulation and control method of mobile device
CN104461443A (en) * 2014-12-31 2015-03-25 广州视源电子科技股份有限公司 Method and system for realizing animation effect
CN105868425A (en) * 2015-01-19 2016-08-17 北京大学 Multi-rigid-body impact simulation method based on accurate wave effect
CN107134004A (en) * 2017-03-31 2017-09-05 武汉斗鱼网络科技有限公司 A kind of method and device that spheroid motion is simulated in Flash animations

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
许亚晴 等: "NURBS在动画向量混合方法中的一个新应用", 新疆石油学院学报, vol. 12, no. 01, pages 69 - 75 *

Also Published As

Publication number Publication date
CN110517341B (en) 2024-07-16

Similar Documents

Publication Publication Date Title
EP3835933A1 (en) Product browsing method and apparatus, device and storage medium
CN109471626B (en) Page logic structure, page generation method, page data processing method and device
CN106557314A (en) Applied software development method and device
WO2021008627A1 (en) Game character rendering method and apparatus, electronic device, and computer-readable medium
US20150301730A1 (en) Object Suspension Realizing Method and Device
CN107249071B (en) Method for controlling mobile terminal by intelligent wearable device
CN109344352A (en) Page loading method, device and electronic equipment
CN105094557A (en) Method and device for display control, and electronic device
CN104915125B (en) Control method, control system and the mobile device of mobile device
US20230306694A1 (en) Ranking list information display method and apparatus, and electronic device and storage medium
CN105302461B (en) A kind of method and apparatus for the offer target pages in mobile application
CN102981818A (en) Scenario based animation library
CN110909439A (en) AR-based assembly method and device and terminal
CN110119201A (en) Method and device for virtual experience of household appliance matching with home environment
CN110704058A (en) Page rendering method and device, storage medium, processor and electronic device
KR20230047172A (en) Video call interaction method and device
CN109254781A (en) It is a kind of for installing the method and apparatus of application on a user device
WO2024131532A1 (en) Hair processing method and apparatus, and device and storage medium
CN110290058A (en) A kind of method and apparatus that conversation message being presented in the application
CN107168606B (en) Dialog control display methods, device and user terminal
CN109977711A (en) A kind of method and household electrical appliance of the household electrical appliance interaction based on two dimensional code
CN108304113A (en) A kind of interface alternation configuration method and terminal
JP6823150B1 (en) Information processing system, information processing method and computer program
CN110517341A (en) The physics animation effect implementation method and device of view
CN108509125B (en) Page turning method, device, terminal and computer readable storage medium

Legal Events

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