CN110517341B - Method and device for realizing physical animation effect of view - Google Patents

Method and device for realizing physical animation effect of view Download PDF

Info

Publication number
CN110517341B
CN110517341B CN201810488881.4A CN201810488881A CN110517341B CN 110517341 B CN110517341 B CN 110517341B CN 201810488881 A CN201810488881 A CN 201810488881A CN 110517341 B CN110517341 B CN 110517341B
Authority
CN
China
Prior art keywords
rigid body
interactive
rigid
state
initial 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.)
Active
Application number
CN201810488881.4A
Other languages
Chinese (zh)
Other versions
CN110517341A (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 a method and a device for realizing a physical animation effect of a view, and relates to the technical field of computers. One embodiment of the method comprises the following steps: determining whether a new boundary of the interacted rigid body after being changed according to a preset rule exceeds a screen boundary; if yes, moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in a screen boundary; determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule; if yes, moving the rigid body collided with the interactive rigid body, and enabling the interactive rigid body to change according to a preset rule so as to achieve a physical animation effect. The embodiment can simulate the flicker (enlargement and reduction) of the plurality of rigid bodies, can focus and enlarge when interacting with a user, and realize the animation effect of collision and extrusion with the peripheral rigid bodies in the process, and the effects meet the expectations of the physical common sense of the user.

Description

Method and device for realizing physical animation effect of view
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for implementing a physical animation effect of a view.
Background
The animation effect is always an important part in man-machine interaction, and is different from the dead and abrupt display effect, the animation effect is added, so that the interaction becomes more friendly, and users can obtain more pleasant use experience by reasonably using the animation.
Taking Android (Linux-based free and open source operating system, mainly used for mobile devices) as an example, android itself supports various animation effects, such as position change, flipping along a certain coordinate axis, shape scaling, and color change. Some third-party physical engines supporting Android platforms, such as jbox D (box 2D is a c++ engine for simulating 2D rigid objects, which is a powerful open-source physical game engine for simulating 2D rigid object motions and collisions, jbox D is box2D of java version), can support the definition of most rigid bodies (such as circles and polygons), implementation of gravity, collision between objects, speed, acceleration, and other physical property calculations.
In the process of implementing the present invention, the inventor finds that at least the following problems exist in the prior art:
the animation design of Android does not support collision among objects, and the animation effect of each object is only the change of the shape of the object, and the concept of physical world and boundary is not provided;
Many physical engines such as Jbox d are open source solutions provided by individual developers, and have no complete and continuous technical support, and the design of these physical engines is designed for realizing the establishment of game world. In addition, the jbox d engine has a plurality of problems (the radius of the circular rigid body is fixed, and therefore, the most simple of all shapes is obtained in collision calculation of the circular rigid body) for complex rigid body interactions such as polygons, and the situations such as calculation errors and the like can occur, so that the user experience is poor.
Disclosure of Invention
In view of this, the embodiments of the present invention provide a method and apparatus for implementing a physical animation effect of a view, which can simulate the flicker (zoom-in and zoom-out) of a plurality of rigid bodies, and can focus and zoom in when interacting with a user, and implement the animation effect of collision and extrusion with a peripheral rigid body in the process, and these effects conform to the expectations of the physical general knowledge of the user.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a physical animation effect implementation method of a view, including: determining whether a new boundary of the interacted rigid body after being changed according to a preset rule exceeds a screen boundary; if yes, moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in a screen boundary; determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule; if yes, moving the rigid body collided with the interactive rigid body, and enabling the interactive rigid body to change according to a preset rule so as to achieve a physical animation effect.
Optionally, the preset rule includes: the area of the interactive rigid body is changed to be N times of the initial state, wherein N is a positive number larger than 1.
Optionally, the method further comprises: and after the state of the interactive rigid body after the interactive rigid body is changed according to the preset rule is kept for a preset time, restoring the interactive rigid body to the initial state.
Optionally, determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to the preset rule comprises: determining a coordinate value of a new boundary after the interactive rigid body changes according to a preset rule; determining coordinate values of boundaries of rigid bodies around the interactive rigid body; and determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule according to the coordinate value.
Optionally, the method further comprises: when no interactive rigid bodies exist, all the rigid bodies are transformed between an initial state and a contracted state according to a first period; when there are interactive rigid bodies, all rigid bodies except the interactive rigid bodies are transformed between the initial state and the contracted state according to a second period, wherein the second period is greater than the first period.
Optionally, the transition between the initial state and the contracted state is continuous.
Optionally, the transitioning of the rigid body between the initial state and the contracted state according to the first cycle includes: the rigid body is kept in the initial state for t1 seconds, and is changed from the initial state to the contracted state after t2 seconds, and is kept in the contracted state for t3 seconds, and is changed from the contracted state to the initial state after t4 seconds;
The transitioning of the rigid body between the initial state and the contracted state according to the second cycle includes: the rigid body is held in the initial state for t1 'seconds, and is changed from the initial state to the contracted state over t2' seconds, and is held in the contracted state for t3 'seconds, and is changed from the contracted state to the initial state over t4' seconds.
Optionally, when there is an interacted rigid body, transforming all the rigid bodies except the interacted rigid body between the initial state and the contracted state according to the second period comprises:
determining the state of each rigid body except the interactive rigid body and a time stamp when the interactive rigid body is triggered to interact, wherein the time stamp is used for recording the time of the last triggering reduction change of the rigid body;
determining a first delay of each rigid body according to a first time, the state and the time stamp, wherein the first time refers to the time when the interacted rigid bodies are triggered to interact;
Delaying according to the first delay, and after the first delay, each rigid body except the interactive rigid body is transformed between an initial state and a contracted state according to a second period;
when there are no interactive rigid bodies, all rigid bodies are transformed between an initial state and a contracted state according to a first cycle including:
When determining that the interacted rigid bodies are restored to the initial state from the state after the change according to the preset rule, the state of each rigid body except the interacted rigid bodies is a time stamp, wherein the time stamp is used for recording the time of the last triggering shrinkage change of the rigid bodies;
determining a second delay of each rigid body according to a second time, the state and the time stamp, wherein the second time refers to when the interacted rigid body is restored to an initial state from a state after being changed according to a preset rule;
the delay is performed according to the second delay, after which each of the rigid bodies other than the interactive rigid body is transformed between the initial state and the contracted state according to the first period.
Optionally, when the interactive rigid body is triggered to interact and the rigid body other than the interactive rigid body is in the contracted state, the first delay is determined according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When the interactive rigid body is triggered to interact, and the rigid bodies other than the interactive rigid body are in an initial state, the first delay is determined according to the following formula (2-1) or (2-2):
T d=Ta-(ta -T1) if T a≥(ta -T1) (2-1)
T d=Tb-(ta -T1) if T a<(ta -T1) (2-2)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule and the rigid body other than the interactive rigid body is in the contracted state, the second delay is determined according to the following formula (3):
Td′=(t2'+t3')-(tb-T1) (3)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule, and the rigid body other than the interactive rigid body is in the initial state, the second delay is determined according to the following formula (4):
Td′=Tb-(tb-T1) (4)
Wherein T d represents a first delay, T d' represents a second delay, T a represents a first time, T b represents a second time, T1 represents a time stamp, T a represents a first period, and T b represents a second period.
Alternatively, the rigid body is rectangular in shape.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a physical animation effect implementing apparatus of a view, including: the new boundary determining module is used for determining whether the new boundary of the interacted rigid body after being changed according to the preset rule exceeds the screen boundary; the interactive moving module is used for moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in the boundary of the screen; the collision determining module is used for determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule; and the effect realizing module is used for moving the rigid body collided with the interactive rigid body and enabling the interactive rigid body to change according to a preset rule so as to realize a physical animation effect.
Optionally, the preset rule includes: the area of the interactive rigid body is changed to be N times of the initial state, and N is a positive number larger than 1.
Optionally, the device further comprises a restoring module, configured to restore the interacted rigid body to the initial state after the state of the interacted rigid body after the interacted rigid body is changed according to the preset rule is maintained for a preset time.
Optionally, the collision determination module is further configured to: determining a coordinate value of a new boundary after the interactive rigid body changes according to a preset rule; determining coordinate values of boundaries of rigid bodies around the interactive rigid body; and determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule according to the coordinate value.
Optionally, the effect implementation module is further configured to: when no interactive rigid bodies exist, all the rigid bodies are transformed between an initial state and a contracted state according to a first period; when there are interactive rigid bodies, all rigid bodies except the interactive rigid bodies are transformed between the initial state and the contracted state according to a second period, wherein the second period is greater than the first period.
Optionally, the transition between the initial state and the contracted state is continuous.
Optionally, the transitioning of the rigid body between the initial state and the contracted state according to the first cycle includes: the rigid body is kept in an initial state for t1 seconds, is changed from the initial state to a contracted state after t2 seconds, is kept in a contracted state for t3 seconds, and is changed from the contracted state to the initial state after t4 seconds; the transitioning of the rigid body between the initial state and the contracted state according to the second cycle includes: the rigid body is kept in an initial state for t1 'seconds, changed from the initial state to a contracted state after t2' seconds, and kept in a contracted state for t3 'seconds, changed from the contracted state to the initial state after t4' seconds.
Optionally, the effect implementation module is further configured to:
determining the state of each rigid body except the interactive rigid body and a time stamp when the interactive rigid body is triggered to interact, wherein the time stamp is used for recording the time of the last triggering reduction change of the rigid body;
determining a first delay of each rigid body according to a first time, the state and the time stamp, wherein the first time refers to the time when the interacted rigid bodies are triggered to interact;
Delaying according to the first delay, and after the first delay, each rigid body except the interactive rigid body is transformed between an initial state and a contracted state according to a second period; and
When determining that the interacted rigid bodies are restored to the initial state from the state after the change according to the preset rule, the state of each rigid body except the interacted rigid bodies is a time stamp, wherein the time stamp is used for recording the time of the last triggering shrinkage change of the rigid bodies;
determining a second delay of each rigid body according to a second time, the state and the time stamp, wherein the second time refers to when the interacted rigid body is restored to an initial state from a state after being changed according to a preset rule;
the delay is performed according to the second delay, after which each of the rigid bodies other than the interactive rigid body is transformed between the initial state and the contracted state according to the first period.
Optionally, when the interactive rigid body is triggered to interact and the rigid body other than the interactive rigid body is in the contracted state, the first delay is determined according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When the interactive rigid body is triggered to interact, and the rigid bodies other than the interactive rigid body are in an initial state, the first delay is determined according to the following formula (2-1) or (2-2):
T d=Ta-(ta -T1) if T a≥(ta -T1) (2-1)
T d=Tb-(ta -T1) if T a<(ta -T1) (2-2)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule and the rigid body other than the interactive rigid body is in the contracted state, the second delay is determined according to the following formula (3):
Td′=(t2'+t3')-(tb-T1) (3)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule, and the rigid body other than the interactive rigid body is in the initial state, the second delay is determined according to the following formula (4):
Td′=Tb-(tb-T1) (4)
Wherein T d represents a first delay, T d' represents a second delay, T a represents a first time, T b represents a second time, T1 represents a time stamp, T a represents a first period, and T b represents a second period.
Alternatively, the rigid body is rectangular in shape.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided an electronic device including: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the physical animation effect realization method of the view of the embodiment of the invention.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer-readable medium having stored thereon a computer program which, when executed by a processor, implements a physical animation effect implementing method of a view of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: because the adoption of determining whether the new boundary of the interactive rigid body after the change according to the preset rule exceeds the screen boundary; if yes, moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in a screen boundary; determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule; if yes, the rigid body collided with the interactive rigid body is moved, and the interactive rigid body is changed according to the preset rule to realize the technical means of physical animation effect, so that the interactive rigid body can be focused and amplified when interacting with a user, and the animation effect of collision and extrusion with the peripheral rigid body is realized in the process, and the effects meet the expectations of the physical general knowledge of the user. Therefore, the method for realizing the physical animation effect of the view provided by the embodiment of the invention can simulate the flicker (enlargement and reduction) of the plurality of rigid bodies under the condition of not depending on any third-party physical engine, realizes the physical animation effect of rigid body collision, and simplifies collision logic on the basis of ensuring the animation effect; in addition, the embodiment of the invention can verify each logic point by using assertion, thereby ensuring the correctness of logic and time sequence, avoiding unpredictable abnormality after long-time running of the animation, and ensuring that when a user has new requirements on animation effects, the animation effects can be flexibly configured and modified according to the new requirements; the dynamic calculation of each rigid body transformation period also ensures the logical independence of each rigid body transformation, so that the transformation of all rigid bodies is independent and random, and the user experience is improved.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main flow of a physical animation effect implementation method of a view according to an embodiment of the present invention;
FIG. 2 is a timing diagram of a rigid body of a physical animation effect implementing method of a view periodically blinking according to a first period, according to an embodiment of the present invention;
FIG. 3 is a timing diagram of rigid body flickering of a physical animation effect implementing method of a view, according to an embodiment of the present invention;
FIG. 4-1 is a timing diagram of rigid body flickering of a physical animation effect implementing method of a view, according to another embodiment of the present invention;
FIG. 4-2 is a timing diagram of rigid body flickering of a physical animation effect implementing method of a view, according to yet another embodiment of the present invention;
FIG. 5 is a timing diagram of rigid body flickering of a physical animation effect implementing method of a view, according to yet another embodiment of the present invention;
FIG. 6 is a timing diagram of rigid body flickering of a physical animation effect implementing method of a view, according to yet another embodiment of the present invention;
FIG. 7 is a schematic diagram of the main modules of a physical animation effect implementing apparatus of a view according to an embodiment of the invention;
FIG. 8 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 9 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of the main flow of a physical animation effect implementation method of a view according to an embodiment of the present invention, as shown in FIG. 1, the method includes:
Step S101: determining whether a new boundary of the interacted rigid body after being changed according to a preset rule exceeds a screen boundary;
Step S102: if yes, moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in a screen boundary;
Step S103: determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule;
step S104: if yes, moving the rigid body collided with the interactive rigid body, and enabling the interactive rigid body to change according to a preset rule so as to achieve a physical animation effect.
In the embodiment of the invention, a plurality of rigid body displays bearing commodity pictures are arranged on the screen of the display equipment, wherein the number and the positions of the rigid bodies can be flexibly set according to application requirements. The rigid body is an ideal rigid body (rigid body), which is a solid of finite size and negligible deformation in the physical world. The interaction may be a screen click and the rigid body that is clicked is called the rigid body of the interaction. In this embodiment, if the shape of the rigid body is rectangular, the rigid body may be referred to as a rectangular rigid body, and the boundaries of the rigid body refer to four sides of the rigid body and may be represented by coordinate values.
For step S101, the preset rule may include: the area of the interacted rigid body is changed to N times of the initial state, wherein N is a positive number greater than 1, for example n=2 or n=2.3. The state after the rigid body of the interaction becomes large according to the preset rule may be referred to as an interchange large state.
The process of determining whether the new boundary of the interacted rigid body after being changed according to the preset rule exceeds the screen boundary may comprise the following processes:
determining a coordinate value of a new boundary of the interacted rigid body after the change of the interacted rigid body according to a preset rule so as to determine a first range;
determining coordinate values of the screen boundary to determine a second range;
judging whether the first range exceeds the second range;
If yes, determining that a new boundary of the interacted rigid body after the change according to a preset rule exceeds a screen boundary; if not, determining that the new boundary of the interacted rigid body after the change according to the preset rule does not exceed the screen boundary.
For step S102, when it is determined that the new boundary of the rigid body after the change according to the preset rule exceeds the screen boundary, the rigid body of the interaction is moved so that the new boundary after the change according to the preset rule is located within the screen boundary. Specifically, if the upper edge of the interacted rigid body after being changed according to a preset rule exceeds the boundary of the screen, the interacted rigid body can be moved downwards in the opposite direction; if the left side of the interacted rigid body exceeds the screen boundary after the interacted rigid body is changed according to the preset rule, moving the interacted rigid body to the right; the other two sides are similar, and the invention is not described herein. Further, when the new boundary exceeds the screen boundary by M cm, where M is a positive number, can be moved in the opposite direction.
When it is determined that the new boundary of the interacted rigid body after being changed according to the preset rule does not exceed the screen boundary, step S102 is skipped, and step S103 is performed.
For step S103, the process of determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to the preset rule may include:
determining a coordinate value of a new boundary after the interactive rigid body changes according to a preset rule;
determining coordinate values of boundaries of rigid bodies around the interactive rigid body;
and determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule according to the coordinate value.
In this embodiment, if all the rigid bodies are rectangular rigid bodies, it may be determined whether the interacted rigid body collides with the surrounding rigid body after the interacted rigid body changes according to a preset rule by determining whether the rigid bodies in the upper, lower, left and right directions of the interacted rigid body collide with the boundary thereof.
For step S104, when there is a rigid body that collides with the interactive rigid body, the rigid body that collides with the interactive rigid body is moved, and the interactive rigid body is changed according to a preset rule, thereby realizing a physical animation effect.
In this embodiment, when the interaction becomes large, if the new boundary after the interaction becomes large does not exceed the screen boundary but collides with the surrounding rigid body, the interacted rigid body is not moved, that is, the center position of the interacted rigid body is not moved, but the surrounding rigid body is moved. For example, the rigid body 1 is triggered to interact, and the new boundary of the rigid body 1 after the interaction is enlarged does not exceed the screen boundary; when the new boundary of the rigid body 1 collides with the boundary of the rigid body 2 above the new boundary, the rigid body 2 calculates how much upward movement does not collide with the rigid body 1 below by taking the new boundary as a judgment standard. In the present embodiment, it may not be necessary to determine whether the boundary of the rigid body 2 after movement exceeds the screen boundary.
In an alternative embodiment, after the state of the interactive rigid body after the change of the preset rule is maintained for a preset time, the interactive rigid body is maintained in the state of the interactive enlarged for a preset time, and then the interactive enlarged rigid body is restored to the initial state. The preset time can be flexibly set according to application requirements. In this embodiment, the preset time may be equal to the second period hereinafter.
After the rigid body with the enlarged interaction is restored to the initial state, if the rigid body moves in position when the interaction is enlarged, returning the rigid body to the initial position; if the rigid body around the moving body also moves, the moving rigid body moves back to the initial position.
The method for realizing the physical animation effect of the view in the embodiment of the invention can focus and enlarge the interactive rigid body when interacting with the user, realize the animation effect of collision and extrusion with the peripheral rigid body in the process, and the effects conform to the expectation of the physical common sense of the user.
In an alternative embodiment, the method further comprises:
When no interactive rigid bodies exist, all the rigid bodies are transformed between an initial state and a contracted state according to a first period;
when there are interactive rigid bodies, all rigid bodies except the interactive rigid bodies are transformed between the initial state and the contracted state according to a second period, wherein the second period is greater than the first period.
Wherein the transition between the initial state and the contracted state is continuous.
The transitioning of the rigid body between the initial state and the contracted state according to the first cycle includes: the rigid body is kept in the initial state for t1 seconds, and is changed from the initial state to the contracted state after t2 seconds, and is kept in the contracted state for t3 seconds, and is changed from the contracted state to the initial state after t4 seconds;
The transitioning of the rigid body between the initial state and the contracted state according to the second cycle includes: the rigid body is held in the initial state for t1 'seconds, and is changed from the initial state to the contracted state over t2' seconds, and is held in the contracted state for t3 'seconds, and is changed from the contracted state to the initial state over t4' seconds.
In an alternative embodiment, the transformation of the state may be accomplished by zooming in, zooming out, and a change in the transparent value using an Android native property animation mechanism. And the state change of the rigid body can be controlled by utilizing a timing task, wherein the attribute animation refers to an animation interface provided by Android, and gradual change of a certain attribute (position, size, transparency value and the like) of view can be completed within a specified period of time. A transparency value of 1 indicates normal visibility (complete occlusion of the background behind); a transparency value of 0 indicates complete transparency; a transparency value between 1 and 0 indicates partial transparency, the greater the transparency value the more opaque. The timing task refers to a timer which can be created by a developer in Android and periodically triggers certain actions, and the starting time, the period and the actions to be executed can be set. Once started, if not tampered with, the loop is run all the way down.
Specifically, when there is no interactive rigid body, all the rigid bodies are transformed between the initial state and the contracted state according to the first period, i.e., all the rigid bodies periodically flash according to the first period, and the following rules are followed: the rigid body is held in the initial state for t1 seconds (e.g., 2 seconds), and is changed from the initial state to the contracted state over t2 seconds (e.g., 0.5 seconds), and is held in the contracted state for t3 seconds (e.g., 0.5 seconds), and is changed from the contracted state to the initial state over t4 seconds (e.g., 0.5 seconds). I.e. a first period T a =3.5 s. The initial time of all the rigid bodies for state transformation is random (namely, the initial time of all the rigid bodies flickering is random), and the initial time can be dynamically changed after interaction, so that a random flickering animation effect can be shown for a user, and the user experience is improved.
Specifically, referring to fig. 2, between t20 and t21, the rigid body is in an initial state, at time t21, the rigid body triggers a reduction change (i.e., the rigid body triggers a reduction animation), between t21 and t22, the rigid body reduces, i.e., changes from the initial state to the reduced state, between t22 and t23, the rigid body remains in the reduced state, and between t23 and t24, the rigid body changes from the reduced state to the initial state. Wherein, t21-t20=t1, t22-t21=t2, t23-t22=t3, t24-t23=t1. There is an animation between t21 to t22 and between t23 to t24, and the pictures carried between t20 to t21 and between t22 to t23 remain unchanged. The pictures carried by the rigid body at time t22 can be switched.
When the interactive rigid body exists, the interactive rigid body becomes larger according to a preset rule, for example, the interactive rigid body becomes 2 times of the initial state after 0.5 seconds, and additional information (such as commodity details and two-dimensional code purchase) is displayed; all the rigid bodies except the interactive rigid body are transformed between the initial state and the contracted state according to the second period, i.e. all the rigid bodies except the interactive rigid body periodically flash according to the second period, and the following rules are followed: the rigid body is held in the initial state for t1 'seconds (e.g., 4 seconds), and is changed from the initial state to the contracted state over t2' seconds (e.g., 1 second), and is held in the contracted state for t3 'seconds (e.g., 1 second), and is changed from the contracted state to the initial state over t4' seconds (e.g., 1 second). I.e. the second period T b =7s.
When the rigid body with the increased interaction is restored to the initial state, the blinking period of all the rigid bodies including the rigid body with the increased interaction becomes the first period.
In an alternative embodiment, the following is present: in the process of the enlarged interaction of the rigid body A, the other rigid body B is triggered to interact again. Then the rigid body a becomes the initial state and the rigid body B becomes larger instead of the rigid body a. Specifically, it can be divided into 2 independent stages: step 1, firstly restoring the rigid body A to an initial state, and moving all the rigid bodies to initial positions; and 2, independently calculating interaction and collision of the rigid body B according to the steps S101-S104, and completing movement so as to realize a physical animation effect.
In an alternative embodiment, when there is an interacted rigid body, transforming all the rigid bodies except the interacted rigid body between the initial state and the contracted state according to the second period comprises:
determining the state of each rigid body except the interactive rigid body and a time stamp when the interactive rigid body is triggered to interact, wherein the time stamp is used for recording the time of the last triggering reduction change of the rigid body;
determining a first delay of each rigid body according to a first time, the state and the time stamp, wherein the first time refers to the time when the interacted rigid bodies are triggered to interact;
Delaying according to the first delay, and after the first delay, each rigid body except the interactive rigid body is transformed between an initial state and a contracted state according to a second period;
when there are no interactive rigid bodies, all rigid bodies are transformed between an initial state and a contracted state according to a first cycle including:
When determining that the interacted rigid bodies are restored to the initial state from the state after the change according to the preset rule, the state of each rigid body except the interacted rigid bodies is a time stamp, wherein the time stamp is used for recording the time of the last triggering shrinkage change of the rigid bodies;
determining a second delay of each rigid body according to a second time, the state and the time stamp, wherein the second time refers to when the interacted rigid body is restored to an initial state from a state after being changed according to a preset rule;
the delay is performed according to the second delay, after which each of the rigid bodies other than the interactive rigid body is transformed between the initial state and the contracted state according to the first period.
In this embodiment, two variables may be set, one of which may be used to record the current state of the rigid body, and the other may be used to record the time of each trigger zoom-out change, and update in real time. In this embodiment, the timing task is adopted to control the change of the state of the rigid body, after the timing task is cancelled, if the rigid body has triggered the reduced animation, only the timing task is stopped, but the animation which has already started is not stopped, so that the final rigid body can complete the reduced animation and stay in the reduced state, so that referring to fig. 2, when the rigid body is between t21-t23, the rigid body is in the reduced state; when the rigid body is between t20-t21 or t23-t24, the rigid body is in an initial state.
In an alternative embodiment, the process of determining the delay time of each rigid body according to the current time, the state and the time stamp includes the following 4 cases:
1. When the interactive rigid body is triggered to interact and the rigid bodies other than the interactive rigid body are in a contracted state, the first delay is determined according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
after the delay, the rigid body in the contracted state is changed between the initial state and the contracted state in accordance with the second cycle, that is, after the delay, the rigid body in the contracted state starts to change from the contracted state to the initial state (starts the animation that becomes larger to the initial state).
2. When the interactive rigid body is triggered to interact, and the rigid bodies other than the interactive rigid body are in an initial state, the first delay is determined according to the following formula (2-1) or (2-2):
T d=Ta-(ta -T1) if T a≥(ta -T1) (2-1)
T d=Tb-(ta -T1) if T a<(ta -T1) (2-2)
After the delay, the rigid body in the initial state is changed between the initial state and the contracted state in accordance with the second cycle, that is, after the delay, the rigid body in the initial state starts to change from the initial state to the contracted state (starts the animation contracted to the contracted state).
3. When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule and the rigid body other than the interactive rigid body is in the contracted state, the second delay is determined according to the following formula (3):
Td′=(t2'+t3')-(tb-T1) (3)
After the delay, the rigid body in the contracted state is changed between the initial state and the contracted state in accordance with a first period, that is, after the delay, the rigid body in the contracted state starts to change from the contracted state to the initial state (starts the animation that is enlarged to the initial state).
4. When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule and the rigid body other than the interactive rigid body is in the initial state, the second delay is determined according to the following formula (3):
Td'=Tb-(tb-T1) (4)
After the delay, the rigid body in the initial state is changed between the initial state and the contracted state in accordance with a first period, that is, after the delay, the rigid body in the initial state starts to change from the initial state to the contracted state (starts the animation contracted to the contracted state).
Wherein T d represents a first delay, T d' represents a second delay, T a represents a first time, T b represents a second time, T1 represents a time stamp, T a represents a first period, and T b represents a second period.
For case 1, please refer to fig. 3. For fig. 3, the current time is t a (ta in the figure), at which time rigid body 2 triggers the interchange to become large, i.e., the first time is t a. When the time of triggering the reduced animation for the most recent time of the rigid body 1 is T1, and at this time, the rigid body 1 periodically blinks and is in a reduced state according to the first period, and the delay time T d is calculated according to the formula (1), the rigid body 1 needs to be transformed between the initial state and the reduced state according to the second period after T d, that is, the rigid body 1 triggers the enlarged animation after T d. 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 case of 2 nd, please refer to fig. 4-1, the current time is t a (ta in the figure), and the rigid body 2 triggers the interchange and the enlargement, i.e. the first time is t a. When the time of the last triggering of the reduced animation by the rigid body 1 is T1, and the rigid body 1 periodically blinks and is in the initial state according to the first period and the delay time T d is calculated according to the formula (2-1), the rigid body 1 needs to be transformed between the initial state and the reduced state according to the second period after T d, that is, the rigid body 1 triggers the reduced animation after T d. Wherein, t1-t40=t1, t41-t1=t2, t42-t41=t3, t43-t42=t4, t44-t43=t1 ', t45-t44=t2'.
For equation (2-2) in case 2, please refer to fig. 4-2, at time T1, a certain rigid body 3 triggers a shrink change, and it changes between an initial state and a shrink state in a second period, then the timestamp recorded by the rigid body 3 is T1. When the time point ta is reached, the rigid body 4 with the increased interaction reaches the preset time and is changed from the increased interaction state to the initial state, and the rigid body 3 is in the initial state, the rigid body 3 calculates the delay time according to the above formula (4), and then determines that the rigid body 3 is changed between the initial state and the reduced state according to the first period at the time t 44'. However, at a time ta 'before T44' is reached, the other rigid body 5 is triggered to cross-increase, and since the rigid body 3 is changed between the initial state and the contracted state at this time in accordance with the second period, (T '-T1) is necessarily larger than the first period, the delay time should be calculated at this time in accordance with the equation (2-2) and changed between the initial state and the contracted state in accordance with the second period after the delay time, that is, changed between the initial state and the contracted state in accordance with the second period at T64'. Where t41' -t1=t2 ', t42' -t41' =t3 ', T43' -t42' =t4 ', T44' -t43' =t1 ', T45' -T44' =t2 ', T46' -T46' =t3 '.
For the 3 rd case, please refer to fig. 5, the current time is t b (tb in the figure), and the interacted rigid body 2 is restored to the initial state from the state after being changed according to the preset rule, i.e. the second time is t b. When the time of the last triggering of the reduced animation of the rigid body 1 is T1, and the rigid body 1 periodically blinks and is in a reduced state according to the second period, and the delay time T d ' is calculated according to the formula (3), the rigid body 1 needs to be transformed between the initial state and the reduced state according to the first period after T d ', that is, the rigid body 1 triggers the reduced animation after T d '. Wherein t1-t50=t1 ', t51-t1=t2', t52-t51=t3 ', t53-t52=t4', t54-t53=t1, t55-t54=t2.
For the 4 th case, please refer to fig. 6, the current time is t b (tb in the figure), and the interacted rigid body 2 is restored to the initial state from the state after being changed according to the preset rule, i.e. the first time is t b. When the time of the last triggering of the reduced animation by the rigid body 1 is T1, and the rigid body 1 periodically blinks and is in the initial state according to the second period, and the delay time T d ' is calculated according to the formula (4), the rigid body 1 needs to be transformed between the initial state and the reduced state according to the first period after T d ', that is, the rigid body 1 triggers the reduced animation after T d '. Wherein t1-t60=t2 ', t61-t1=t3', t62-t61=t4 ', t63-t62=t1', t64-t63=t2, and t65-t64=t3.
The method for realizing the physical animation effect of the view in the embodiment of the invention can focus and enlarge the interactive rigid body when interacting with the user, realize the animation effect of collision and extrusion with the peripheral rigid body in the process, and the effects conform to the expectation of the physical common sense of the user. Therefore, the method for realizing the physical animation effect of the view provided by the embodiment of the invention can simulate the flicker (enlargement and reduction) of the plurality of rigid bodies under the condition of not depending on any third-party physical engine, realizes the physical animation effect of rigid body collision, and simplifies collision logic on the basis of ensuring the animation effect; in addition, the embodiment of the invention can verify each logic point by using assertion, thereby ensuring the correctness of logic and time sequence, avoiding unpredictable abnormality after long-time running of the animation, and ensuring that when a user has new requirements on animation effects, the animation effects can be flexibly configured and modified according to the new requirements; the dynamic calculation of each rigid body transformation period also ensures the logical independence of each rigid body transformation, so that the transformation of all rigid bodies is independent and random, and the user experience is improved.
Fig. 7 is a schematic diagram of main modules of a physical animation effect implementing apparatus 700 of a view according to an embodiment of the present invention. As shown in fig. 7, the apparatus 700 includes:
a new boundary determining module 701, configured to determine whether the new boundary of the interacted rigid body after being changed according to a preset rule exceeds the screen boundary;
An interaction moving module 702, configured to move the interacted rigid body so that a new boundary of the rigid body after the rigid body changes according to a preset rule is located in a screen boundary;
A collision determining module 703, configured to determine whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule;
And the effect realizing module 704 is used for moving the rigid body collided with the interactive rigid body and enabling the interactive rigid body to change according to a preset rule so as to realize the physical animation effect.
Optionally, the preset rule includes: the area of the interactive rigid body is changed to be N times of the initial state, and N is a positive number larger than 1.
Optionally, the apparatus 700 further includes a restoring module, configured to restore the interacted rigid body to the initial state after the state of the interacted rigid body after the change of the predetermined rule is maintained for a predetermined time.
Optionally, the collision determination module 703 is further configured to: determining a coordinate value of a new boundary after the interactive rigid body changes according to a preset rule; determining coordinate values of boundaries of rigid bodies around the interactive rigid body; and determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule according to the coordinate value.
Optionally, the effect implementation module is further configured to: when no interactive rigid bodies exist, all the rigid bodies are transformed between an initial state and a contracted state according to a first period; when there are interactive rigid bodies, all rigid bodies except the interactive rigid bodies are transformed between the initial state and the contracted state according to a second period, wherein the second period is greater than the first period.
Optionally, the transition between the initial state and the contracted state is continuous.
Optionally, the transforming of the rigid body between the initial state and the contracted state according to the first cycle includes: the rigid body is kept in an initial state for t1 seconds, is changed from the initial state to a contracted state after t2 seconds, is kept in a contracted state for t3 seconds, and is changed from the contracted state to the initial state after t4 seconds; the transitioning of the rigid body between the initial state and the contracted state according to the second cycle includes: the rigid body is kept in an initial state for t1 'seconds, changed from the initial state to a contracted state after t2' seconds, and kept in a contracted state for t3 'seconds, changed from the contracted state to the initial state after t4' seconds.
Optionally, the effect implementation module 704 is further configured to: determining the state of each rigid body except the interactive rigid body and a time stamp when the interactive rigid body is triggered to interact, wherein the time stamp is used for recording the time of the last triggering reduction change of the rigid body; determining a first delay of each rigid body according to the first time, the state and the time stamp, wherein the first delay refers to the time when the interacted rigid bodies are triggered to interact; delaying according to the first delay, and after the first delay, each rigid body except the interactive rigid body is transformed between an initial state and a contracted state according to a second period; and
When determining that the interacted rigid bodies are restored to the initial state from the state after the change according to the preset rule, the state of each rigid body except the interacted rigid bodies is a time stamp, wherein the time stamp is used for recording the time of the last triggering shrinkage change of the rigid bodies; determining a second delay of each rigid body according to a second time, the state and the time stamp, wherein the second time refers to when the interacted rigid body is restored to an initial state from a state after being changed according to a preset rule; the delay is performed according to the second delay, after which each of the rigid bodies other than the interactive rigid body is transformed between the initial state and the contracted state according to the first period.
Optionally, when the interactive rigid body is triggered to interact and the rigid body other than the interactive rigid body is in the contracted state, the first delay is determined according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When the interactive rigid body is triggered to interact, and the rigid bodies other than the interactive rigid body are in an initial state, the first delay is determined according to the following formula (2-1) or (2-2):
T d=Ta-(ta -T1) if T a≥(ta -T1) (2-1)
T d=Tb-(ta -T1) if T a<(ta -T1) (2-2)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule and the rigid body other than the interactive rigid body is in the contracted state, the second delay is determined according to the following formula (3):
Td′=(t2'+t3')-(tb-T1) (3)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule, and the rigid body other than the interactive rigid body is in the initial state, the second delay is determined according to the following formula (4):
Td′=Tb-(tb-T1) (4)
Wherein T d represents a first delay, T d' represents a second delay, T a represents a first time, T b represents a second time, T1 represents a time stamp, T a represents a first period, and T b represents a second period.
Alternatively, the rigid body is rectangular in shape.
The physical animation effect realizing device of the view of the embodiment of the invention can simulate the flicker (enlargement and reduction) of the plurality of rigid bodies, can focus and enlarge when interacting with a user, can realize the animation effect of collision and extrusion with the peripheral rigid bodies in the process, and accords with the expectation of the physical common sense of the user. Therefore, the method for realizing the physical animation effect of the view provided by the embodiment of the invention realizes the physical animation effect of rigid body collision without depending on any third-party physical engine, and simplifies collision logic on the basis of ensuring the animation effect; in addition, the embodiment of the invention can verify each logic point by using assertion, thereby ensuring the correctness of logic and time sequence, avoiding unpredictable abnormality after long-time running of the animation, and ensuring that when a user has new requirements on animation effects, the animation effects can be flexibly configured and modified according to the new requirements; the dynamic calculation of each rigid body transformation period also ensures the logical independence of each rigid body transformation, so that the transformation of all rigid bodies is independent and random, and the user experience is improved.
The device can execute the method provided by the embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in this embodiment may be found in the methods provided in the embodiments of the present invention.
FIG. 8 illustrates an exemplary system architecture 800 of a physical animation effect implementing method of a view or a physical animation effect implementing apparatus of a view to which an embodiment of the present invention may be applied.
As shown in fig. 8, a system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 serves as a medium for providing communication links between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 805 through the network 804 using the terminal devices 801, 802, 803 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 801, 802, 803.
The terminal devices 801, 802, 803 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 805 may be a server providing various services, such as a background management server providing support for shopping-type websites browsed by the user using the terminal devices 801, 802, 803. The background management server can analyze and other processing on the received data such as the product information inquiry request and the like, and feed back processing results (such as target push information and product information) to the terminal equipment.
It should be noted that, the method for implementing the physical animation effect of the view provided by the embodiment of the present invention is generally executed by the server 805, and accordingly, the device for implementing the physical animation effect of the view is generally disposed in the server 805.
It should be understood that the number of terminal devices, networks and servers in fig. 8 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 9, there is illustrated a schematic diagram of a computer system 900 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 9 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 9, the computer system 900 includes a Central Processing Unit (CPU) 901, which can execute various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage section 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
The following components are connected to the I/O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output portion 907 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 908 including a hard disk or the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 910 so that a computer program read out therefrom is installed into the storage section 908 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 909 and/or installed from the removable medium 911. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 901.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not constitute a limitation on the unit itself in some cases, and for example, the transmitting module may also be described as "a module that transmits a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
Determining whether a new boundary of the interacted rigid body after being changed according to a preset rule exceeds a screen boundary;
if yes, moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in a screen boundary;
Determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule;
If yes, moving the rigid body collided with the interactive rigid body, and enabling the interactive rigid body to change according to a preset rule so as to achieve a physical animation effect.
According to the technical scheme of the embodiment of the invention, when the interactive rigid body is interacted with a user, the interactive rigid body can be focused and amplified, and the animation effects of collision and extrusion with the peripheral rigid body are realized in the process, and the effects meet the expectations of the physical general knowledge of the user. Therefore, the method for realizing the physical animation effect of the view provided by the embodiment of the invention can simulate the flicker (enlargement and reduction) of the plurality of rigid bodies under the condition of not depending on any third-party physical engine, realizes the physical animation effect of rigid body collision, and simplifies collision logic on the basis of ensuring the animation effect; in addition, the embodiment of the invention can verify each logic point by using assertion, thereby ensuring the correctness of logic and time sequence, avoiding unpredictable abnormality after long-time running of the animation, and ensuring that when a user has new requirements on animation effects, the animation effects can be flexibly configured and modified according to the new requirements; the dynamic calculation of each rigid body transformation period also ensures the logical independence of each rigid body transformation, so that the transformation of all rigid bodies is independent and random, and the user experience is improved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (12)

1. A method for implementing physical animation effects of a view, comprising:
determining whether a new boundary of the interacted rigid body after being changed according to a preset rule exceeds a screen boundary; the preset rule comprises the following steps: changing the area of the interactive rigid body to be N times of the initial state, wherein N is a positive number larger than 1;
if yes, moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in a screen boundary;
Determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule;
if yes, moving the rigid body collided with the interactive rigid body, not moving the central position of the interactive rigid body, and enabling the interactive rigid body to change according to a preset rule so as to achieve a physical animation effect.
2. The method according to claim 1, wherein the method further comprises:
And after the state of the interactive rigid body after the interactive rigid body is changed according to the preset rule is kept for a preset time, restoring the interactive rigid body to the initial state.
3. The method of claim 1, wherein determining whether the interacted rigid body collides with the surrounding rigid body after the interacted rigid body changes according to the preset rule comprises:
determining a coordinate value of a new boundary after the interactive rigid body changes according to a preset rule;
determining coordinate values of boundaries of rigid bodies around the interactive rigid body;
and determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule according to the coordinate value.
4. A method according to claim 3, characterized in that the method further comprises:
When no interactive rigid bodies exist, all the rigid bodies are transformed between an initial state and a contracted state according to a first period;
when there are interactive rigid bodies, all rigid bodies except the interactive rigid bodies are transformed between the initial state and the contracted state according to a second period, wherein the second period is greater than the first period.
5. The method of claim 4, wherein the transition between the initial state and the contracted state is continuous.
6. The method of claim 5, wherein transitioning the rigid body between the initial state and the contracted state according to the first cycle comprises: the rigid body is kept in the initial state for t1 seconds, and is changed from the initial state to the contracted state after t2 seconds, and is kept in the contracted state for t3 seconds, and is changed from the contracted state to the initial state after t4 seconds;
The transitioning of the rigid body between the initial state and the contracted state according to the second cycle includes: the rigid body is held in the initial state for t1 'seconds, and is changed from the initial state to the contracted state over t2' seconds, and is held in the contracted state for t3 'seconds, and is changed from the contracted state to the initial state over t4' seconds.
7. The method of claim 6, wherein the step of providing the first layer comprises,
When there is an interacted rigid body, transforming all the rigid bodies except the interacted rigid body between the initial state and the contracted state according to the second period includes:
determining the state of each rigid body except the interactive rigid body and a time stamp when the interactive rigid body is triggered to interact, wherein the time stamp is used for recording the time of the last triggering reduction change of the rigid body;
determining a first delay of each rigid body according to a first time, the state and the time stamp, wherein the first time refers to the time when the interacted rigid bodies are triggered to interact;
Delaying according to the first delay, and after the first delay, each rigid body except the interactive rigid body is transformed between an initial state and a contracted state according to a second period;
when there are no interactive rigid bodies, all rigid bodies are transformed between an initial state and a contracted state according to a first cycle including:
When determining that the interacted rigid bodies are restored to the initial state from the state after the change according to the preset rule, the state of each rigid body except the interacted rigid bodies is a time stamp, wherein the time stamp is used for recording the time of the last triggering shrinkage change of the rigid bodies;
determining a second delay of each rigid body according to a second time, the state and the time stamp, wherein the second time refers to when the interacted rigid body is restored to an initial state from a state after being changed according to a preset rule;
the delay is performed according to the second delay, after which each of the rigid bodies other than the interactive rigid body is transformed between the initial state and the contracted state according to the first period.
8. The method of claim 7, wherein the step of determining the position of the probe is performed,
When the interactive rigid body is triggered to interact and the rigid bodies other than the interactive rigid body are in a contracted state, the first delay is determined according to the following formula (1):
Td=(t2+t3)-(ta-T1) (1)
When the interactive rigid body is triggered to interact, and the rigid bodies other than the interactive rigid body are in an initial state, the first delay is determined according to the following formula (2-1) or (2-2):
T d=Ta-(ta -T1) if T a≥(ta -T1) (2-1)
T d=Tb-(ta -T1) if T a<(ta -T1) (2-2)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule and the rigid body other than the interactive rigid body is in the contracted state, the second delay is determined according to the following formula (3):
Td′=(t2'+t3')-(tb-T1) (3)
When the interactive rigid body is restored to the initial state from the state after the change according to the preset rule, and the rigid body other than the interactive rigid body is in the initial state, the second delay is determined according to the following formula (4):
Td′=Tb-(tb-T1) (4)
Wherein T d represents a first delay, T d' represents a second delay, T a represents a first time, T b represents a second time, T1 represents a time stamp, T a represents a first period, and T b represents a second period.
9. The method of any one of claims 1-8, wherein the rigid body is rectangular in shape.
10. A physical animation effect implementation device for a view, comprising:
The new boundary determining module is used for determining whether the new boundary of the interacted rigid body after being changed according to the preset rule exceeds the screen boundary; the preset rule comprises the following steps: changing the area of the interactive rigid body to be N times of the initial state, wherein N is a positive number larger than 1;
The interactive moving module is used for moving the interactive rigid body so that a new boundary of the rigid body after the rigid body is changed according to a preset rule is positioned in the boundary of the screen;
The collision determining module is used for determining whether the interacted rigid body collides with the surrounding rigid body after being changed according to a preset rule;
And the effect realizing module is used for moving the rigid body which collides with the interactive rigid body, not moving the central position of the interactive rigid body and enabling the interactive rigid body to change according to a preset rule so as to realize a physical animation effect.
11. An electronic device, comprising:
One or more processors;
storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-9.
12. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-9.
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 CN110517341A (en) 2019-11-29
CN110517341B true 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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (4)

* 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
CN105868425B (en) * 2015-01-19 2020-01-10 北京大学 Multi-rigid-body collision simulation method based on precise 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 (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN110517341A (en) 2019-11-29

Similar Documents

Publication Publication Date Title
JP6226394B2 (en) Instantiable gesture object
KR102150733B1 (en) Panning animations
US11783111B2 (en) Display method and apparatus, and electronic device
US20130239039A1 (en) Rocket effect in a progress bar
CN102937861B (en) For the shared edge of display environment
CN110288705B (en) Method and device for generating three-dimensional model
US11182953B2 (en) Mobile device integration with a virtual reality environment
JP7553582B2 (en) Method and apparatus for processing special image effects
CN110825286B (en) Image processing method and device and electronic equipment
US20170213394A1 (en) Environmentally mapped virtualization mechanism
CN110020231A (en) Webpage capture method and device thereof
KR102040359B1 (en) Synchronization points for state information
CN110780955A (en) Method and equipment for processing emoticon message
CN113453073A (en) Image rendering method and device, electronic equipment and storage medium
WO2017101390A1 (en) Picture display method and apparatus
WO2024188089A1 (en) Special effect information display method and apparatus, electronic device, and storage medium
CN117271045A (en) Equipment information display method and device based on digital twinning and electronic equipment
CN110517341B (en) Method and device for realizing physical animation effect of view
US20200202479A1 (en) Method and Apparatus for Processing a Video Frame
KR20180010442A (en) User device for processing online authoring service and method for storing document thereof
US10198837B2 (en) Network graphing selector
CN110619615A (en) Method and apparatus for processing image
CN113204299B (en) Display method, display device, electronic equipment and storage medium
CN106021635B (en) For showing equipment, the method and computer program of caricature content
WO2022110754A1 (en) Resource loading method and apparatus, electronic device, storage medium, and program

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