Animation generation method for objects in interface, electronic device and storage medium

By generating differentiated animation based on object appearance parameters in the user interface, the problem of lack of differentiation in animation response in the existing technology is solved, and the user interaction experience and the authenticity of the animation are improved.

CN114880053BActive Publication Date: 2024-09-06HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110169797.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-05
Publication Date
2024-09-06
Estimated Expiration
2041-02-05

AI Technical Summary

Technical Problem

In the existing technology, the animation responses of objects in the user interface to the user's gesture operations are usually preset and fixed, resulting in a poor interactive experience, and the animation effects of different objects are the same and lack differentiation.

Method used

By generating differentiated animations based on the appearance differences of objects, and using the appearance parameters of objects to assign physical parameters, the animation is more consistent with the object movement process in the real world and improves user interaction experience. Specific methods include detecting user operations, obtaining the appearance parameters of objects, and generating motion animations based on these parameters to ensure that different objects generate different motion animations under the same operation.

Benefits of technology

It realizes differentiated animation effects between objects in the user interface, making the animation more consistent with the movement of objects in the real world, and improving the user's interactive experience and the diversity of interactive experiences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880053B
    Figure CN114880053B
Patent Text Reader

Abstract

The embodiment of the present application provides an animation generation method, electronic device and storage medium for objects in an interface, which relates to the field of human-computer interaction technology. Differentiated object animations can be generated based on the appearance differences between objects in the interface to improve the user's interactive experience. The method includes: a user interface displays a first object and a second object, the first object and the second object are of the same type but different in appearance; in response to a first operation acting on the first object, a first motion animation of the first object is generated; in response to a second operation acting on the second object, a second motion animation of the second object is generated, the first operation and the second operation are the same, and the first motion animation and the second motion animation are different.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of human-computer interaction, and in particular, to a method for generating animation of objects in an interface, an electronic device, and a storage medium. Background Art

[0002] With the development of smart terminals, the ways of human-computer interaction are becoming more and more diverse. The touch screen of an electronic device can display a human-computer interaction interface (also called a user interface). Users perform gesture operations on objects in the user interface, and the objects in the user interface respond with some animations based on the user's gesture operations. For example, an object performs a deformation animation in response to a user's drag gesture, and an object performs a fragmentation animation in response to a user's click gesture.

[0003] However, the animation responses of objects in the user interface to user gesture operations are usually some pre-set fixed animations. That is, the animation effects generated for different objects in the user interface are the same. The interactive experience of the animations in which such objects participate is poor. Summary of the invention

[0004] The embodiments of the present application provide a method for generating animations of objects in an interface, an electronic device, and a storage medium, which can generate differentiated animations based on the appearance differences between objects, thereby improving the user's interactive experience.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, an embodiment of the present application provides a method for generating an animation of an object in an interface, comprising:

[0007] The user interface displays a first object and a second object, the first object and the second object are of the same type but different in appearance;

[0008] In response to a first operation performed on the first object, generating a first motion animation of the first object;

[0009] In response to a second operation performed on the second object, a second motion animation of the second object is generated, the first operation and the second operation are the same, and the first motion animation and the second motion animation are different.

[0010] In the embodiment of the present application, the same type of the first object and the second object means that the first object and the second object belong to the same class of objects. The different appearances of the first object and the second object means that the first object and the second object are objects with different appearances.

[0011] For example, when the first object is the icon of APP1 and the second object is the icon of APP2, both the first object and the second object are icons of APP, but the appearance of the icon of APP1 and the icon of APP2 are different, so the type of the icon of APP1 and the icon of APP2 are the same, but the appearance is different. When the first object is the business card of user 1 and the second object is the business card of user 2, both the first object and the second object are user business cards, but the content in the business card of user 1 and the content in the business card of user 2 are different, so the type of user 1 and user 2 are the same, but the appearance is different. In an instant messaging application, the first object is the avatar of user 1 and the second object is the avatar of user 2. Both the first object and the second object are user avatars, but user 1 and user 2 use different pictures as avatars, so the type of the avatar of user 1 and the avatar of user 2 are the same, but the appearance is different.

[0012] In the embodiment of the present application, the first operation and the second operation are the same, which means that the first operation and the second operation belong to the same type of operations.

[0013] As an example, the first operation is a sliding operation of sliding a first distance, and the second operation is a sliding operation of sliding a second distance, then the first operation and the second operation are both sliding operations, therefore, the sliding operation of sliding the first distance is the same as the sliding operation of sliding the second distance. The first operation is a pressing operation with a pressing duration of a first time, and the second operation is a pressing operation with a pressing duration of a second time, and the first operation and the second operation are both pressing operations, therefore, the pressing operation with a pressing duration of the first time is the same as the pressing operation with a pressing duration of the second time. The first operation is a single-click operation, and the second operation is also a single-click operation, then the first operation and the second operation are the same.

[0014] In the embodiment of the present application, the first motion animation and the second motion animation are different, which means that there is a difference between the first motion animation and the second motion animation.

[0015] As an example, in the first motion animation of the first object, the motion displacement of the first object is the third distance, and in the second motion animation of the second object, the motion displacement of the second object is the fourth distance. If the third distance and the fourth distance are different, the first motion animation and the second motion animation are different. In the first motion animation of the first object, the first object rebounds m times after being pressed, and the second object rebounds n times after being pressed, and m and n are different, then the first motion animation and the second motion animation are different. If the deformation area of ​​the first object after being pressed is larger than the deformation area of ​​the second object after being pressed, then the first motion animation and the second motion animation are different.

[0016] It can be understood from the above description that for objects of the same type but different appearances, when the same operation is performed, the objects will produce differentiated motion animations, thereby improving the user's interactive experience.

[0017] In a possible implementation manner of the first aspect, in response to a first operation acting on a first object, generating a first motion animation of the first object includes:

[0018] detecting a first operation acting on a first object;

[0019] Acquire appearance parameters of the first object, and assign physical parameters to the first object according to the appearance parameters of the first object;

[0020] Get initial parameters of the first object;

[0021] A motion animation of the first object is generated based on the physical parameters of the first object and the initial parameters of the first object.

[0022] In the embodiment of the present application, the first operation acting on the first object may be a click operation, a press operation (long press operation), a sliding operation, etc., by the user on the first object. The appearance parameters of the first object may include: the color of the pixel points in the first object, the coordinates of the pixel points in the first object, the area or volume of the first object, the theme color in the user interface where the first object is located, the transparency of the first object, the blurriness of the first object, etc. It can be understood from the description of the appearance parameters of the first object that the appearance parameters of the first object are parameters that can be intuitively observed from the user's visual perspective. The embodiment of the present application assigns physical parameters to the first object based on the appearance parameters of the first object, so that the physical parameters of the first object follow the visual perception of the user in the real world. When the first operation is a press operation, the initial parameter of the first object may be the value of the pressing force applied to the first object (the value may be a fixed value, or may be obtained according to parameters such as the contact area of ​​the press operation), or the position of the pressing force applied to the first object. When the first operation is a push operation, the initial parameter of the first object may be the initial speed set for the first object, or may be the thrust generated according to the push distance of the push operation. The initial parameters of the first object may refer to the description in the subsequent embodiments.

[0023] The motion parameters of the object generated by the physical parameters of the object can be more consistent with the motion process of the object in the real world. Therefore, the motion animation of the object obtained by the embodiment of the present application can not only provide differentiated animation effects between different objects, but also make the generated motion animation of the object more consistent with the motion process of the object in the real world, thereby improving the user's interactive experience.

[0024] In the embodiment of the present application, in response to the second operation on the second object, the process of generating the second motion animation of the second object can refer to the description of "in response to the first operation on the first object, generating the first motion animation of the first object", which will not be repeated here. In a possible implementation of the first aspect, the appearance parameters of the first object include: the color of the pixel points in the first object, and the physical parameters of the first object include: the mass of the first object;

[0025] Assigning physical parameters to the first object according to the appearance parameters of the first object includes:

[0026] The mass of the first object is generated according to the colors of the pixels in the first object.

[0027] In a possible implementation manner of the first aspect, generating the quality of the first object according to the color of a pixel in the first object includes:

[0028] A first quality value of the first object is generated according to a first difference between a color of a pixel in the first object and a theme color of a user interface where the first object is located, and the first quality value of the first object is used as the quality of the first object.

[0029] In a possible implementation manner of the first aspect, generating a first quality value of the first object according to a first difference between a color of a pixel in the first object and a theme color of a user interface where the first object is located includes:

[0030] generating a pixel quality of the pixel in the first object according to a first difference between a color of the pixel in the first object and a theme color of the user interface where the first object is located;

[0031] A first quality value of the first object is generated according to the pixel quality of the pixels in the first object.

[0032] As an example, the pixel quality of each pixel in the first object is calculated by the following formula:

[0033] or,

[0034] Among them, m i represents the quality of the i-th pixel in the first object, a i represents the color of the i-th pixel in the first object, and b represents the color of the theme of the user interface.

[0035] In practical applications, the quality of each pixel obtained by calculation can also be normalized:

[0036] m i '=(m i -μ) / (m max -mmin );

[0037] Among them, m i ' represents the normalized quality of the i-th pixel in the first object, μ is a self-defined constant, m max Indicates the maximum value of the color, which can be set to 0XFFFFFF, m min Indicates the minimum value of the color, which can be set to 0X000000.

[0038] Finally, the first mass value of the first object (which can be used as the mass of the first object) is calculated in the following way:

[0039]

[0040] Where M represents the mass of the first object, m i ' represents the normalized quality of the i-th pixel in the first object, and n represents the number of pixels in the first object.

[0041] In a possible implementation manner of the first aspect, the appearance parameter of the first object includes: transparency of the first object; and before taking the first mass value of the first object as the mass of the first object, further including:

[0042] A second mass value of the first object is generated according to the transparency of the first object and the first mass value of the first object, and the second mass value of the first object is used as the mass of the first object.

[0043] As an example, when the influence of the transparency of the first object on the quality is considered, the second quality value of the first object (which can be used as the quality of the first object) is calculated by the following formula:

[0044]

[0045] Wherein, K represents a transparency coefficient. K can take a value in the range of 0-1. The more transparent the first object is, the smaller K is, and the lighter the mass of the first object is.

[0046] In a possible implementation manner of the first aspect, the appearance parameters of the first object include: the color of a pixel in the first object and the coordinates of the pixel in the first object; the physical parameters of the first object include: the coordinates of the center of gravity of the first object;

[0047] Assigning physical parameters to the first object according to the appearance parameters of the first object includes:

[0048] generating a pixel quality of the pixel in the first object according to a first difference between a color of the pixel in the first object and a theme color of the user interface where the first object is located;

[0049] The coordinates of the center of gravity of the first object are calculated according to the coordinates of the pixels in the first object and the pixel qualities of the pixels in the first object.

[0050] As an example, in a two-dimensional space, a spatial rectangular coordinate system O-XY is used. The first object can be infinitesimally divided into n particles (or n pixels), and the coordinates of the i-th particle are (x i ,y i ), the mass of the i-th particle is m i ', the mass of the first object M = m1' + ... + m i '+…+m n '.

[0051] The coordinates of the center of gravity of the first object are G(x, y), which are calculated by the following formula.

[0052] x=(x1m1'+…+x i m i '+…+x n m n ') / M;

[0053] y=(y1m1'+…+y i m i '+…+y n m n ') / M.

[0054] In three-dimensional space, determine the spatial rectangular coordinate system O-XYZ. The first object can be infinitesimally divided into n particles (or n pixels), and the coordinates of the i-th particle are (x i ,y i ,z i ), the mass of the i-th particle is m i ', the mass of the first object M = m1' + ... + m i '+…+m n '.

[0055] The coordinates of the center of gravity of the first object are G(x, y, z), which are calculated by the following formula.

[0056] x=(x1m1'+…+x i m i '+…+x n m n ') / M;

[0057] y=(y1m1'+…+y i m i '+…+y n m n ') / M;

[0058] z=(z1m1'+…+z im i '+…+z n m n ') / M.

[0059] In a possible implementation manner of the first aspect, the appearance parameters of the first object further include: the color of the outer frame of the first object, the area or volume of the first object; the physical parameters of the first object include: the stiffness of the first object;

[0060] Assigning physical parameters to the first object according to the appearance parameters of the first object includes:

[0061] Calculating a second difference between the color of the outer border of the first object and the theme color of the user interface where the first object is located;

[0062] Generate a unit mass of the first object according to the mass of the first object and the area or volume of the first object;

[0063] A first stiffness of the first object is generated according to the second difference and the unit mass of the first object, and the first stiffness of the first object is used as the stiffness of the first object.

[0064] The stiffness of the first object is:

[0065] G=|bc|×k G ×M s ;

[0066] Where G represents the rigidity of the first object, b represents the theme color of the user interface, c represents the color of the outer border of the first object, and k G Represents the stiffness conversion factor, M s M represents the unit mass of the first object. For ease of description, the difference between the color of the outer frame of the first object and the theme color of the user interface where the first object is located is recorded as the second difference. When the first object is a two-dimensional element, M s =M / S, S represents the area of ​​the first object; when the first object is a three-dimensional element, M s =M / V, where V represents the volume of the first object.

[0067] In a possible implementation manner of the first aspect, the appearance parameter of the first object further includes: transparency of the first object; and before taking the first stiffness of the first object as the stiffness of the first object, further includes:

[0068] A second stiffness of the first object is generated according to the first stiffness of the first object and the transparency of the first object, and the second stiffness of the first object is used as the stiffness of the first object.

[0069] G=|bc|×K×k G ×M s .

[0070] In a possible implementation manner of the first aspect, the appearance parameter of the first object further includes: blurriness of the first object; and before taking the first stiffness of the first object as the stiffness of the first object, further includes:

[0071] A third stiffness of the first object is generated according to the first stiffness of the first object and the fuzziness of the first object, and the third stiffness of the first object is used as the stiffness of the first object.

[0072] G=|bc|×k×M s ×A.

[0073] Wherein, A represents the blurriness of the first object.

[0074] Of course, in practical applications, the transparency and blurriness of the first object can also be considered at the same time:

[0075] G=|bc|×K×k G ×M s ×A.

[0076] For the convenience of description, the stiffness of the first object generated without considering the transparency and blurriness of the first object can be recorded as the first stiffness, the stiffness of the first object generated by considering the transparency of the first object can be recorded as the second stiffness, the stiffness of the first object generated by considering the blurriness of the first object can be recorded as the third stiffness, and the stiffness generated by considering both the transparency and blurriness of the first object can be recorded as the fourth stiffness. In practical applications, any one of the first stiffness, the second stiffness, the third stiffness and the fourth stiffness can be used as the stiffness of the first object.

[0077] In a possible implementation manner of the first aspect, the method further includes:

[0078] generating a relative friction coefficient between the first object and the background where the first object is located according to the base color of the first object and the color of the background where the first object is located;

[0079] A first friction force acting on the first object is calculated according to the mass and the relative friction coefficient of the first object, and the first friction force is used as the friction force acting on the first object during the movement of the first object.

[0080] As an example, F f =M×O BE ;

[0081] Among them, F f is the friction force acting on the first object, M is the mass of the first object, O BE is the relative friction coefficient between the first object and the background where the first object is located.

[0082] In a possible implementation manner of the first aspect, generating a relative friction coefficient between the first object and the background where the first object is located according to a base color of the first object and a color of a background where the first object is located includes:

[0083] generating an object friction force for the first object according to a base color of the first object;

[0084] generating a background friction force of the background where the first object is located according to the color of the background where the first object is located;

[0085] A relative friction coefficient between the first object and the background where the first object is located is generated according to the object friction force and the background friction force.

[0086] As an example, O BE =B f ×E f .

[0087] B f =e1+|0XFFFFFF-d|×k fB ;

[0088] Among them, B f is the background friction, e1 is the minimum background friction, d is the color of the background where the first object is located, k fB is the preset background friction conversion factor.

[0089] E f =e2+|0XFFFFFF-a|×k fE ;

[0090] Among them, E f is the object friction, e2 is the minimum object friction, a is the color of the first object, k fE The friction conversion factor of the preset object.

[0091] In a possible implementation manner of the first aspect, the appearance parameter of the first object further includes: blurriness of the first object; and before using the first friction force as the friction force acting on the first object during the movement of the first object, further includes:

[0092] A second friction force acting on the first object is generated according to the first friction force and the blurriness of the first object, and the second friction force is used as the friction force acting on the first object during the movement of the first object.

[0093] As an example,

[0094] Wherein, A represents the blurriness of the first object, and the blurriness of the first object can take a value between 0 and 1. The blurrier the first object is, the smaller the value of A is, and the greater the friction is. Therefore, the blurriness of the first object is inversely related to the friction.

[0095] In a possible implementation manner of the first aspect, the method further includes:

[0096] The speed of the first object is acquired, and the air resistance acting on the first object during the movement of the first object is generated according to the speed of the first object.

[0097] In a possible implementation manner of the first aspect, generating a motion animation of the first object based on a physical parameter of the first object and an initial parameter of the first object includes:

[0098] generating motion parameters of the first object based on the physical parameters of the first object and the initial parameters of the first object;

[0099] A motion animation of the first object is generated according to the motion parameters of the first object.

[0100] In a possible implementation manner of the first aspect, after the first operation acts on the first object, the first object collides with the third object;

[0101] The physical parameters of the first object include the mass of the first object, and the initial parameters of the first object include the first input velocity of the first object;

[0102] Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:

[0103] Acquire physical parameters of a third object and initial parameters of the third object, wherein the physical parameters of the third object include the mass of the third object, and the initial parameters of the third object include the second input velocity of the third object;

[0104] Based on the law of conservation of momentum and the law of conservation of energy, a first exit velocity of the first object and a second exit velocity of the third object are calculated from the mass of the first object, the mass of the third object, the first entry velocity and the second entry velocity;

[0105] Calculating a time-varying velocity and / or displacement of the first object after the collision based on a first exit velocity of the first object and a friction force acting on the first object after the collision;

[0106] The time-varying speed and / or displacement of the third object after the collision is calculated according to the second exit speed of the third object and the friction force acting on the third object after the collision.

[0107] As an example, the first exit speed of the first object and the second exit speed of the third object are calculated by formula (1) and formula (2). Then, the speed of the first object changing with time is calculated by formula (3) and formula (4).

[0108] (1)M A v ruA +M B v ruB =M A v A0 +M B v B0 ;

[0109] (2)1 / 2M A v ruA 2 +1 / 2M B v ruB 2 =1 / 2M A v A0 2 +1 / 2M B v B0 2 ;

[0110] (3)v At =v A0 +a A t;

[0111] (4)a A =F fA +F zA / M A ;

[0112] Among them, v ruA represents the velocity of object A (the first object) at the time of collision (the first entry velocity), v ruB represents the velocity (second input velocity) of object B (the third object) at the time of collision, v A0 represents the velocity of object A after the collision (first exit velocity), v B0 Indicates the velocity of object B after the collision (second exit velocity). At Indicates the speed at which object A changes over time.

[0113] In a possible implementation manner of the first aspect, after the first operation acts on the first object, the first object collides with the third object;

[0114] The physical parameters of the first object include the mass of the first object, and the initial parameters of the first object include the first input velocity of the first object;

[0115] Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:

[0116] Acquire physical parameters of a third object and initial parameters of the third object, wherein the physical parameters of the third object include the mass of the third object, and the initial parameters of the third object include the second input velocity of the third object;

[0117] Based on the law of conservation of momentum and the law of conservation of energy, a first exit velocity of the first object and a second exit velocity of the third object are calculated from the mass of the first object, the mass of the third object, the first entry velocity and the second entry velocity;

[0118] Calculating a time-varying velocity and / or displacement of the first object after the collision based on a first exit velocity of the first object and a friction force acting on the first object after the collision;

[0119] The time-varying speed and / or displacement of the third object after the collision is calculated according to the second exit speed of the third object and the friction force acting on the third object after the collision.

[0120] (5)v chu =v ru ×E lose .

[0121] (6)E lose =(G A +G B ) / 2×G max , G max The maximum constant for the custom stiffness.

[0122] When object B is a fixed position object, the velocity assigned to object B is 0. Therefore, v chu All are assigned to object A, that is, (7)v A0 =v chu , v B0 =0.

[0123] When object B is an object with a non-fixed position, (8)

[0124] The sum v of the third exit speed of object A and the fourth exit speed of object B is calculated by formula (5) and formula (6): chu Then, the third exit speed of object A and the fourth exit speed of object B are calculated by formula (7) or formula (8).

[0125] Finally, the speed of the first object changing with time is calculated by using formula (3) and formula (4).

[0126] In a possible implementation manner of the first aspect, the first operation is a pressing operation on the first object, and the first object generates a pressing rebound;

[0127] The physical parameters of the first object include: the mass of the first object; the initial parameters of the first object include: the rebound degree acting on the first object and the elastic coefficient of the elastic component acting on the first object;

[0128] Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:

[0129] generating a first rebound force acting on the first object according to the rebound degree and the mass of the first object;

[0130] Calculating a pressing displacement of the first object according to the first resilience force and the elastic coefficient;

[0131] Calculating elastic potential energy in the scene where the first object is located according to the pressing displacement and elastic coefficient of the first object;

[0132] Based on a model in which elastic potential energy is equal to kinetic energy of the first object and work done by air resistance acting on the first object, motion parameters of the first object are obtained.

[0133] (9)F T =K T / M;

[0134] (10) x = F T / k,x p =G / k, pressing displacement: xx p ;

[0135] (11)

[0136] The first rebound force is calculated according to formula (9), the pressing displacement is calculated according to formula (10), and formula (11) represents the relationship between the elastic potential energy, the kinetic energy of the first object and the work done by the air resistance.

[0137] In a possible implementation manner of the first aspect, the physical parameter of the first object further includes: stiffness of the first object;

[0138] Calculating the pressing displacement of the first object according to the first resilience force and the elastic coefficient includes:

[0139] generating a second resilience force acting on the first object according to the first resilience force and the stiffness of the first object;

[0140] A pressing displacement of the first object is generated according to the second resilience force and the elastic coefficient.

[0141] In a possible implementation manner of the first aspect, the first operation is a pressing operation on the first object, and the first object is tilted by the pressing;

[0142] The physical parameters of the first object include: the center of gravity of the first object; the initial parameters of the first object include: the force point of the pressing force acting on the first object;

[0143] When the first object generates a pressing and tilting motion, the tilting axis of the first object is perpendicular to a first connecting line, which is a connecting line between a force point of the pressing force acting on the first object and the center of gravity of the first object.

[0144] In a possible implementation manner of the first aspect, the tilt axis of the first object coincides with the center of gravity of the first object.

[0145] In a possible implementation manner of the first aspect, the first operation is a pressing operation acting on the first object, and the first object generates a pressing deformation;

[0146] The physical parameters of the first object include: the stiffness of the first object; the initial parameters of the first object include the pressing force acting on the first object and the force point of the pressing force; the motion parameters of the first object include the deformation area of ​​the first object;

[0147] Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:

[0148] Calculating a deformation degree of the first object according to a pressing force acting on the first object and a stiffness of the first object;

[0149] Calculating a deformation area of ​​the first object according to the deformation degree of the first object and the area of ​​the first object;

[0150] A deformation region of the first object is generated according to the deformation area of ​​the first object, wherein the center of the deformation region is a force point of the pressing force acting on the first object.

[0151] In a possible implementation of the first aspect, when the first operation acts on the first object, a chain motion is generated between the first object and a fourth object arranged in a chain manner with the first object, wherein the chain force received by the fourth object is the chain force received by the force-applying object of the fourth object divided by the mass of the fourth object.

[0152] In a second aspect, an embodiment of the present application provides an electronic device, including:

[0153] An object display module, used for displaying a first object and a second object on a user interface, wherein the first object and the second object are of the same type but have different appearances;

[0154] An animation generation module, for generating a first motion animation of the first object in response to a first operation acting on the first object;

[0155] The animation generation module is further used to generate a second motion animation of the second object in response to a second operation acting on the second object, the first operation and the second operation are the same, and the first motion animation and the second motion animation are different.

[0156] According to a third aspect, an electronic device is provided, comprising a processor, wherein the processor is used to run a computer program stored in a memory so that the electronic device implements any method of the first aspect of the present application.

[0157] In a fourth aspect, a chip system is provided, including a processor, wherein the processor is coupled to a memory, and the processor executes a computer program stored in the memory so that an electronic device implements any method of the first aspect of the present application.

[0158] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by one or more processors, an electronic device implements any method of the first aspect of the present application.

[0159] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when executed on a device, enables the device to execute any one of the methods in the first aspect.

[0160] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0161] Figure 1 A schematic diagram of an application scenario of a method for generating animation of an object in an interface provided by an embodiment of the present application;

[0162] Figure 2 A schematic diagram of the hardware structure of an electronic device for executing the animation generation method of an object in an interface provided in an embodiment of the present application;

[0163] Figure 3 A schematic diagram of a flow chart of a method for generating animation of an object in an interface provided in an embodiment of the present application;

[0164] Figure 4 A schematic diagram of the outer border color of an object in a computing interface provided in an embodiment of the present application;

[0165] Figure 5(a) to Figure 5(d) A schematic diagram of a scene of a collision animation of objects in an interface provided by an embodiment of the present application;

[0166] Figure 6(a) to Figure 6(d) A schematic diagram of a scene of a pressing rebound animation of an object in an interface provided by an embodiment of the present application;

[0167] Figure 7(a) to Figure 7(c)A schematic diagram of a scene of a pressing and tilting animation of an object in an interface provided by an embodiment of the present application;

[0168] Figure 8(a) to Figure 8(b) A schematic diagram of the force of a pressing and tilting animation of an object in an interface provided by an embodiment of the present application;

[0169] Figure 9(a) to Figure 9(c) A schematic diagram of a scene of a pressing animation of an object in an interface provided by an embodiment of the present application;

[0170] Fig.10 A schematic diagram of a scene of a three-dimensional animation and a two-dimensional animation of an object in an interface provided by an embodiment of the present application;

[0171] Fig.11 A schematic diagram of a scene of three-dimensional animation and two-dimensional animation of an object in another interface provided by an embodiment of the present application;

[0172] Fig.12 A schematic diagram of the structure of a chain arrangement of objects in an interface provided by an embodiment of the present application;

[0173] Fig.13 An animation schematic diagram of a chain animation of an object in an interface provided by an embodiment of the present application;

[0174] Fig.14 A schematic block diagram of a functional architecture module of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0175] In the following description, specific details such as specific system structures and technologies are provided for illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details.

[0176] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0177] It should also be understood that in the embodiments of the present application, "one or more" refers to one, two or more than two; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B may be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0178] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0179] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0180] The method for generating animation of an object in an interface provided by the embodiment of the present application can be applied to Figure 1 In the application scenario shown in Figure 1 As shown, the display screen of the electronic device displays a user interface, Figure 1 The first figure in the figure shows a contact interface, in which there are contact business cards, and each contact business card can be used as an object. Figure 1 The second figure in the figure shows the main interface of the electronic device, and the icon of each application in the main interface of the electronic device can also be used as an object. When the user's gesture acts on the object in the interface, the object moves in the interface, thereby generating a motion animation of the object. In order to make the motion animation of the object in the interface closer to the motion process of the object in the real world, some physical parameters can be given to the objects in the interface, such as the mass of the object, the stiffness of the object, etc. Then, based on the physical parameters of the object and the initial parameters of the object (for example, the thrust acting on the object, the initial speed of the object, etc.), the motion parameters of the object are calculated, such as the speed of the object changing over time, the displacement of the object changing over time, etc. Finally, the motion animation of the object is generated based on the motion parameters of the object.

[0181] As an example, when two objects in the interface collide, one of the objects may rebound. However, for different objects, the speed and displacement of the rebound may be different. These differences are based on the physical parameters of the object, rather than the different animation effects pre-set by the developer for different objects. Since the motion animation of the object is related to the physical parameters of the object, in order to obtain differentiated motion animations between different objects and make the motion animation of the object more consistent with the motion process of objects in the real world, it is necessary to give each object personalized physical parameters. The user's perception of objects in the user interface comes from the appearance parameters of the objects, such as the color of the pixels in the object, the transparency of the object, etc. Therefore, personalized physical parameters for each object can be generated based on the appearance parameters of each object.

[0182] In the method for generating animation of objects in an interface provided in an embodiment of the present application, it is first necessary to generate physical parameters of the object based on the appearance parameters of the object; then, generate motion parameters of the object according to the physical parameters of the object and the initial parameters of the object; finally, generate motion animation of the object according to the motion parameters of the object.

[0183] Based on the above understanding, at least two objects of the same type can be displayed in the user interface, such as Figure 1 The application A in the second user interface shown (which can be Figure 4 calendar icon shown) and application C (which can be Figure 4 Since both application A and application C are icons of APP, application A and application C are of the same type. Since application A and application C are icons of different APPs, application A and application C have different appearances ( Figure 4 Color-related appearance differences are not shown).

[0184] When the user pushes right on application A, application A moves to the right and hits application B, then is rebounded and moves to the left, while application B remains stationary. The rebound movement of application A can be illustrated by the motion animation of object A shown in FIG5(b). After the collision, application A rebounds and moves in the opposite direction of its original motion direction. The motion animation of the collided application B can be illustrated by the motion animation of object B shown in FIG5(b), while application B remains stationary.

[0185] When the user performs a push operation to the left on application C, after application C moves to the left and hits application B, application C continues to move to the left, and application B also moves to the left. The motion animation of application C can be illustrated with reference to the motion animation of object A shown in Figure 5(c). After the collision, application C moves in the same direction as the original motion direction. The motion animation of the collided application B can be illustrated with reference to the motion animation of object B shown in Figure 5(c). Application B and application C maintain movement in the same direction. The operation performed by the user on application A is a push operation to the right, and the operation performed by the user on application C is a push operation to the left. Although there are differences in the operation directions, they are both push operations, so the push operation performed by the user on application A to the right and the push operation performed by the user on application C to the left are the same operation. The above operation process can be understood as giving the same thrust value or the same initial velocity value to application A and application C.

[0186] It can be understood from the motion animation of object A and object B shown in Figure 5(b) and the motion animation of object A and object B shown in Figure 5(c) that when the same operation is applied to application A and application C, and the objects that application A and application C collide with are also the same, the motion animations generated by application A and application C are different.

[0187] The reason for the different motion animations is that the appearance of application A makes application A look like a lighter object in the real world. The appearance of application C makes application C look like a heavier object in the real world. In the real world, these two objects may produce different motions when they collide with the same object. Therefore, the method for generating animations of objects in the interface provided by the embodiment of the present application can generate differentiated animations based on the differences in appearance between objects; and the generated animations of objects are closer to the motions of objects in the real world.

[0188] How to obtain the mass or other physical parameters of the object according to the appearance of the object in the above embodiment can refer to the description of the subsequent embodiments.

[0189] As another example, Figure 1 The application A and application D displayed in the second interface are both APP icons, that is, they are of the same type. Since the appearance of application A and application D are different, when the user presses on application A and application B respectively, application A may rebound twice after being pressed, and application B may rebound four times after being pressed. That is, the motion animations generated by application A and application D with different appearances for the same operation are different. For the generation process of the motion animation of pressing and rebounding, please refer to the description in the subsequent embodiments.

[0190] Need to explain, Figure 1 The application scenario shown is only an example. In actual applications, there may be other application scenarios. The embodiment of the present application does not limit the application scenario of the animation generation method of objects in the interface.

[0191] The embodiment of the present application provides a method for generating animation of an object in an interface, which can be applied to electronic devices. The electronic device can be: a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a smart speaker, a smart screen, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), and other electronic devices. The embodiment of the present application does not limit the specific type of electronic device.

[0192] Figure 2 The schematic diagram of the structure of an electronic device is shown. The electronic device 200 may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a motor 291, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc. The sensor module 280 may include a pressure sensor 280A, a gyroscope sensor 280B, an acceleration sensor 280E, a touch sensor 280K, etc.

[0193] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 200. In other embodiments of the present application, the electronic device 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0194] The processor 210 may include one or more processing units, for example: the processor 210 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 210 is used to execute the animation generation method of the object in the interface in the embodiment of the present application.

[0195] The controller may be the nerve center and command center of the electronic device 200. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0196] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.

[0197] In some embodiments, the processor 210 may include one or more interfaces, which may include a subscriber identity module (SIM) interface and / or a universal serial bus (USB) interface.

[0198] The USB interface 230 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 230 can be used to connect a charger to charge the electronic device 200, and can also be used to transfer data between the electronic device 200 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0199] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0200] The internal memory 221 may be used to store computer executable program codes, which may include instructions. The processor 210 executes various functional applications and data processing of the electronic device 200 by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area.

[0201] In addition, the internal memory 221 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0202] The charging management module 240 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 240 may receive charging input from a wired charger through the USB interface 230. In some wireless charging embodiments, the charging management module 240 may receive wireless charging input through a wireless charging coil of the electronic device 200. While the charging management module 240 is charging the battery 242, it may also power the electronic device through the power management module 241.

[0203] The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the external memory, the display screen 294, the camera 293, and the wireless communication module 260. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle number, and battery health status (leakage, impedance).

[0204] In some other embodiments, the power management module 241 may also be disposed in the processor 210. In some other embodiments, the power management module 241 and the charging management module 240 may also be disposed in the same device.

[0205] The wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.

[0206] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0207] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 200. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.

[0208] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 250 or other functional modules.

[0209] The wireless communication module 260 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 200. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 210. The wireless communication module 260 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0210] In some embodiments, the antenna 1 of the electronic device 200 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 200 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and / or the satellite based augmentation system (SBAS).

[0211] The electronic device 200 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.

[0212] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 200 may include 1 or N display screens 294, where N is a positive integer greater than 1. As an example, the display screen of the electronic device can display a user interface.

[0213] The electronic device 200 can implement audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone jack 270D, and the application processor.

[0214] The audio module 270 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 270 can also be used to encode and decode audio signals. In some embodiments, the audio module 270 can be arranged in the processor 210, or some functional modules of the audio module 270 can be arranged in the processor 210.

[0215] The speaker 270A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 200 can listen to music or listen to a hands-free call through the speaker 270A.

[0216] The receiver 270B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 200 receives a call or voice message, the voice can be received by placing the receiver 270B close to the human ear.

[0217] Microphone 270C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 270C to input the sound signal into the microphone 270C. The electronic device 200 can be provided with at least one microphone 270C. In other embodiments, the electronic device 200 can be provided with two microphones 270C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 200 can also be provided with three, four or more microphones 270C to realize the collection of sound signals, noise reduction, identification of sound sources, realization of directional recording functions, etc. For example, the microphone 270C can be used to collect audio signals involved in the embodiments of the present application.

[0218] The earphone interface 270D is used to connect a wired earphone and can be a USB interface 230 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0219] The pressure sensor 280A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 280A can be set on the display screen 294. There are many types of pressure sensors 280A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 280A, the capacitance between the electrodes changes. The electronic device 200 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 294, the electronic device 200 detects the intensity of the touch operation according to the pressure sensor 280A, thereby generating an external force acting on the object in the interface, so that the object in the interface produces a corresponding movement based on the external force.

[0220] The gyro sensor 280B can be used to determine the motion posture of the electronic device 200. In some embodiments, the angular velocity of the electronic device 200 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 280B. The gyro sensor 280B can be used for anti-shake shooting. Exemplarily, when the shutter is pressed, the gyro sensor 280B detects the angle of the electronic device 200 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 200 through reverse movement to achieve anti-shake. The gyro sensor 280B can also be used for navigation and somatosensory game scenes. As an example, the user can adjust the posture of the electronic device 200 so that the freely moving objects in the interface produce corresponding movements based on their own gravity.

[0221] The acceleration sensor 280E can detect the magnitude of the acceleration of the electronic device 200 in various directions (generally three axes). When the electronic device 200 is stationary, the magnitude and direction of gravity can be detected. As an example, the user can adjust the acceleration of the electronic device 200 and apply corresponding acceleration to the objects moving freely in the interface, so that the objects moving freely in the interface generate corresponding movements based on the acceleration.

[0222] The touch sensor 280K is also called a "touch panel". The touch sensor 280K can be set on the display screen 294, and the touch sensor 280K and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. As an example, the electronic device 200 can detect the position of the external force applied by the user to the object through the touch sensor, so that the object in the interface produces corresponding movement based on the position of the external force.

[0223] Motor 291 can generate vibration prompts. Motor 291 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 294, motor 291 can also correspond to different vibration feedback effects. As an example, the electronic device 200 can generate corresponding vibration effects based on the motion animation of objects in the interface. For example, when two objects collide, a vibration feedback effect can be generated.

[0224] The SIM card interface 295 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 200 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295. The electronic device 200 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 295 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 295 can also be compatible with different types of SIM cards. The SIM card interface 295 can also be compatible with external memory cards. The electronic device 200 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 200 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 200 and cannot be separated from the electronic device 200.

[0225] The embodiments of the present application do not particularly limit the specific structure of the execution subject of the method for generating an animation of an object in an interface. As long as the program that records the method for generating an animation of an object in an interface provided by the embodiments of the present application can be run to communicate according to the method for generating an animation of an object in an interface provided by the embodiments of the present application. For example, the execution subject of the method for generating an animation of an object in an interface provided by the embodiments of the present application may be a functional module in an electronic device that can call and execute a program, or a communication device used in an electronic device, such as a chip.

[0226] The embodiment of the present application takes a scenario in which an electronic device generates a motion animation of an object on a user interface after an operation is performed on the object on the user interface as an example to describe the process of generating the motion animation of the object.

[0227] Reference Figure 3 FIG. 1 is a flow chart of a method for generating an animation of an object in an interface provided by an embodiment of the present application. As shown in the figure, the method includes:

[0228] Step 301: An operation on an object is detected.

[0229] like Figure 1 As shown, the object in the user interface can be an application icon in the main interface, or a contact card in the contact interface. In actual applications, the object in the user interface can be an element with color features and boundaries in the user interface. For example, icons, text with boundary boxes, images, various controls, etc.

[0230] Detecting an operation acting on the object may be detecting a gesture operation acting on the object, for example, detecting a drag operation, a press operation, etc., acting on the object.

[0231] Detecting an operation on an object may also be detecting an operation on the object by other objects. For example, if object A collides with object B during movement, detecting an operation on object B may be detecting a collision of object A with object B.

[0232] Step 302: Acquire appearance parameters of the object, and assign physical parameters to the object according to the appearance parameters of the object.

[0233] In the embodiment of the present application, the display screen of the electronic device can present a user interface, and the embodiment of the present application regards the objects in the user interface as objects in the real world. Since objects in the real world have some physical parameters, such as mass, center of gravity, stiffness, etc. Therefore, if the objects in the user interface of the electronic device are to have a motion process similar to that in the real world, some physical parameters need to be assigned to the objects in the user interface of the electronic device.

[0234] In order to improve the user's interactive experience, physical parameters can be assigned to objects from the perspective of the user's perception of the object. The user's perception of the object in the user interface comes from the appearance of the object, such as the color of the object, the color distribution of the object, the transparency of the object, the blurriness of the object, etc. In order to enable the processor of the electronic device to obtain the appearance of the object, the color of the pixel points in the object, the coordinates of the pixel points in the object, the transparency of the object, the blurriness of the object, etc. can be obtained. In the embodiment of the present application, these parameters are recorded as the appearance parameters of the object.

[0235] For example, the darker the color of the object, the greater the unit mass of the object. For example, the color of the object is divided into multiple levels, and different levels correspond to different unit masses. Alternatively, a functional relationship between the unit mass of the object and the color of the object is set, and the unit mass of the object is generated through the functional relationship and the color of the object.

[0236] As another example, the more blurred the object is, the greater the roughness of the object is, and the greater the friction coefficient is when the object rubs against other objects. A functional relationship between the friction coefficient between the object and the background where the object is located and the blurriness of the object and the blurriness of the background can also be set, and the friction coefficient between the object and the background is obtained through the functional relationship and the blurriness of the object and the blurriness of the background.

[0237] The above process of assigning physical parameters to an object according to the appearance parameters of the object is only for example. For the process of assigning different physical parameters to an object according to different appearance parameters of the object, reference may be made to the description in subsequent embodiments.

[0238] Step 303, obtaining initial parameters of the object.

[0239] In the real world, an object may move when it is acted upon by an external force. The external force acting on the object may be the initial parameter of the object.

[0240] As an example, when the operation on the object is a pressing operation, the initial parameter of the object may be the value of the pressing force applied to the object (this value may be a fixed value or may be obtained based on parameters such as the force area of ​​the pressing operation), or the initial parameter of the object may be the position of the pressing force applied to the object. When the operation on the object is a pushing operation, the initial parameter of the object may be the thrust generated based on the pushing distance of the pushing operation.

[0241] In some embodiments, to simplify the process of generating a motion animation of an object, an initial velocity may be assigned to the object as an initial parameter of the object.

[0242] As an example, when the operation acting on the object is a push operation, the initial parameter of the object may be the initial velocity of the object. After the user stops pushing, the object moves at a constant speed at the initial velocity, or the object decelerates at the initial velocity according to the friction force. When the object moves at a constant speed at the initial velocity, if there is another object on the motion trajectory of the object, the object collides with the other object.

[0243] The initial parameters of the object may also be other parameters, and the details may refer to the description in the subsequent embodiments.

[0244] Step 304: Generate a motion animation of the object based on the physical parameters of the object and the initial parameters of the object.

[0245] The movement of an object is not limited to displacement in a narrow sense, but may also be deformation of the object. That is, as long as the position and / or shape of the object changes, the object is considered to have moved.

[0246] Taking the movement of an object that produces displacement as an example, the object may also be affected by air resistance, friction, etc. during the movement. In practical applications, the object's inherent mass, center of gravity, and stiffness and other parameters can be recorded as the object's static physical parameters, and the friction and air resistance that accompany the object's movement during the displacement can be recorded as the object's dynamic physical parameters. Of course, since friction and air resistance are only considered in motion animations of specific animation scenes, the object's inherent weight, center of gravity, and stiffness and other parameters can also be recorded as the object's physical parameters, while friction and air resistance are used as force parameters in specific animation scenes. The embodiments of the present application do not limit the division of these parameters.

[0247] In actual applications, the motion models (composed of one or more mathematical formulas) set in different animation scenes (for example, the object's pressing rebound scene, the object's pressing tilt scene, and the object's pressing deformation scene) may be different, resulting in different required physical parameters. Even in the same animation scene, due to the difference in the motion models used, the physical parameters used in the animation scene may be different. In view of the above understanding, in some embodiments of animation scenes, some or all of the above physical parameters may be used, and other physical parameters other than the above physical parameters may also be used, and this application does not limit this.

[0248] The motion animation of an object is usually reflected in at least two aspects: position and shape. Therefore, when there are multiple objects in a user interface, some objects can be set to be objects with unfixed positions and shapes, some objects to be objects with fixed positions and shapes, and some objects to be objects with fixed shapes or fixed positions. Applying external force to an object with unfixed position causes the object to produce animation related to position change; applying external force to an object with unfixed shape causes the object to produce animation related to shape change; when a user applies external force to an object with fixed position and fixed shape, the object with fixed position and fixed shape will not produce motion animation.

[0249] In addition, different animation scenes can be set for different objects. For example, if there is a spring under the contact business card, the animation scene set for the contact business card is a press-rebound scene; if the application icon is set to have a lower stiffness, the animation scene set for the application icon is a press-deformation scene.

[0250] Of course, in actual applications, different animation scenes can also be set for user gestures on objects. For example, a press-rebound scene can be set for the user's click gesture on the application icon, and a scene of movement along the sliding direction can be set for the user's sliding gesture on the application icon. When there are other objects along the sliding direction, the application icon can collide with other objects.

[0251] Of course, there may be other situations. When an object is affected by other objects, the motion scene of the object can be determined based on the motion state of the other objects. For example, it can be set that when an object (object A) is hit by another object (object B), the motion animation in which object A participates can be set as a collision scene (referred to as scene 1).

[0252] When the first operation acting on an object (object A) is a user gesture, object A may be set to a press and tilt scene (scenario 2 for short).

[0253] It can be understood from scenes 1 and 2 that different motion models (one or more mathematical formulas constitute the motion model) are used in different animation scenes. At the same time, since the movement of objects in the real world is a relatively complex motion process, in the process of generating the motion parameters of the object in the animation scene, the existing motion model may be improved or reset to a motion model that conforms to the animation scene to reduce the amount of calculation of the processor. The embodiment of the present application does not limit the motion model used.

[0254] As mentioned above, the motion model of the object can be composed of one or more mathematical formulas, the input parameters in the motion model include the physical parameters of the object (such as mass, stiffness, center of gravity, etc.) and the initial parameters of the object (such as the force acting on the object, the initial velocity of the object, etc.), and the output parameters of the motion model include the motion parameters of the object (such as the speed of the object changing over time, the displacement changing over time, the deformation area of ​​the object, etc.). According to the motion model composed of one or more mathematical formulas, as well as the physical parameters and initial parameters of the object, the motion parameters of the object can be obtained. The process of generating the motion parameters of the object can refer to the description in the subsequent embodiments. After obtaining the motion parameters of the object, the motion animation of the object can be obtained by simulation based on the motion parameters of the object. During the simulation, different animation engines may be used, and the corresponding motion parameters are set in the animation engine. By changing the motion parameters in the animation engine, the motion animation of the object is obtained by simulation.

[0255] In an embodiment of the present application, the appearance parameters of an object may include: the color of a pixel in the object, the coordinates of a pixel in the object, the area or volume of the object, the theme color in the user interface where the object is located, the transparency of the object, the blurriness of the object, etc. It can be understood from the description of the appearance parameters of the object that the appearance parameters of the object are parameters that can intuitively observe the differences between different objects from the user's visual perspective. The embodiment of the present application assigns physical parameters to the object based on the appearance parameters of the object, so that the physical parameters of the object follow the visual perception of the user in the real world. The motion parameters of the object generated by the physical parameters of the object can be more consistent with the motion process of the object in the real world. Therefore, the motion animation of the object obtained by the embodiment of the present application can not only provide differentiated animation effects between different objects; it can also make the generated motion animation of the object more consistent with the motion process of the object in the real world, thereby improving the user's interactive experience.

[0256] The implementation process of assigning physical parameters to the object according to the appearance parameters of the object in step 302 will be described below.

[0257] Taking the mass of an object as an example, a method of assigning the mass of an object in a user interface based on the appearance parameters of the object is described.

[0258] From life experience, the darker the color of an object, the greater the mass of the object. Therefore, the mass of the object can be calculated based on the color of the pixel points in the object.

[0259] In the interface where the object is located, there may be a light theme background and a dark theme background. In a light theme background, the greater the difference between the color of the object in the user interface and the color of the theme background, the greater the quality of the object; conversely, in a dark theme background, the greater the difference between the color of the object in the user interface and the color of the theme background, the greater the quality of the object. Therefore, the quality of the object can be calculated based on the first difference between the color of each pixel in the object and the theme color of the user interface where the object is located. In practical applications, a function that can represent the difference between two values ​​(the color value of the pixel and the theme color value) can be used as a calculation model for the quality of the object.

[0260] As an example, the mass of each pixel in the object may be calculated by the following functional relationship, and then the mass of the object may be generated according to the mass of each pixel.

[0261] or,

[0262] Among them, m i Indicates the quality of the i-th pixel in the object, a i represents the color of the i-th pixel in the object, and b represents the color of the user interface theme.

[0263] In actual applications, the colors of the user interface theme can be pre-set into two categories, namely, light theme and dark theme. The color value of the light theme is a value represented by white, for example, 0XFFFFFF; the color value of the dark theme is a value represented by black, for example, 0X000000.

[0264] When the theme in the user interface of an electronic device is a user-defined picture, the theme picture can also be first generated into a grayscale image, the grayscale mean of the pixels in the grayscale image is calculated, and a grayscale threshold is set. When the grayscale mean of the theme picture is greater than the grayscale threshold, the current theme is considered to be a light theme. When the grayscale mean of the theme picture is less than the grayscale threshold, the current theme is considered to be a dark theme.

[0265] After calculating the mass of each pixel in the object, the mass of each pixel calculated can also be normalized:

[0266] m i '=(m i -μ) / (m max -m min );

[0267] Among them, m i ' represents the normalized quality of the i-th pixel in the object, μ is a self-defined constant, m max Indicates the maximum value of the color, which can be set to 0XFFFFFF, m min Indicates the minimum value of the color, which can be set to 0X000000.

[0268] If μ=0, the normalized quality of each pixel is in the range of 0 to 1. Therefore, the normalized quality range of the pixel can be adjusted by the constant μ.

[0269] For objects in the real world, the larger the volume, the greater the mass of the object. Correspondingly, for two-dimensional objects, the larger the area, the greater the mass of the object. Objects in the user interface presented by the display screen of an electronic device are usually displayed in a plane. It can be understood that the objects in the user interface are two-dimensional objects. Therefore, the mass of an object in the user interface is related to the area of ​​the object in the user interface. The mass of an object can be calculated in the following way.

[0270]

[0271] Where M represents the mass of the object, m i ' represents the normalized quality of the i-th pixel in the object, and n represents the number of pixels in the object.

[0272] From the user's visual perspective, the more transparent the object, the lighter it is. Therefore, the quality of objects in the user interface is also related to the transparency of the object.

[0273] Based on the above analysis, it can be concluded that when considering the impact of object transparency on quality,

[0274] Among them, K represents transparency. K can take a value in the range of 0-1. The more transparent the object is, the smaller K is, and the lighter the mass of the object is. Of course, in practical applications, other functional relationships can also be used to express the positive relationship between transparency and the mass of the object.

[0275] The transparency of the object can be obtained by calling the transparency parameter inside the system. For example, there is an option to set the transparency of the object in the setting interface of the electronic device, and the user can set the transparency through this option. When it is necessary to give mass to the object and the influence of transparency on the mass needs to be considered, the transparency value set by the user in the transparency setting option can be obtained.

[0276] Of course, if the system does not set the transparency of the object, the transparency of the object may be assumed to be a preset constant value, for example, K may be 1.

[0277] For the convenience of distinction, the quality of the object generated without considering the transparency of the object may be recorded as the first quality value, and the quality of the object generated with considering the transparency of the object may be recorded as the second quality value. In practical applications, the first quality value or the second quality value may be considered as the quality parameter of the object according to specific circumstances.

[0278] Taking the center of gravity of an object as an example, a method of assigning the center of gravity of an object in a user interface based on the appearance parameters of the object is described.

[0279] As mentioned above, the mass of each pixel in the object can be calculated, and the coordinates of each pixel in the object can be obtained, that is, the mass distribution of the object is known. Therefore, the center of gravity of the object can be calculated based on the mass of each pixel in the object and the mass distribution of the object.

[0280] When calculating the center of gravity of an object, an iterative method can be used. The specific process is as follows:

[0281] In two-dimensional space, a spatial rectangular coordinate system O-XY is used. The object can be differentiated into n particles (or n pixels), and the coordinates of the i-th particle are (x i ,y i ), the mass of the i-th particle is m i ', the mass of the object M = m1' + ... + m i '+…+m n '.

[0282] The coordinates of the center of gravity of the object are G(x,y), which are calculated by the following formula.

[0283] x=(x1m1'+…+x i m i '+…+x n m n ') / M;

[0284] y=(y1m1'+…+y i m i '+…+y n m n ') / M.

[0285] In the above formula, the normalized mass of each pixel is used to calculate the coordinates of the center of gravity. In practical applications, the mass of each pixel before normalization may also be used.

[0286] Of course, in practical applications, when the animation effect of a three-dimensional object in a three-dimensional space is to be realized in the user interface presented by the display screen of an electronic device, a spatial rectangular coordinate system O-XYZ can also be determined in the space where the three-dimensional object is located. The object can be differentiated into n particles (or n pixels), and the coordinates of the i-th particle are (x i ,yi ,z i ), the mass of the i-th particle is m i ', the mass of the object M = m1' + ... + m i '+…+m n '.

[0287] The coordinates of the center of gravity of the object are G(x,y,z), which are calculated by the following formula.

[0288] x=(x1m1'+…+x i m i '+…+x n m n ') / M;

[0289] y=(y1m1'+…+y i m i '+…+y n m n ') / M;

[0290] z=(z1m1'+…+z i m i '+…+z n m n ') / M.

[0291] In the above formula, the normalized mass of each pixel is used to calculate the coordinates of the center of gravity. In practical applications, the mass of each pixel before normalization may also be used.

[0292] Taking the stiffness of an object as an example, a method of assigning stiffness to an object in a user interface based on appearance parameters of the object is described.

[0293] Generally, stiffness has a certain relationship with the unit mass of an object. For example, cotton and iron block have the same area and volume. Cotton has a lighter mass and smaller stiffness, while iron block has a heavier mass and larger stiffness. Therefore, in order to obtain an animation effect similar to the real world, the larger the unit mass of an object, the greater the stiffness; conversely, the smaller the unit mass of an object, the smaller the stiffness. That is, the stiffness of an object is positively correlated with its unit mass.

[0294] In addition, the color of an object is also related to its rigidity. In the real world, the darker the color of an object, the heavier it feels to the user, and the greater the rigidity. In a light theme background, the greater the difference between the outer border color of the object and the theme color of the user interface, the greater the rigidity of the object; in a dark theme background, the greater the difference between the outer border color of the object and the theme color of the user interface, the greater the rigidity of the object. That is, the rigidity of an object is positively correlated with the difference between the outer border of the object and the theme color of the user interface.

[0295] Based on the above analysis, it can be concluded that the stiffness of objects in the user interface is:

[0296] G=|bc|×k G ×M s ;

[0297] Among them, G represents the rigidity of the object, b represents the color of the user interface theme, c represents the color of the outer border of the object, and k G Represents the stiffness conversion factor, M s Indicates the unit mass of the object. For ease of description, the difference between the color of the outer frame of the object and the theme color of the user interface where the object is located is recorded as the second difference.

[0298] Among them, the stiffness conversion factor k G It can be a pre-set positive number. The stiffness conversion coefficient is set to make the stiffness value of the object calculated within a reasonable range. For example, the stiffness value of commonly used metals in nature is between 10 5 MPa level, through the stiffness conversion factor, the stiffness value of the object calculated is also within 10 5 MPa level.

[0299] As mentioned above, the colors of the user interface theme can be preset into two categories, namely, light theme and dark theme. The color value of the light theme is a value represented by white, for example, 0XFFFFFF; the color value of the dark theme is a value represented by black, for example, 0X000000. c can be the outer border range of the object (for example Figure 4 The average value of the pixels in the outer border range of the calendar icon in the figure). If the outer border range of the object does not have a fixed area, the outer border range can be extended inward from the outermost boundary of the object to a preset width ( Figure 4 The average value of the pixels within the range between the outermost boundary of the calculator icon and the dotted line is used as the color of the outer border of the object, and the preset width can be set.

[0300] When the object is a two-dimensional element, M s =M / S, S represents the area of ​​the object; when the object is a three-dimensional element, M s =M / V, V represents the volume of the object. The stiffness conversion factor is used to adjust the stiffness value of the object. In practical applications, the stiffness conversion factor k can also be set. G =1.

[0301] In addition, you can also set the stiffness of the object to be positively correlated with the transparency. You can set the transparency of the object to K, and the stiffness of the object is:

[0302] G=|bc|×K×k G ×M s .

[0303] The value and acquisition method of the transparency K of the object may refer to the description of the transparency of the object when the mass value of the object is generated.

[0304] Secondly, the stiffness of an object may also be related to the blurriness (or clarity) of the object in the user interface. When the object itself has a blurry effect, it will produce a feeling similar to cotton absorbing energy, which will reduce the stiffness of the object. Therefore, considering the influence of blurriness, the stiffness of the object is expressed as follows:

[0305] G=|bc|×K×k G ×M s ×A.

[0306] Where A represents the blurriness of the object.

[0307] In practical applications, A can be set to a value from 0 to 1. The blurrier the object, the smaller the value of A. The blurriness of the object can also be understood as the clarity of the object. The blurrier the object, the smaller the clarity of the object, and the smaller the rigidity of the object.

[0308] Of course, in practical applications, when assigning a stiffness value to an object, the influence of the blurriness of the object can also be considered without considering the influence of the transparency of the object. That is, the stiffness of the object can also be expressed as follows:

[0309] G=|bc|×k G ×M s ×A.

[0310] In practical applications, the blurriness of an object can be obtained as follows: if there is a setting interface for the blurriness (or clarity) of the object, the value of the blurriness in the setting interface can be obtained. If there is no setting interface for the user to set the blurriness of the object, the electronic device can take a screenshot to obtain an image of the object and calculate the clarity of the image area of ​​the object in the screenshot.

[0311] For the sake of convenience of description, the stiffness of an object generated without considering the transparency and blur of the object can be recorded as the first stiffness, the stiffness of an object generated considering the transparency of the object can be recorded as the second stiffness, the stiffness of an object generated considering the blur of the object can be recorded as the third stiffness, and the stiffness generated by considering both the transparency and blur of the object can be recorded as the fourth stiffness.

[0312] As mentioned above, some parameters are only generated in the motion where the position of the object changes, such as the friction force and air resistance of the object during the motion. These parameters may be related to the appearance parameters of the object or may not be related to the appearance parameters of the object.

[0313] The following describes a method for assigning dynamic physical parameters (or force parameters as described above) to an object in an animation scene where the position of the object changes.

[0314] Taking the friction acting on an object as an example, the method of adding friction to objects in the user interface is described.

[0315] In real-world motion scenes, friction is essential. Therefore, in order to obtain animation effects similar to those in real-world motion, friction needs to be added to the animation scene. In object animation scenes, the sliding friction acting on the object is usually considered. Therefore, sliding friction can be used as a physical parameter of the object.

[0316] In the user interface of an electronic device, the friction between an object and another object that moves relative to the object is mainly considered. When the object contacts the background in the user interface and moves relative to the background in the user interface, the other object is the background in the user interface.

[0317] In addition, the mass of the object usually affects the magnitude of the friction force, so it can be concluded that the friction force acting on the object is:

[0318] F f =M×O BE ;

[0319] Among them, F f is the friction force acting on the object, M is the mass of the object, O BE is the relative friction coefficient between the object and the background where the object is located.

[0320] The relative friction coefficient between an object and its background can be obtained as follows:

[0321] First, calculate the friction of the background angle where the object is located. Generally, the darker the color of the object, the greater the friction. In addition, since there are no completely smooth objects in the real world, the minimum value of the friction of the background angle needs to be set to be greater than 0. Based on the above description, the friction of the background angle where the object is located can be obtained:

[0322] B f =e1+|0XFFFFFF-d|×k fB ;

[0323] Among them, B f is the background friction, e1 is the minimum background friction, d is the color of the background where the object is located, k fB is the preset background friction conversion factor.

[0324] Among them, 0XFFFFFF is the value corresponding to white. Since there is no background object with a friction of 0 in nature, a positive number can be set as the minimum background friction. For example, the minimum background friction can be 0.001, 0.05, 0.2, 1, 1.2, etc. The embodiment of the present application does not limit the specific value of the minimum background friction.

[0325] The background friction conversion coefficient can adjust the value range of the obtained background friction so that the obtained background friction is of the same order of magnitude as the friction in the real world.

[0326] In practical applications, d is the average color of the pixels in the background where the object is located. For example, when the object slides in a blue sky scene, the average color of the pixels in the background where the object is located represents the average color of the pixels in the blue sky scene. Alternatively, a number of pixels are randomly selected from the background where the object is located, and the average of the selected pixels is calculated, and the average is used as the average color of the pixels in the background where the object is located.

[0327] Based on the calculation method of the friction at the background angle, the friction at the object angle can be obtained:

[0328] E f =e2+|0XFFFFFF-a|×k fE ;

[0329] Among them, E f is the object friction, e2 is the minimum object friction, a is the base color of the object, k fE The friction conversion factor of the preset object.

[0330] Among them, 0XFFFFFF is the value corresponding to white. Since there is no object with zero friction in nature, a positive number can be set as the minimum object friction. For example, the minimum object friction can be 0.001, 0.05, 0.2, 1, 1.2, etc. The embodiment of the present application does not limit the specific value of the minimum object friction.

[0331] The object friction conversion coefficient can adjust the value range of the obtained object friction, so that the obtained object friction is of the same order of magnitude as the friction in the real world.

[0332] In practical applications, a can be the average color of the pixels in the object.

[0333] The background friction conversion coefficient and the object friction conversion coefficient may be equal.

[0334] The relative friction coefficient between an object and the background where the object is located can be determined based on the background friction and the object friction. In practical applications, the relative friction coefficient between the object and the background where the object is located ( BE ) can be the product of background friction and object friction (B f ×E f ) and other data characteristic values.

[0335] In the real world, the rougher an object is, the greater the friction is. For objects in the user interface, the fuzziness of the object can also be understood as the roughness of the surface of the object in the real world. Therefore, friction is also related to the fuzziness of the object in the user interface.

[0336] Based on the above analysis, the friction force can be obtained as:

[0337]

[0338] Among them, A represents the blurriness of the object, and the blurriness of the object can take a value between 0 and 1. The blurrier the object, the smaller the value of A and the greater the friction. Therefore, the blurriness of the object is inversely related to the friction.

[0339] In this example, the fuzziness of the object can refer to the above description, and the embodiments of the present application will not be repeated here. In addition, for the convenience of description, the friction of the object generated without considering the fuzziness of the object can be recorded as the first friction, and the friction of the object generated by considering the fuzziness of the object can be recorded as the second friction.

[0340] In the process of object movement in the real world, air resistance is inevitable. In order to make the motion animation effect of objects in the user interface closer to the motion effect in the real world, air resistance can be added to the object's motion process to simulate the air resistance in the real world. Since the air resistance is attached to the object during the object's motion, the air resistance can be set as a physical parameter of the object. It can generally be understood that the faster the object moves, the greater the air resistance. For objects in the user interface, it can also be set that the faster the object moves, the greater the air resistance. Therefore, a positive relationship function between air resistance and motion speed can be set.

[0341] F z =f(v);

[0342] Among them, F z represents the air resistance applied to the moving object, and v represents the speed of the object.

[0343] Of course, in practical applications, you can also set a global resistance F Q, the global resistance is a fixed resistance, which can be set relatively small. Since the global resistance is relatively small, it has little impact on the animations participated by objects in the interface, and the global resistance can also be not configured.

[0344] In order to match different animation scenes, other parameters may be assigned to the object, or other motion models may be used to assign the above-mentioned physical parameters to the object, which is not limited in this embodiment of the present application.

[0345] After setting some physical parameters for the objects in the user interface, the motion parameters of the objects can be generated for the motion models set in different animation scenes. The embodiments of the present application will be described later by taking several animation scenes as examples to illustrate that different motion models can be used to obtain the motion parameters of the objects in different animation scenes, thereby generating the motion animation of the objects. Of course, in the same animation scene, different motion models can also be used to obtain the motion parameters of the objects, thereby generating the motion animation of the objects.

[0346] As an embodiment of the present application, in an animation in which an object in a user interface participates, there is often a process in which two or more objects come into contact and collide. In order to make the animation in which an object in a user interface participates similar to the motion of two objects after a collision in the real world, physical parameters of the object may be generated according to the appearance parameters of the object, and then motion parameters of the object may be generated based on the physical parameters of the object, thereby generating a motion animation of the object according to the motion parameters of the object.

[0347] Taking the collision between object A and object B as an example, according to the law of conservation of momentum (M A v ruA +M B v ruB =M A v A0 +M B v B0 ) and the law of conservation of kinetic energy (1 / 2M A v ruA 2 +1 / 2M B v ruB 2 =1 / 2M A v A0 2 +1 / 2M B v B0 2 ) Calculate the initial velocity of object A and object B after collision. Where v ruA represents the velocity of object A at the time of collision (first entry velocity), v ruB represents the velocity of object B at the time of collision (second entry velocity), v A0 represents the velocity of object A after the collision (first exit velocity), vB0 Represents the speed of object B after the collision (second output speed). After obtaining the speed of object A after the collision, the instantaneous speed of object A changing with time and the corresponding displacement can be obtained according to the friction force on object A and the speed of object A after the collision. The motion parameters of object A after the collision refer to the calculation process of the motion parameters of object A, which will not be repeated here.

[0348] Of course, in practical applications, the above model may also be modified to form a new motion model to obtain the motion parameters of the object A and the object B in the application scenario.

[0349] As an example, as shown in FIG5(a), the user's gesture gives object A (a small black ball) a force in the direction of object B (the icon of application D), and object A moves toward object B, causing objects A and B to collide. The running scenario is that the moving object A collides with the stationary object B. The stationary object B may be an object with a non-fixed position or an object with a fixed position.

[0350] Taking the collision of a moving object A with a stationary object B as an example, the process of generating the motion animation of objects A and B after the collision between objects A and B is described.

[0351] 1.1, generating physical parameters of object A according to the appearance parameters of object A, and generating physical parameters of object B according to the appearance parameters of object B;

[0352] In the animation scene, the physical parameters include: the mass of object A and the mass of object B, and the stiffness of object A and the stiffness of object B. The above description of assigning mass and stiffness to an object may be referred to.

[0353] 1.2, Get the instantaneous velocity v of object A before the collision between object A and object B ru (Third input speed);

[0354] In the embodiment of the present application, the movement from the current position of object A to the collision with object B can be divided into two stages:

[0355] In the first stage, before the user's finger is lifted from the touch screen of the electronic device, object A is subjected to a downward thrust and an upward friction force (the friction force imparted to the object as described above), and object A starts to move from rest. The thrust exerted on object A can be preset to a fixed value, and the upward friction force can be determined by the method of imparting friction force to the object as described in the above embodiment.

[0356] In the second stage, after the user lifts his finger from the touch screen of the electronic device, object A is subjected to an upward friction force, and object A begins to decelerate until it collides with object B.

[0357] From the above description, we can get the instantaneous velocity v of object A before the collision between object A and object B. ru .

[0358] 1.3, calculate the initial velocity v of object A after the collision between object A and object B A0 (third exit velocity) and the initial velocity v of object B B0 (Fourth out speed).

[0359] In the embodiment of the present application, the initial velocity v of the object A can be A0 and the initial velocity v of object B B0 The sum is denoted as v chu ;

[0360] Among them, v chu =v ru ×E lose . E lose Represents the energy loss rate, and the energy absorption loss caused by collision is usually related to the physical rigidity characteristics. It is precisely because of the non-completely rigid characteristics of the object that the collision process will absorb energy. Therefore, you can set:

[0361] E lose =(G A +G B ) / 2×G max , G max The maximum constant for the custom stiffness.

[0362] Of course, in practical applications, objects A and B can also be set as completely rigid objects. In this case, there is no energy loss, so v chu =v ru .

[0363] In the calculation to obtain v chu After that, you need to change v chu Assigned to ObjectA and ObjectB.

[0364] 5( b ), when object B is a fixed position object, the speed assigned to object B is 0, so v chu All assigned to object A, i.e. v A0 =v chu , v B0 =0.

[0365] 5(c), when the object B is an object with a non-fixed position, v chu Assign v to object A and object B. In practical applications, v can be assigned to object A and object B according to the relationship between the mass of object A and the mass of object B. chu Assigned to ObjectA and ObjectB.

[0366] As an example,

[0367] Of course, there may also be an application scenario as shown in Figure 5(d). In this application scenario, in addition to the law of conservation of momentum (M A v ru =M A v A0 +M B v B0 ) and the law of conservation of kinetic energy (1 / 2M A v ru 2 =1 / 2M A v A0 2 +1 / 2M B v B0 2 ) calculates the initial velocity of object A and object B after the collision. Other motion models can also be used to calculate the initial velocity of object A and object B after the collision. The calculation process in this application scenario will not be given as an example.

[0368] 1.4, calculate the friction force F on object A fA and air resistance F zA and the friction force F on object B fB and air resistance F zB .

[0369] This step may refer to the above description of assigning friction and air resistance to the object.

[0370] When object B is not fixed in position, the friction force F on object B needs to be calculated. fB and air resistance F zB .

[0371] When the object is fixed in position, there is no need to consider the movement of object B after the collision, so there is no need to calculate the friction force F on object B. fB and air resistance F zB .

[0372] 1.5, through v At =v A0 +a A tCalculate the velocity v of object A over time At .

[0373] Where, the acceleration of object A is A =F fA +F zA / M A .

[0374] When object B is an object with a non-fixed position, v Bt =v B0 +a B tCalculate the velocity v of object B over time Bt , where the acceleration of object B is B =F fB +F zB / M B .

[0375] Based on the above-calculated speeds (or displacements) of objects A and B changing with time, a post-collision motion animation that is closer to the real world can be constructed.

[0376] It can be understood from the above description that in the process of calculating the motion parameters after the collision between the object A and the object B, a suitable motion model can be selected according to the specific scene.

[0377] As another embodiment of the present application, in the real world, when there is a spring under some objects (or when the support on which the object is located has elastic force), when the user applies downward pressure to the object, the object will rebound. The present application embodiment takes this application scenario as an example to describe how to simulate a press-and-bounce animation close to that in the real world based on the appearance parameters of the object.

[0378] Reference Figure 6(a) to Figure 6(d) As shown, when a user presses an object in a user interface, assuming that there is elasticity in the user interface below the object, the object may rebound. Therefore, a contact card in the user interface is used to simulate a press rebound animation. Before generating a rebound animation, the physical parameters required for the rebound animation need to be calculated first.

[0379] 2.1, the mass of the object is calculated based on its appearance parameters.

[0380] This step can refer to the process of assigning mass to an object as described above. The object can be Figure 6(a) to Figure 6(d) Lily's business card.

[0381] 2.2, based on the rebound degree and the mass of the object, calculate the rebound force acting on the object.

[0382] In practical applications, it can be considered that a spring is provided at the bottom of the object, and the user applies a pressing force to the object by pressing on the touch screen of the electronic device. In the case where a pressure sensor is provided in the touch screen of the electronic device, the user's pressing force on the screen collected by the pressure sensor can be set as the pressing force acting on the object. Of course, in the case where the touch screen of the electronic device is not provided with a pressure sensor, by pre-setting in the system when the touch screen detects the user's contact point, the pressing force applied to the object can be obtained according to the pressing time (contact time) of the contact point or the contact area of ​​the contact point. The longer the pressing time of the contact point of the user's gesture and the touch screen or the larger the contact area, the greater the corresponding pressing force, and the greater the degree to which the object is pressed downward (it can also be understood as the greater the compression distance of the spring).

[0383] Of course, the pressing force applied to the object may also be set to a fixed value in the system. In specific implementation, a suitable model for obtaining the pressing force applied to the object may be selected based on the processing capability of the processor of the electronic device.

[0384] Assume that the pressure acting on the object is F Y , the object's gravity is G g According to the principle that the action force and reaction force are equal, the rebound force F acting on the object can be obtained T =F Y +G g .

[0385] As another embodiment of the present application, a rebound degree K opposite to the pressing direction may also be set. T Since the rebound degree needs to overcome the gravity of the object to cause the object to rebound, the rebound force acting on the object can be obtained through the rebound degree and the mass of the object.

[0386] That is F T =K T / M.

[0387] In practical applications, the rebound degree can be set to a constant value to calculate the rebound force on the object; the corresponding rebound degree can also be obtained based on the user's pressing force, pressing time or contact area, so as to calculate the rebound force F acting on the object based on the rebound degree and the mass of the object. T .

[0388] As another embodiment of the present application, since the object may not be a completely rigid object, the stiffness of the object may be calculated with reference to the above example.

[0389] In a specific implementation, when calculating the rebound force, the rebound force applied to the object is obtained by multiplying the stiffness of the object.

[0390] For example, F T=G×K T / M.

[0391] For the convenience of description, the resilience generated without considering the stiffness of the object may be recorded as the first resilience, and the resilience generated considering the stiffness of the object may be recorded as the second resilience.

[0392] 2.3, the object pressing displacement is obtained based on the rebound force calculation.

[0393] In practical applications, the spring coefficient of the spring under the object can be set to a fixed value. Then it can be concluded that the compressed length of the spring (the pressed displacement of the object) is:

[0394] x=F T / k.

[0395] Of course, due to the gravity of the object, when the object and the spring under the object are in equilibrium, the spring is in a compressed state. Therefore, x p = G / k Calculate the compressed length of the spring (or the equilibrium displacement of the object) when the object and the spring are in equilibrium, and use xx p Get how much the spring is compressed when pressed.

[0396] As shown in FIG6(a), when a user presses down a business card, the business card can move downward a certain distance. Due to the user's perspective, the farther away an object is, the smaller it looks. Therefore, from the user's perspective, the object looks like it has become smaller, where the position indicated by the dotted line in FIG6(a) is the position of the business card when no pressing force is applied.

[0397] It can be understood from steps 2.1 to 2.3 that when the pressing force applied to the object is not a constant, the business card may become smaller as the user's pressing force increases, the contact time of the touch point in the gesture becomes longer, or the contact area of ​​the touch point in the gesture increases.

[0398] 2.4, when the spring coefficient of the spring, the compression length of the spring, and the mass of the object above the spring are known, the motion parameters of the object can be calculated when the user's gesture is lifted off the touch screen of the electronic device, thereby generating a motion animation of the object.

[0399] After the user's gesture lifts off the touch screen of the electronic device, before the object bounces to the position corresponding to the equilibrium state, the force acting on the object is the downward gravity and the upward rebound force. Among them, the gravity of the object remains unchanged, and the upward rebound force on the object is related to the compressed length of the spring.

[0400] In practical applications, according to the principle of conversion of elastic potential energy and kinetic energy of the spring, the object may bounce up to the position corresponding to the equilibrium state under the action of rebound force and gravity (as shown in Figure 6(b)). The spring is in a compressed state at this position due to the action of gravity; then it continues to bounce up beyond the equilibrium position (Figure 6(c)). After exceeding the position corresponding to the equilibrium state, the business card becomes larger; finally, it falls back to the position corresponding to the equilibrium state (Figure 6(d)). At this position, the business card is the same size as the business card at the position corresponding to the equilibrium state. Of course, in practical applications, there is also air resistance, which can make the object and the spring return to the equilibrium state and stabilize. Because, while considering the principle of conversion of elastic potential energy and kinetic energy of the spring, the influence of work done by air resistance is also considered.

[0401] That is, through The velocity of the object at each position can be found.

[0402] Of course, in actual applications, when the object is light or the pressure is large, it may rebound several times before returning to the position corresponding to the equilibrium state; when the object is heavy or the pressure is small, it may rebound directly from the pressed position to the position corresponding to the equilibrium state.

[0403] It should be noted that in practical applications, in the process of calculating the motion parameters of an object, some existing physical theorems can be revised to reduce the amount of calculation, and the embodiments of the present application do not impose any restrictions on this.

[0404] As another embodiment of the present application, in the real world, when a pressure is applied to an object, the object may also tilt, deform, etc. The present embodiment will describe a method for generating a motion animation of an object when a pressure is applied to an object in an interface.

[0405] 3.1, calculate the mass and center of gravity of the object;

[0406] This step may refer to the method of assigning mass and center of gravity to the object as described above.

[0407] 3.2, obtain pressing force.

[0408] In an embodiment of the present application, the correspondence between the pressing force and the pressing area (the contact area between the user's gesture and the touch screen) can be pre-set. As an example, a positive function relationship between the contact area between the user's gesture and the touch screen and the pressing force can be set. Of course, in actual applications, the pressing area can also be set to multiple intervals, and different intervals correspond to different pressing pressures.

[0409] Of course, in actual applications, the pressing force can also be obtained through the pressure sensor on the touch screen provided with the pressure sensor.

[0410] 3.3, calculate the tilt displacement of the object according to the magnitude of the pressing force.

[0411] In this step, the principle is followed that the center of gravity of the object remains unchanged after being pressed (that is, the tilt axis of the object coincides with the center of gravity of the object when it tilts). Figure 7(a) to Figure 7(c) As shown, in FIG7(a), the dot above the object indicates the position of the object's center of gravity. When the user applies a downward pressing force at the position shown in FIG7(b), the object uses the axis where the center of gravity is located as the tilt axis (the straight line between the position of the pressing force and the position of the center of gravity is perpendicular to the tilt axis), forming the tilt shown in FIG7(b), wherein the dotted line represents the position of the object before the pressing force is applied. When the user applies a downward pressing force at the position shown in FIG7(c), the object uses the axis where the center of gravity is located as the tilt axis (the straight line between the position of the pressing force and the position of the center of gravity is perpendicular to the tilt axis), forming the tilt shown in FIG7(c). wherein the dotted line represents the position of the object before the pressing force is applied.

[0412] In practical applications, the display interface of the electronic device should not only present the tilt effect, but also present the tilt animation process. Therefore, it is necessary to calculate the tilt process of the object according to the position and magnitude of the pressing force.

[0413] Figure 7(a) to Figure 7(c) As shown in FIG7(a), it is similar to the scene of two people playing on a seesaw in the real world. Since the fulcrum is the center of gravity, the weight of the people on both sides of the seesaw is the same. After a downward force is applied to one side, if the person on that side wants to tilt up again, the person on that side needs to step on the ground to give an upward elastic force. Therefore, in the scene shown in FIG7(a), a spring can be set below the object on both sides of the center of gravity, and the spring is used to give the object an upward elastic force. For details, please refer to FIG8(a) and FIG8(b).

[0414] As shown in FIG8(a), a spring is provided at the bottom of each side of the object. Taking the left side as an example, the left side is subjected to an upward elastic force, which can be represented by kx, where k represents the spring coefficient and x represents the extension distance of the spring. At the same time, the left side is also subjected to a downward gravity, which can be represented by Indicates that based on theorem F = ma, we can conclude

[0415] 8( b ), the spring coefficient of the spring can be determined by the distance between the position of the applied force and the center of gravity and the moment, for example, k=aL, where a is the moment coefficient and L is the distance between the position of the applied force and the center of gravity.

[0416] The above two formulas can be used to obtain the tilt displacement of the object over time.

[0417] Of course, in practical applications, other forms of tilting effects can also be used. As shown in FIG9(a), the top layer shows the state of the object when no pressing force is applied; the middle layer shows that when pressing force is applied to one of the corners of the object, the other corner opposite to the corner is used as a fulcrum to produce a tilting effect (the dotted line represents the original state of the object); the bottom layer shows that when pressing force is applied to one of the sides of the object, the other side opposite to the side is used as a tilting axis to produce a tilting effect (the dotted line represents the original state of the object). Of course, other tilting effects can also be produced, and the embodiments of the present application do not limit this. It can be understood from FIG9(a) that the tilting axis is perpendicular to the first line (the line between the force point of the pressing force acting on the object and the center of gravity of the object), but the tilting axis does not coincide with the center of gravity.

[0418] 3.4, calculate the rigidity of the object, and calculate the degree of shape change of the object caused by pressing based on the rigidity and the pressing force.

[0419] In practical applications, it can be pre-set that the greater the rigidity of the object, the smaller the deformation, and the greater the pressing force, the greater the deformation. That is, the deformation is inversely related to the rigidity of the object and is positively related to the pressing force.

[0420] As an example, B x =X×F Y / G;

[0421] Among them, B x Indicates the deformation degree of the object, X indicates a preset constant that can adjust the deformation degree of the object, and F Y represents the pressing force, and G represents the stiffness of the object.

[0422] The degree of deformation indicates the degree of deformation. After the degree of deformation is determined, the deformation area can also be determined according to the area of ​​the object. For example, the deformation area of ​​the object can be obtained by multiplying the area of ​​the object by the degree of deformation. Finally, the deformation area of ​​the object is generated according to the deformation area. The center of the deformation area can be pre-set as the force point of the pressing force acting on the object.

[0423] In addition, since the deformation area is centered on the point where the pressing force is applied, the calculated deformation area may exceed the area of ​​the object itself. In this case, a deformation animation is generated within the area of ​​the object, and a deformation animation is generated outside the object.

[0424] As shown in Figure 9(b), the top layer shows the state of the object when no pressing pressure is applied; the middle layer shows that when pressing pressure is applied to one of the corners of the object, the corner produces a deformation effect (the dotted line indicates the original state of the object); the bottom layer shows that when pressing pressure is applied to one of the sides of the object, the side produces a deformation effect (the dotted line indicates the original state of the object).

[0425] As shown in FIG9(b), when the user presses a corner of the object, the deformation area generated may be a deformation area centered on the corner. Since only 1 / 4 of the deformation area calculated is within the area where the object is located, and 3 / 4 of the deformation area is outside the area where the object is located, the generated deformation animation of the object is the 1 / 4 deformation area within the area where the object is located. Of course, other deformation effects can also be generated, and the embodiments of the present application are not limited to this.

[0426] Of course, in addition to generating the deformation area, the deformation depth (the depth of pressing) can also be generated. The deformation depth is related to the deformation degree. The greater the deformation degree, the greater the deformation depth. The deformation depth is positively correlated with the deformation degree. For example, refer to h F =k h B x , where h F is the deformation depth, k h It is the preset depth coefficient used to adjust the deformation depth.

[0427] 3.5. According to the mass of the object, the position and elastic changes of the object caused by pressing are calculated.

[0428] Step 3.5 may refer to the process of generating the press-rebound motion animation described in the previous embodiment, or the motion model used in the press-rebound process described in the previous embodiment may be simplified, which will not be described in detail here.

[0429] As shown in Figure 9(c), the upper layers of the three figures show the state of the object when no pressing force is applied, and the lower layers respectively show the effects of different pressing forces. The three figures in Figure 9(c) represent the pressing effects from small to large pressing forces from left to right. In the first figure in Figure 9(c), the pressing force acting on the object is the smallest, and the pressing displacement of the object is also the smallest. In the third figure in Figure 9(c), the pressing force acting on the object is the largest, and the pressing displacement of the object is also the largest.

[0430] pass Figure 9(a) to Figure 9(c) It can be understood that step 3.3 takes the tilt of the object caused by pressing into account in the object's pressing animation, step 3.4 takes the deformation of the object caused by pressing into account in the object's pressing animation, and step 3.5 takes the displacement and pressing rebound of the object caused by pressing into account in the object's pressing animation. Of course, in actual applications, it is also possible to consider one, two, or three of the tilt, deformation, and displacement rebound in the object's pressing animation, and the present application embodiment does not limit this.

[0431] In the embodiment of the present application, when generating the pressing animation of the object, a three-dimensional pressing animation effect or a two-dimensional pressing animation effect can also be generated.

[0432] Reference Fig.10 As shown, Fig.10 The first figure is a top view of the object, the second figure is a pressing effect diagram when the object is three-dimensional, and the third figure is a pressing effect diagram when the object is two-dimensional. Fig.10 The dotted line in the figure represents the planar position of the subject before pressing.

[0433] Reference Fig.11 As shown, Fig.11 The first figure is a top view of the object, the second figure is a pressing effect diagram when the object is three-dimensional, and the third figure is a pressing effect diagram when the object is two-dimensional. Fig.11 The dotted line in the figure represents the planar position of the subject before pressing.

[0434] In practical applications, Fig.11 The positions corresponding to the user's fingers in the second and third figures may also have a pressing deformation effect, for example, a concave deformation centered on the position corresponding to the finger. Fig.11 The concave deformation centered on the position corresponding to the finger is not shown. Fig.11 The depression deformation in FIG. 9 can be referred to the pressing deformation effect diagram shown in the third figure in FIG. 9 (b). The pressing deformation effect described in the third figure in FIG. 9 (b) can be understood as Fig.11 The straight line where the pressure point is located is used as the section line. Fig.11 The cross-sectional effect of the concave deformation after the third figure in .

[0435] As another embodiment of the present application, when multiple objects are arranged in a chain in the real world, an external force applied to one of the objects will cause the multiple objects in the chain to perform chain motion. In the user interface, when multiple objects are arranged in a chain, if an external force is applied to one of the objects, the multiple objects in the chain can also generate a chain running animation as in the real world.

[0436] As an example, refer to Fig.12 As shown, it is a three-dimensional diagram of multiple objects arranged in a chain ( Fig.12 The figure on the right) and the corresponding top view ( Fig.12 Figure on the left) and the left view ( Fig.12 If multiple objects are set to have elastic connections, in the specific implementation process, a chain motion animation can be generated as follows.

[0437] (1) Calculate the mass of each object in the chain arrangement.

[0438] This step refers to the above description of assigning mass to the object, which will not be repeated here.

[0439] (2) Based on the applied external force, the current object moves.

[0440] As an example, refer to Fig.13 As shown, when an upward pulling force is applied to object A, the current object will produce an upward movement.

[0441] (3) Transfer the motion effect of the current element to other adjacent objects.

[0442] For example, when object A moves upward, objects B1 and B2 adjacent to object A will also produce an upward movement effect.

[0443] (4) After each object is subjected to the transmitted external force, the current element moves and continues to affect the adjacent elements.

[0444] Similarly, after object B1 generates corresponding motion, C1 adjacent to object B1 will also generate corresponding motion; after object B2 generates corresponding motion, C2 adjacent to object B2 will also generate corresponding motion, and accordingly, objects D1 and D2 will also generate corresponding motion. Among them, the force applied to object B1 is object A, the force applied to object C1 is object B1, and the force applied to object D1 is object C1. The force applied to object B2 is object A, the force applied to object C2 is object B2, and the force applied to object D2 is object C2.

[0445] Of course, in practical applications, the effect of transmission will vary depending on the mass of the object. For example, if the transmitted chain force (the force transmitted by the force-applying object in the chain-arranged object) is F, and the influence of mass is not considered, then the chain force received by the object receiving the chain force is F. If the influence of mass is considered, the chain force received is F. ch =F / M.

[0446] The mass factor is taken into account in chain motion. This is because generally, the greater the mass of an object, the less the dragging effect it will receive during the dragging process, and the smaller the mass of an object, the greater the dragging effect it will receive during the dragging process.

[0447] It should be noted that, since the object is not an object that exists in the real world when generating the motion animation of the object, in order to reduce the amount of calculation, some motion models will inevitably be revised when calculating the motion parameters of the object, thereby obtaining different motion models, resulting in some differences in the generated motion animation. Or because the movement of objects in the real world is relatively complex, the relatively complex motion process is divided into multiple motion stages, and different motion models are used in different motion stages to reduce the amount of calculation. The embodiments of the present application do not limit what kind of motion model is used to obtain the motion parameters of the object and generate the motion animation of the object after obtaining the physical parameters of the object.

[0448] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0449] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. The following is an example of dividing each functional module corresponding to each function:

[0450] Reference Fig.14 , the electronic device 1400 includes:

[0451] An object display module 1401 is used to display a first object and a second object on a user interface, where the first object and the second object are of the same type but have different appearances;

[0452] Animation generation module 1402, for generating a first motion animation of the first object in response to a first operation acting on the first object;

[0453] The animation generation module 1402 is further configured to generate a second motion animation of the second object in response to a second operation on the second object, wherein the first operation and the second operation are the same, and the first motion animation and the second motion animation are different.

[0454] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0455] detecting a first operation acting on a first object;

[0456] Acquire appearance parameters of the first object, and assign physical parameters to the first object according to the appearance parameters of the first object;

[0457] Get initial parameters of the first object;

[0458] A motion animation of the first object is generated based on the physical parameters of the first object and the initial parameters of the first object.

[0459] As another embodiment of the present application, the appearance parameter of the first object includes: the color of a pixel in the first object, and the physical parameter of the first object includes: the mass of the first object;

[0460] The animation generation module 1402 is also used for:

[0461] Assigning physical parameters to the first object according to the appearance parameters of the first object includes:

[0462] The mass of the first object is generated according to the colors of the pixels in the first object.

[0463] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0464] A first quality value of the first object is generated according to a first difference between a color of a pixel in the first object and a theme color of a user interface where the first object is located, and the first quality value of the first object is used as the quality of the first object.

[0465] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0466] generating a pixel quality of the pixel in the first object according to a first difference between a color of the pixel in the first object and a theme color of the user interface where the first object is located;

[0467] A first quality value of the first object is generated according to the pixel quality of the pixels in the first object.

[0468] As another embodiment of the present application, the appearance parameter of the first object includes: transparency of the first object; the animation generation module 1402 is further used for:

[0469] Before taking the first mass value of the first object as the mass of the first object, generating a second mass value of the first object according to the transparency of the first object and the first mass value of the first object, and taking the second mass value of the first object as the mass of the first object.

[0470] As another embodiment of the present application, the appearance parameters of the first object include: the color of the pixel points in the first object and the coordinates of the pixel points in the first object; the physical parameters of the first object include: the coordinates of the center of gravity of the first object;

[0471] The animation generation module 1402 is also used for:

[0472] generating a pixel quality of the pixel in the first object according to a first difference between a color of the pixel in the first object and a theme color of the user interface where the first object is located;

[0473] The coordinates of the center of gravity of the first object are calculated according to the coordinates of the pixels in the first object and the pixel qualities of the pixels in the first object.

[0474] As another embodiment of the present application, the appearance parameters of the first object further include: the color of the outer frame of the first object, the area or volume of the first object; the physical parameters of the first object include: the stiffness of the first object;

[0475] The animation generation module 1402 is also used for:

[0476] Calculating a second difference between the color of the outer border of the first object and the theme color of the user interface where the first object is located;

[0477] Generate a unit mass of the first object according to the mass of the first object and the area or volume of the first object;

[0478] A first stiffness of the first object is generated according to the second difference and the unit mass of the first object, and the first stiffness of the first object is used as the stiffness of the first object.

[0479] As another embodiment of the present application, the appearance parameter of the first object further includes: transparency of the first object;

[0480] The animation generation module 1402 is also used for:

[0481] Before using the first stiffness of the first object as the stiffness of the first object, generating a second stiffness of the first object according to the first stiffness of the first object and the transparency of the first object, and using the second stiffness of the first object as the stiffness of the first object.

[0482] As another embodiment of the present application, the appearance parameter of the first object further includes: blurriness of the first object;

[0483] The animation generation module 1402 is also used for:

[0484] Before taking the first stiffness of the first object as the stiffness of the first object, generating a third stiffness of the first object according to the first stiffness of the first object and the ambiguity of the first object, and taking the third stiffness of the first object as the stiffness of the first object.

[0485] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0486] generating a relative friction coefficient between the first object and the background where the first object is located according to the base color of the first object and the color of the background where the first object is located;

[0487] A first friction force acting on the first object is calculated according to the mass and the relative friction coefficient of the first object, and the first friction force is used as the friction force acting on the first object during the movement of the first object.

[0488] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0489] generating an object friction force for the first object according to a base color of the first object;

[0490] generating a background friction force of the background where the first object is located according to the color of the background where the first object is located;

[0491] A relative friction coefficient between the first object and the background where the first object is located is generated according to the object friction force and the background friction force.

[0492] As another embodiment of the present application, the appearance parameter of the first object further includes: blurriness of the first object;

[0493] The animation generation module 1402 is also used for:

[0494] Before using the first friction force as the friction force acting on the first object during the movement of the first object, a second friction force acting on the first object is generated according to the first friction force and the blurriness of the first object, and the second friction force is used as the friction force acting on the first object during the movement of the first object.

[0495] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0496] The speed of the first object is acquired, and the air resistance acting on the first object during the movement of the first object is generated according to the speed of the first object.

[0497] As another embodiment of the present application, the animation generation module 1402 is further used for:

[0498] generating motion parameters of the first object based on the physical parameters of the first object and the initial parameters of the first object;

[0499] According to the motion parameters of the first object, a motion animation of the first object is generated. As another embodiment of the present application, after the first operation acts on the first object, the first object collides with a third object;

[0500] The physical parameters of the first object include the mass of the first object, and the initial parameters of the first object include the first input velocity of the first object;

[0501] The animation generation module 1402 is also used for:

[0502] Acquire physical parameters of a third object and initial parameters of the third object, wherein the physical parameters of the third object include the mass of the third object, and the initial parameters of the third object include the second input velocity of the third object;

[0503] Based on the law of conservation of momentum and the law of conservation of energy, a first exit velocity of the first object and a second exit velocity of the third object are calculated from the mass of the first object, the mass of the third object, the first entry velocity and the second entry velocity;

[0504] Calculating a time-varying velocity and / or displacement of the first object after the collision based on a first exit velocity of the first object and a friction force acting on the first object after the collision;

[0505] The time-varying speed and / or displacement of the third object after the collision is calculated according to the second exit speed of the third object and the friction force acting on the third object after the collision.

[0506] As another embodiment of the present application, after the first operation acts on the first object, the first object collides with a stationary third object;

[0507] The physical parameters of the first object include the mass of the first object and the stiffness of the first object, and the initial parameters of the first object include the third input velocity of the first object;

[0508] The animation generation module 1402 is also used for:

[0509] Acquire physical parameters of the third object, where the physical parameters of the third object include mass of the third object and stiffness of the third object;

[0510] Calculate the sum of a third exit velocity of the first object and a fourth exit velocity of the third object according to a third entry velocity of the first object, a stiffness of the first object, and a stiffness of the third object;

[0511] Calculate the third exit velocity of the first object and the fourth exit velocity of the third object according to the sum of the third exit velocity of the first object and the fourth exit velocity of the third object, and the ratio of the mass of the first object to the mass of the third object;

[0512] Calculating the time-varying velocity and / or displacement of the first object after the collision based on the third velocity of the first object and the friction force acting on the first object after the collision;

[0513] The time-varying speed and / or displacement of the third object after the collision is calculated according to the fourth speed of the third object and the friction force acting on the third object after the collision.

[0514] As another embodiment of the present application, the first operation is a pressing operation on the first object, and the first object generates a pressing rebound;

[0515] The physical parameters of the first object include: the mass of the first object; the initial parameters of the first object include: the rebound degree acting on the first object and the elastic coefficient of the elastic component acting on the first object;

[0516] The animation generation module 1402 is further used to: generate a first rebound force acting on the first object according to the rebound degree and the mass of the first object;

[0517] Calculating a pressing displacement of the first object according to the first resilience force and the elastic coefficient;

[0518] Calculating elastic potential energy in the scene where the first object is located according to the pressing displacement and elastic coefficient of the first object;

[0519] Based on a model in which elastic potential energy is equal to kinetic energy of the first object and work done by air resistance acting on the first object, motion parameters of the first object are obtained.

[0520] As another embodiment of the present application, the physical parameter of the first object further includes: stiffness of the first object;

[0521] The animation generation module 1402 is also used for:

[0522] generating a second resilience force acting on the first object according to the first resilience force and the stiffness of the first object;

[0523] A pressing displacement of the first object is generated according to the second resilience force and the elastic coefficient.

[0524] As another embodiment of the present application, the first operation is a pressing operation on the first object, and the first object generates a pressing tilt;

[0525] The physical parameters of the first object include: the center of gravity of the first object; the initial parameters of the first object include: the force point of the pressing force acting on the first object;

[0526] When the first object generates a pressing and tilting motion, the tilting axis of the first object is perpendicular to a first connecting line, which is a connecting line between a force point of the pressing force acting on the first object and the center of gravity of the first object.

[0527] As another embodiment of the present application, the tilt axis of the first object coincides with the center of gravity of the first object.

[0528] As another embodiment of the present application, the first operation is a pressing operation on the first object, and the first object generates a pressing deformation;

[0529] The physical parameters of the first object include: the stiffness of the first object; the initial parameters of the first object include the pressing force acting on the first object and the force point of the pressing force; the motion parameters of the first object include the deformation area of ​​the first object;

[0530] The animation generation module 1402 is also used for:

[0531] Calculating a deformation degree of the first object according to a pressing force acting on the first object and a stiffness of the first object;

[0532] Calculating a deformation area of ​​the first object according to the deformation degree of the first object and the area of ​​the first object;

[0533] A deformation region of the first object is generated according to the deformation area of ​​the first object, wherein the center of the deformation region is a force point of the pressing force acting on the first object.

[0534] As another embodiment of the present application, when the first operation acts on the first object, a chain motion is generated between the first object and a fourth object arranged in a chain with the first object, wherein the chain force received by the fourth object is the chain force received by the force-applying object of the fourth object divided by the mass of the fourth object.

[0535] It should be noted that the information interaction, execution process, etc. between the above-mentioned electronic devices / modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0536] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned function allocation can be completed by different functional modules as needed, that is, the internal structure of the electronic device can be divided into different functional modules to complete all or part of the functions described above. The functional modules in the embodiment can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the modules in the above-mentioned electronic device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0537] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the electronic device can implement the steps in the above-mentioned method embodiments.

[0538] The embodiment of the present application also provides a computer program product. When the computer program product is executed on a first device, the first device can implement the steps in the above-mentioned method embodiments.

[0539] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the first device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0540] The embodiment of the present application also provides a chip system, which includes a processor, the processor is coupled to a memory, and the processor executes a computer program stored in the memory to enable an electronic device to implement the steps of any method embodiment of the present application. The chip system can be a single chip or a chip module composed of multiple chips.

[0541] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0542] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0543] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for generating animation of an object in an interface, characterized in that: include: The user interface displays a first object and a second object, wherein the first object and the second object are of the same type but have different appearances; In response to a first operation performed on the first object, generating a first motion animation of the first object; In response to a second operation acting on the second object, generating a second motion animation of the second object, wherein the first operation and the second operation belong to the same type of operation, and the first motion animation and the second motion animation are different; The step of generating a first motion animation of the first object in response to a first operation performed on the first object comprises: detecting a first operation performed on the first object; Acquiring appearance parameters of the first object, and assigning physical parameters to the first object according to the appearance parameters of the first object; Obtaining initial parameters of the first object; A motion animation of the first object is generated based on the physical parameters of the first object and the initial parameters of the first object.

2. The method according to claim 1, characterized in that The appearance parameters of the first object include: the color of the pixels in the first object, and the physical parameters of the first object include: the mass of the first object; Assigning physical parameters to the first object according to the appearance parameters of the first object comprises: The mass of the first object is generated according to the colors of the pixels in the first object.

3. The method according to claim 2, characterized in that Generating the quality of the first object according to the color of the pixel in the first object includes: A first quality value of the first object is generated according to a first difference between a color of a pixel in the first object and a theme color of a user interface where the first object is located, and the first quality value of the first object is used as the quality of the first object.

4. The method according to claim 3, characterized in that Generating a first quality value of the first object according to a first difference between a color of a pixel in the first object and a theme color of a user interface where the first object is located includes: generating a pixel quality of the pixel in the first object according to a first difference between a color of the pixel in the first object and a theme color of the user interface where the first object is located; A first quality value of the first object is generated according to pixel quality of pixels in the first object.

5. The method according to claim 3, characterized in that The appearance parameter of the first object includes: transparency of the first object; before taking the first mass value of the first object as the mass of the first object, further including: A second mass value of the first object is generated according to the transparency of the first object and the first mass value of the first object, and the second mass value of the first object is used as the mass of the first object.

6. The method according to any one of claims 1 to 5, characterized in that The appearance parameters of the first object include: the color of the pixel points in the first object and the coordinates of the pixel points in the first object; the physical parameters of the first object include: the coordinates of the center of gravity of the first object; Assigning physical parameters to the first object according to the appearance parameters of the first object comprises: generating a pixel quality of the pixel in the first object according to a first difference between a color of the pixel in the first object and a theme color of the user interface where the first object is located; The coordinates of the center of gravity of the first object are calculated according to the coordinates of the pixels in the first object and the pixel qualities of the pixels in the first object.

7. The method according to any one of claims 2 to 6, characterized in that: The appearance parameters of the first object further include: the color of the outer frame of the first object, the area or volume of the first object; the physical parameters of the first object include: the stiffness of the first object; Assigning physical parameters to the first object according to the appearance parameters of the first object comprises: Calculating a second difference between a color of an outer border of the first object and a theme color of a user interface where the first object is located; generating a unit mass of the first object according to the mass of the first object and the area or volume of the first object; A first stiffness of the first object is generated according to the second difference and the unit mass of the first object, and the first stiffness of the first object is used as the stiffness of the first object.

8. The method according to claim 7, characterized in that The appearance parameter of the first object further includes: transparency of the first object; and before taking the first stiffness of the first object as the stiffness of the first object, further includes: A second stiffness of the first object is generated according to the first stiffness of the first object and the transparency of the first object, and the second stiffness of the first object is used as the stiffness of the first object.

9. The method according to claim 7, characterized in that The appearance parameter of the first object further includes: the blurriness of the first object; and before taking the first stiffness of the first object as the stiffness of the first object, further includes: A third stiffness of the first object is generated according to the first stiffness of the first object and the blurriness of the first object, and the third stiffness of the first object is used as the stiffness of the first object.

10. The method according to any one of claims 2 to 9, characterized in that: The method further comprises: generating a relative friction coefficient between the first object and the background where the first object is located according to the base color of the first object and the color of the background where the first object is located; A first friction force acting on the first object is calculated according to the mass of the first object and the relative friction coefficient, and the first friction force is used as the friction force acting on the first object during the movement of the first object.

11. The method according to claim 10, characterized in that The step of generating a relative friction coefficient between the first object and the background where the first object is located according to the base color of the first object and the color of the background where the first object is located comprises: generating an object friction force of the first object according to a base color of the first object; generating a background friction force of the background where the first object is located according to the color of the background where the first object is located; A relative friction coefficient between the first object and the background where the first object is located is generated according to the object friction force and the background friction force.

12. The method according to claim 10 or 11, characterized in that The appearance parameter of the first object further includes: the blurriness of the first object; before using the first friction force as the friction force acting on the first object during the movement of the first object, further includes: A second friction force acting on the first object is generated according to the first friction force and the blurriness of the first object, and the second friction force is used as the friction force acting on the first object during the movement of the first object.

13. The method according to any one of claims 1 to 12, characterized in that: The method further comprises: The speed of the first object is acquired, and the air resistance acting on the first object during the movement of the first object is generated according to the speed of the first object.

14. The method according to any one of claims 1 to 13, characterized in that The step of generating a motion animation of the first object based on the physical parameters of the first object and the initial parameters of the first object comprises: generating motion parameters of the first object based on the physical parameters of the first object and the initial parameters of the first object; A motion animation of the first object is generated according to the motion parameters of the first object.

15. The method according to claim 14, characterized in that After the first operation acts on the first object, the first object collides with a third object; The physical parameters of the first object include the mass of the first object, and the initial parameters of the first object include the first input velocity of the first object; The generating the motion parameter of the first object based on the physical parameter of the first object and the initial parameter of the first object comprises: Acquire physical parameters of the third object and initial parameters of the third object, wherein the physical parameters of the third object include the mass of the third object, and the initial parameters of the third object include the second input velocity of the third object; Based on the law of conservation of momentum and the law of conservation of energy, a first exit velocity of the first object and a second exit velocity of the third object are calculated from the mass of the first object, the mass of the third object, the first entry velocity, and the second entry velocity; Calculating a time-varying velocity and / or displacement of the first object after the collision according to a first exit velocity of the first object and a friction force acting on the first object after the collision; The time-varying speed and / or displacement of the third object after the collision is calculated according to the second exit speed of the third object and the friction force acting on the third object after the collision.

16. The method according to claim 14, characterized in that After the first operation acts on the first object, the first object collides with a stationary third object; The physical parameters of the first object include the mass of the first object and the stiffness of the first object, and the initial parameters of the first object include a third input velocity of the first object; The generating the motion parameter of the first object based on the physical parameter of the first object and the initial parameter of the first object comprises: Acquire physical parameters of the third object, where the physical parameters of the third object include mass of the third object and stiffness of the third object; Calculating a sum of a third exit velocity of the first object and a fourth exit velocity of the third object according to a third entry velocity of the first object, a stiffness of the first object, and a stiffness of the third object; Calculating a third exit velocity of the first object and a fourth exit velocity of the third object according to a sum of a third exit velocity of the first object and a fourth exit velocity of the third object, and a ratio of a mass of the first object to a mass of the third object; Calculating the time-varying velocity and / or displacement of the first object after the collision according to the third velocity of the first object and the friction force acting on the first object after the collision; The time-varying speed and / or displacement of the third object after the collision is calculated according to the fourth exit speed of the third object and the friction force acting on the third object after the collision.

17. The method according to claim 14, characterized in that The first operation is a pressing operation on the first object, and the first object generates a pressing rebound; The physical parameters of the first object include: the mass of the first object; the initial parameters of the first object include: the rebound degree acting on the first object and the elastic coefficient of the elastic component acting on the first object; The generating the motion parameter of the first object based on the physical parameter of the first object and the initial parameter of the first object comprises: generating a first resilience force acting on the first object according to the rebound degree and the mass of the first object; Calculating a pressing displacement of the first object according to the first resilience force and the elastic coefficient; Calculating elastic potential energy in a scene where the first object is located according to the pressing displacement of the first object and the elastic coefficient; Based on a model in which the elastic potential energy is equal to the kinetic energy of the first object and the work done by air resistance acting on the first object, motion parameters of the first object are obtained.

18. The method according to claim 17, characterized in that The physical parameters of the first object also include: stiffness of the first object; The calculating the pressing displacement of the first object according to the first rebound force and the elastic coefficient comprises: generating a second resilience force acting on the first object according to the first resilience force and the stiffness of the first object; A pressing displacement of the first object is generated according to the second resilience force and the elastic coefficient.

19. The method of claim 14, wherein: The first operation is a pressing operation on the first object, and the first object is tilted by the pressing; The physical parameters of the first object include: the center of gravity of the first object; the initial parameters of the first object include: the force point of the pressing force acting on the first object; When the first object generates a pressing and tilting motion, the tilting axis of the first object is perpendicular to a first connecting line, which is a connecting line between a force point of the pressing force acting on the first object and the center of gravity of the first object.

20. The method of claim 19, wherein: The tilt axis of the first object coincides with the center of gravity of the first object.

21. The method of claim 14, wherein: The first operation is a pressing operation on the first object, and the first object is deformed by the pressing; The physical parameters of the first object include: the stiffness of the first object; the initial parameters of the first object include the pressing force acting on the first object and the force receiving point of the pressing force; the motion parameters of the first object include the deformation area of ​​the first object; The generating the motion parameter of the first object based on the physical parameter of the first object and the initial parameter of the first object comprises: calculating a deformation degree of the first object according to the pressing force acting on the first object and the stiffness of the first object; calculating a deformed area of ​​the first object according to the deformation degree of the first object and the area of ​​the first object; A deformation region of the first object is generated according to the deformation area of ​​the first object, wherein the center of the deformation region is a force point of the pressing force acting on the first object.

22. The method of claim 14, wherein: When the first operation acts on the first object, a chain motion is generated between the first object and a fourth object arranged in a chain manner with the first object, wherein the chain force received by the fourth object is the chain force received by the force-applying object of the fourth object divided by the mass of the fourth object.

23. An electronic device, characterized in that: The electronic device comprises a processor, and the processor is used to run a computer program stored in a memory, so that the electronic device implements the method according to any one of claims 1 to 22.

24. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a processor, enables an electronic device to implement the method according to any one of claims 1 to 22.