CN114880053B - Animation generation method for objects in interface, electronic device and storage medium - Google Patents
Animation generation method for objects in interface, electronic device and storage medium Download PDFInfo
- Publication number
- CN114880053B CN114880053B CN202110169797.8A CN202110169797A CN114880053B CN 114880053 B CN114880053 B CN 114880053B CN 202110169797 A CN202110169797 A CN 202110169797A CN 114880053 B CN114880053 B CN 114880053B
- Authority
- CN
- China
- Prior art keywords
- parameters
- generating
- motion
- mass
- color
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0481—Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0487—Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
- G06F3/0488—Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T13/00—Animation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Software Systems (AREA)
- Processing Or Creating Images (AREA)
Abstract
本申请实施例提供一种界面中对象的动画生成方法、电子设备及存储介质,涉及人机交互技术领域,可以基于界面中对象之间的外观差异,生成差异化的对象动画,提高用户的交互体验。该方法包括:用户界面显示第一对象和第二对象,所述第一对象和所述第二对象的类型相同、外观不同;响应于作用在所述第一对象上的第一操作,生成所述第一对象的第一运动动画;响应于作用在所述第二对象上的第二操作,生成所述第二对象的第二运动动画,所述第一操作和所述第二操作相同,所述第一运动动画和所述第二运动动画不同。
The embodiment of the present application provides an animation generation method for objects in an interface, an electronic device, and a storage medium, which relate to the field of human-computer interaction technology. Based on the appearance differences between objects in the interface, differentiated object animations can be generated 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.
Description
技术领域Technical Field
本申请实施例涉及人机交互领域,尤其涉及一种界面中对象的动画生成方法、电子设备及存储介质。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
随着智能终端的发展,人机交互的方式越来越多样化。电子设备的触控屏可以显示人机交互界面(也称用户界面),用户对用户界面中的对象进行手势操作,用户界面中的对象基于用户的手势操作做出一些动画响应。例如,对象对用户的拖动手势做出变形的动画,对象对用户的点击手势做出碎裂的动画。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.
然而,用户界面中的对象对用户的手势操作做出的动画响应通常是预先设置好的一些固定的动画。即对于用户界面中的不同对象生成的动画效果是相同的。这种对象参与的动画的交互体验较差。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
本申请实施例提供一种界面中对象的动画生成方法、电子设备及存储介质,可以基于对象之间的外观差异,生成差异化的动画,提高用户的交互体验。The embodiments of the present application provide a method for generating animation 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.
为达到上述目的,本申请采用如下技术方案:In order to achieve the above purpose, this application adopts the following technical solutions:
第一方面,本申请实施例提供一种界面中对象的动画生成方法,包括:In a first aspect, an embodiment of the present application provides a method for generating an animation of an object in an interface, comprising:
用户界面显示第一对象和第二对象,第一对象和第二对象的类型相同、外观不同;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;
响应于作用在第一对象上的第一操作,生成第一对象的第一运动动画;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 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.
本申请实施例中,第一对象和第二对象的类型相同表示第一对象和第二对象属于同一类对象。第一对象和第二对象的外观不同,表示第一对象和第二对象为外观存在差异的对象。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.
作为举例,第一对象为APP1的图标,第二对象为APP2的图标时,第一对象和第二对象均为APP的图标,但是APP1的图标和APP2的图标的外观存在差异,因此APP1的图标和APP2的图标的类型相同、外观不同。第一对象为用户1的名片,第二对象为用户2的名片时,第一对象和第二对象均为用户名片,但是用户1的名片中的内容和用户2的名片中的内容存在差异,所以用户1和用户2的类型相同、外观不同。即时通讯应用中,第一对象为用户1的头像,第二对象为用户2的头像,第一对象和第二对象均为用户头像,但是用户1和用户2采用不同的图片作为头像,因此,用户1的头像和用户2的头像类型相同、外观不同。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.
本申请实施例中,第一操作和第二操作相同表示第一操作和第二操作属于同一类操作。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.
作为举例,第一操作为滑动第一距离的滑动操作,第二操作为滑动第二距离的滑动操作,则第一操作和第二操作均为滑动操作,因此,滑动第一距离的滑动操作和滑动第二距离的滑动操作相同。第一操作为按压时长为第一时间的按压操作,第二操作为按压时长为第二时间的按压操作,第一操作和第二操作均属于按压操作,因此,按压时长为第一时间的按压操作和按压时长为第二时间的按压操作相同。第一操作为单击操作,第二操作也为单击操作,则第一操作和第二操作相同。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.
本申请实施例中,第一运动动画和第二运动动画不同表示第一运动动画和第二运动动画存在差异。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.
作为举例,第一对象的第一运动动画中第一对象的运动位移为第三距离,第二对象的第二运动动画中第二对象的运动位移为第四距离。第三距离和第四距离不同,则第一运动动画和第二运动动画不同。第一对象的第一运动动画中第一对象被按压后回弹m次,第二对象被按压后回弹n次,m和n不同,则第一运动动画和第二运动动画不同。第一对象被按压后形变面积大于第二对象被按压后的形变面积,则第一运动动画和第二运动动画不同。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.
通过上述描述可以理解,对于同一类型外观不同的对象,采用相同的操作时,对象会产生差异化的运动动画,提高了用户的交互体验。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.
在第一方面的一种可能的实现方式中,响应于作用在第一对象上的第一操作,生成第一对象的第一运动动画,包括: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:
检测到作用在第一对象上的第一操作;detecting a first operation acting on a first object;
获取第一对象的外观参数,并根据第一对象的外观参数为第一对象赋予物理参数;Acquire appearance parameters of the first object, and assign physical parameters to the first object according to the appearance parameters of the first object;
获取第一对象的初始参数;Get 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.
本申请实施例中,作用在第一对象上的第一操作,可以是用户在第一对象上的点击操作、按压操作(长按操作)、滑动操作等。第一对象的外观参数可以包括:第一对象中像素点的颜色,第一对象中像素点的坐标,第一对象的面积或体积,第一对象所在用户界面中的主题颜色、第一对象的透明度、第一对象的模糊度等。通过第一对象的外观参数的描述可以理解,第一对象的外观参数为从用户的视觉角度可以直观观察到第一对象和其他对象之间差异的参数。本申请实施例基于第一对象的外观参数为第一对象赋予物理参数,使得第一对象的物理参数遵循真实世界中用户的视觉感知。第一操作为按压操作时,第一对象的初始参数可以是施加在第一对象上的按压力的值(该值可以为定值,也可以根据按压操作的接触面积等参数获得),还可以是施加在第一对象上的按压力的位置。第一操作为推动操作时,第一对象的初始参数可以是为第一对象设置的初始速度,还可以是根据推动操作的推动距离生成的推力。第一对象的初始参数具体可以参照后续实施例中的描述。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. on the first object by the user. 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.
通过对象的物理参数生成的对象的运动参数能够更符合真实世界中的物体运动过程。因此,通过本申请实施例获得的对象的运动动画不仅能够提供不同对象间差异化的动画效果;还能够使得生成的对象的运动动画更符合真实世界中对象的运动过程,提高用户的交互体验。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.
本申请实施例中,响应于作用在第二对象上的第二操作,生成第二对象的第二运动动画的过程,可以参照“响应于作用在第一对象上的第一操作,生成第一对象的第一运动动画”的描述,在此不再赘述。在第一方面的一种可能的实现方式中,第一对象的外观参数包括:第一对象中像素点的颜色,第一对象的物理参数包括:第一对象的质量;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;
根据第一对象的外观参数为第一对象赋予物理参数包括:Assigning physical parameters to the first object according to the appearance parameters of the first object includes:
根据第一对象中像素点的颜色,生成第一对象的质量。The mass of the first object is generated according to the colors of the pixels in the first object.
在第一方面的一种可能的实现方式中,根据第一对象中像素点的颜色,生成第一对象的质量,包括: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:
根据第一对象中像素点的颜色和第一对象所在用户界面的主题颜色之间的第一差异,生成第一对象的第一质量值,并将第一对象的第一质量值作为第一对象的质量。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.
在第一方面的一种可能的实现方式中,根据第一对象中像素点的颜色和第一对象所在用户界面的主题颜色之间的第一差异,生成第一对象的第一质量值,包括: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:
根据第一对象中像素点的颜色和第一对象所在用户界面的主题颜色之间的第一差异,生成第一对象中像素点的像素质量;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 the pixel quality of the pixels in the first object.
作为示例,通过以下公式计算第一对象中每个像素点的像素质量:As an example, the pixel quality of each pixel in the first object is calculated by the following formula:
或, or,
其中,mi表示第一对象中第i个像素点的质量,ai表示第一对象中第i个像素点的颜色,b表示用户界面的主题的颜色。Wherein, mi represents the quality of the i-th pixel in the first object, ai represents the color of the i-th pixel in the first object, and b represents the color of the theme of the user interface.
实际应用中,还可以对计算获得的每个像素点的质量进行归一化处理:In practical applications, the quality of each pixel obtained by calculation can also be normalized:
mi'=(mi-μ)/(mmax-mmin);m i '=(m i -μ)/(m max -m min );
其中,mi'表示第一对象中第i个像素点的归一化质量,μ为自主定义的一个常数,mmax表示颜色的最大值,可以设置为0XFFFFFF,mmin表示颜色的最小值,可以设置为0X000000。Wherein, mi ' represents the normalized quality of the i-th pixel in the first object, μ is an autonomously defined constant, mmax represents the maximum value of the color, which can be set to 0XFFFFFF, and mmin represents the minimum value of the color, which can be set to 0X000000.
最后,通过以下方式计算第一对象的第一质量值(可以作为第一对象的质量):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:
其中,M表示第一对象的质量,mi'表示第一对象中第i个像素点的归一化质量,n表示第一对象中像素点的数量。Wherein, M represents the mass of the first object, mi ' represents the normalized mass of the i-th pixel in the first object, and n represents the number of pixels in the first object.
在第一方面的一种可能的实现方式中,第一对象的外观参数包括:第一对象的透明度;在将第一对象的第一质量值作为第一对象的质量之前,还包括: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:
根据第一对象的透明度和第一对象的第一质量值生成第一对象的第二质量值,并将第一对象的第二质量值作为第一对象的质量。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.
作为示例,当考虑第一对象的透明度对质量的影响时,通过以下公式计算第一对象的第二质量值(可以作为第一对象的质量):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:
其中,K表示透明度系数。K可以取0-1范围内的数值。第一对象越透明,K越小,第一对象的质量越轻。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.
在第一方面的一种可能的实现方式中,第一对象的外观参数包括:第一对象中像素点的颜色和第一对象中像素点的坐标;第一对象的物理参数包括:第一对象的重心坐标;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;
根据第一对象的外观参数为第一对象赋予物理参数包括:Assigning physical parameters to the first object according to the appearance parameters of the first object 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;
根据第一对象中像素点的坐标和第一对象中像素点的像素质量,计算第一对象的重心坐标。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.
作为示例,在二维空间中,采用空间直角坐标系O-XY。第一对象可以微元出n个质点(或者n个像素点),第i个质点的坐标为(xi,yi),第i个质点的质量为mi',第一对象的质量M=m1'+…+mi'+…+mn'。As an example, in a two-dimensional space, a spatial rectangular coordinate system O-XY is used. The first object can be differentiated into n particles (or n pixels), the coordinates of the ith particle are ( xi , yi ), the mass of the ith particle is mi ', and the mass of the first object is M = m1 '+...+ mi '+...+ mn '.
第一对象的重心的坐标为G(x,y),通过以下公式计算获得。The coordinates of the center of gravity of the first object are G(x, y), which are calculated by the following formula.
x=(x1m1'+…+ximi'+…+xnmn')/M;x=(x 1 m 1 '+...+x i m i '+...+x n m n ')/M;
y=(y1m1'+…+yimi'+…+ynmn')/M。y=(y 1 m 1 '+...+y i m i '+...+y n m n ')/M.
在三维空间中,确定空间直角坐标系O-XYZ。第一对象可以微元出n个质点(或者n个像素点),第i个质点的坐标为(xi,yi,zi),第i个质点的质量为mi',第一对象的质量M=m1'+…+mi'+…+mn'。In three-dimensional space, determine the spatial rectangular coordinate system O-XYZ. The first object can be differentiated into n particles (or n pixels), the coordinates of the ith particle are ( xi , yi , zi ), the mass of the ith particle is mi ', and the mass of the first object is M = m1 '+...+ mi '+...+ mn '.
第一对象的重心的坐标为G(x,y,z),通过以下公式计算获得。The coordinates of the center of gravity of the first object are G(x, y, z), which are calculated by the following formula.
x=(x1m1'+…+ximi'+…+xnmn')/M;x=(x 1 m 1 '+...+x i m i '+...+x n m n ')/M;
y=(y1m1'+…+yimi'+…+ynmn')/M;y=(y 1 m 1 '+...+y i m i '+...+y n m n ')/M;
z=(z1m1'+…+zimi'+…+znmn')/M。z=(z 1 m 1 '+...+z i m i '+...+z n m n ')/M.
在第一方面的一种可能的实现方式中,第一对象的外观参数还包括:第一对象的外边框颜色,第一对象的面积或体积;第一对象的物理参数包括:第一对象的刚度;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;
根据第一对象的外观参数为第一对象赋予物理参数包括:Assigning physical parameters to the first object according to the appearance parameters of the first object includes:
计算第一对象的外边框的颜色和第一对象所在用户界面的主题颜色之间的第二差异;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;
根据第一对象的质量,以及第一对象的面积或体积,生成第一对象的单位质量;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;
根据第二差异和第一对象的单位质量,生成第一对象的第一刚度,并将第一对象的第一刚度作为第一对象的刚度。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.
第一对象的刚度为:The stiffness of the first object is:
G=|b-c|×kG×Ms;G = |bc| × kG × Ms ;
其中,G表示第一对象的刚度,b表示用户界面的主题颜色,c表示第一对象的外边框的颜色,kG表示刚度换算系数,Ms表示第一对象的单位质量。为了便于描述,将第一对象的外边框的颜色和第一对象所在用户界面的主题颜色之间的差异记为第二差异。当第一对象为二维元素时,Ms=M/S,S表示第一对象的面积;当第一对象为三维元素时,Ms=M/V,V表示第一对象的体积。Wherein, G represents the stiffness of the first object, b represents the theme color of the user interface, c represents the color of the outer frame of the first object, kG represents the stiffness conversion coefficient, and Ms represents the unit mass of the first object. For the convenience 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, Ms = M/S, S represents the area of the first object; when the first object is a three-dimensional element, Ms = M/V, V represents the volume of the first object.
在第一方面的一种可能的实现方式中,第一对象的外观参数还包括:第一对象的透明度;在将第一对象的第一刚度作为第一对象的刚度之前,还包括: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:
根据第一对象的第一刚度和第一对象的透明度,生成第一对象的第二刚度,并将第一对象的第二刚度作为第一对象的刚度。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.
G=|b-c|×K×kG×Ms。G = |bc| × K × k G × Ms.
在第一方面的一种可能的实现方式中,第一对象的外观参数还包括:第一对象的模糊度;在将第一对象的第一刚度作为第一对象的刚度之前,还包括: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:
根据第一对象的第一刚度和第一对象的模糊度,生成第一对象的第三刚度,并将第一对象的第三刚度作为第一对象的刚度。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.
G=|b-c|×k×Ms×A。G = |bc| × k × Ms ×A.
其中,A表示第一对象的模糊度。Wherein, A represents the blurriness of the first object.
当然,实际应用中,还可以同时考虑第一对象的透明度和模糊度:Of course, in practical applications, the transparency and blurriness of the first object can also be considered at the same time:
G=|b-c|×K×kG×Ms×A。G = |bc| × K × kG × Ms ×A.
为了便于描述,可以将未考虑第一对象的透明度和模糊度生成的第一对象的刚度记为第一刚度,将考虑了第一对象的透明度生成的第一对象的刚度记为第二刚度,将考虑了第一对象的模糊度生成的第一对象的刚度记为第三刚度,将同时考虑了第一对象的透明度和模糊度生成的刚度记为第四刚度。实际应用中,可以将第一刚度、第二刚度、第三刚度和第四刚度中的任意一个作为第一对象的刚度。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.
在第一方面的一种可能的实现方式中,该方法还包括:In a possible implementation manner of the first aspect, the method further includes:
根据第一对象的底色和第一对象所在背景的颜色,生成第一对象和第一对象所在背景之间的相对摩擦系数;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 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.
作为示例,Ff=M×OBE;As an example, F f =M×O BE ;
其中,Ff为作用在第一对象上的摩擦力,M为第一对象的质量,OBE为第一对象和该第一对象所在背景之间的相对摩擦系数。Wherein, Ff is the friction force acting on the first object, M is the mass of the first object, and OBE is the relative friction coefficient between the first object and the background where the first object is located.
在第一方面的一种可能的实现方式中,根据第一对象的底色和第一对象所在背景的颜色,生成第一对象和第一对象所在背景之间的相对摩擦系数,包括: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:
根据第一对象的底色生成第一对象的对象摩擦力;generating an object friction force for 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.
作为示例,OBE=Bf×Ef。As an example, O BE =B f ×E f .
Bf=e1+|0XFFFFFF-d|×kfB;B f =e 1 +|0XFFFFFF-d|×k fB ;
其中,Bf为背景摩擦力,e1为设置的最小背景摩擦力,d为第一对象所在背景的颜色,kfB为预先设置的背景摩擦力换算系数。Wherein, Bf is the background friction, e1 is the set minimum background friction, d is the color of the background where the first object is located, and kfB is the preset background friction conversion coefficient.
Ef=e2+|0XFFFFFF-a|×kfE;E f =e 2 +|0XFFFFFF-a|×k fE ;
其中,Ef为对象摩擦力,e2为设置的最小对象摩擦力,a为第一对象的颜色,kfE为预先设置的对象摩擦力换算系数。Wherein, Ef is the object friction, e2 is the set minimum object friction, a is the color of the first object, and kfE is the preset object friction conversion coefficient.
在第一方面的一种可能的实现方式中,第一对象的外观参数还包括:第一对象的模糊度;在将第一摩擦力作为第一对象运动过程中作用在第一对象上的摩擦力之前,还包括: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:
根据第一摩擦力和第一对象的模糊度,生成作用在第一对象上的第二摩擦力,并将第二摩擦力作为第一对象运动过程中作用在第一对象上的摩擦力。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.
作为示例, As an example,
其中,A表示第一对象的模糊度,第一对象的模糊度可以取0-1之间的数值。第一对象越模糊,A的取值越小,摩擦力越大,因此,第一对象的模糊度与摩擦力呈反向关系。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.
在第一方面的一种可能的实现方式中,该方法还包括:In a possible implementation manner of the first aspect, the method further includes:
获取第一对象的速度,根据第一对象的速度生成第一对象运动过程中作用在第一对象上的空气阻力。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.
在第一方面的一种可能的实现方式中,基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动动画,包括: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:
基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动参数;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.
在第一方面的一种可能的实现方式中,第一操作作用在第一对象上后,第一对象和第三对象发生碰撞;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;
第一对象的物理参数包括第一对象的质量,第一对象的初始参数包括第一对象的第一入速度;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;
基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动参数,包括:Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:
获取第三对象的物理参数和第三对象的初始参数,第三对象的物理参数包括第三对象的质量,第三对象的初始参数包括第三对象的第二入速度;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 a 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 based on 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.
作为示例,通过公式(1)和公式(2)计算获得第一对象的第一出速度和第三对象的第二出速度。然后通过公式(3)和公式(4)计算获得第一对象随时间变化的速度。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).
(1)MAvruA+MBvruB=MAvA0+MBvB0;(1)M A v ruA +M B v ruB =M A v A0 +M B v B0 ;
(2)1/2MAvruA 2+1/2MBvruB 2=1/2MAvA0 2+1/2MBvB0 2;(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 ;
(3)vAt=vA0+aAt;(3) vAt = vA0 + aAt ;
(4)aA=FfA+FzA/MA;(4) a A = F f A + F z A / M A ;
其中,vruA表示碰撞时对象A(第一对象)的速度(第一入速度),vruB表示碰撞时对象B(第三对象)的速度(第二入速度),vA0表示碰撞后对象A的速度(第一出速度),vB0表示碰撞后对象B的速度(第二出速度)。vAt表示对象A随时间变化的速度。Wherein, v ruA represents the velocity of object A (first object) at the time of collision (first entry velocity), v ruB represents the velocity of object B (third object) at the time of collision (second entry velocity), v A0 represents the velocity of object A after collision (first exit velocity), v B0 represents the velocity of object B after collision (second exit velocity). v At represents the velocity of object A changing with time.
在第一方面的一种可能的实现方式中,第一操作作用在第一对象上后,第一对象和第三对象发生碰撞;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;
第一对象的物理参数包括第一对象的质量,第一对象的初始参数包括第一对象的第一入速度;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;
基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动参数,包括:Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:
获取第三对象的物理参数和第三对象的初始参数,第三对象的物理参数包括第三对象的质量,第三对象的初始参数包括第三对象的第二入速度;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 a 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 based on 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.
(5)vchu=vru×Elose。(5)v chu =v ru ×E lose .
(6)Elose=(GA+GB)/2×Gmax,Gmax为自定义的刚度的最大常量。(6)E lose =( GA + GB )/2× Gmax , where Gmax is the maximum constant of the user-defined stiffness.
当对象B为位置固定的对象的情况下,则分配给对象B的速度为0,因此,vchu全部分配给对象A,即(7)vA0=vchu,vB0=0。When the object B is a fixed-position object, the velocity assigned to the object B is 0, and therefore, v chu is entirely assigned to the object A, that is, (7) v A0 =v chu , v B0 =0.
当对象B为位置不固定的对象的情况下,(8) When object B is an object with a non-fixed position, (8)
通过公式(5)和公式(6)计算获得对象A的第三出速度和对象B的第四出速度之和vchu。然后通过公式(7)或公式(8)计算获得对象A的第三出速度和对象B的第四出速度。The sum v chu of the third exit speed of object A and the fourth exit speed of object B is calculated by formula (5) and formula (6). Then, the third exit speed of object A and the fourth exit speed of object B are calculated by formula (7) or formula (8).
最后通过公式(3)和公式(4)计算获得第一对象随时间变化的速度。Finally, the speed of the first object changing with time is calculated by using formula (3) and formula (4).
在第一方面的一种可能的实现方式中,第一操作为作用在第一对象上的按压操作,第一对象产生按压回弹;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;
第一对象的物理参数包括:第一对象的质量;第一对象的初始参数包括:作用在第一对象上的反弹度和作用在第一对象上的弹性部件的弹性系数;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;
基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动参数,包括:Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:
根据反弹度和第一对象的质量,生成作用在第一对象上的第一回弹力;generating a first rebound 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 the scene where the first object is located according to the pressing displacement and elastic coefficient of the first object;
基于弹性势能等于第一对象的动能和作用在第一对象上的空气阻力做功的模型,获得第一对象的运动参数。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.
(9)FT=KT/M;(9) F T = K T /M;
(10)x=FT/k,xp=G/k,按压位移:x-xp;(10) x = F T /k, x p = G /k, pressing displacement: x p ;
(11) (11)
根据公式(9)计算获得第一回弹力,根据公式(10)计算按压位移,公式(11)表示弹性势能、第一对象的动能和空气阻力做功的之间的关系。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.
在第一方面的一种可能的实现方式中,第一对象的物理参数还包括:第一对象的刚度;In a possible implementation manner of the first aspect, the physical parameter of the first object further includes: stiffness of the first object;
根据第一回弹力和弹性系数,计算第一对象的按压位移包括:Calculating the pressing displacement of the first object according to the first resilience force and the elastic coefficient includes:
根据第一回弹力和第一对象的刚度,生成作用在第一对象上的第二回弹力;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.
在第一方面的一种可能的实现方式中,第一操作为所用在第一对象上的按压操作,第一对象产生按压倾斜;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;
第一对象的物理参数包括:第一对象的重心;第一对象的初始参数包括:作用在第一对象上的按压力的受力点;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.
在第一方面的一种可能的实现方式中,第一对象的倾斜轴与第一对象的重心重合。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.
在第一方面的一种可能的实现方式中,第一操作为作用在第一对象上的按压操作,第一对象产生按压形变;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 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;
基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动参数,包括:Generating motion parameters of the first object based on physical parameters of the first object and initial parameters of the first object includes:
根据作用在第一对象上的按压力和第一对象的刚度,计算第一对象的形变度;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;
根据第一对象的形变度和第一对象的面积,计算第一对象的形变面积;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.
在第一方面的一种可能的实现方式中,第一操作作用在第一对象上时,第一对象和与第一对象链式排布的第四对象之间产生链式运动,其中,第四对象受到的链式力为第四对象的施力对象受到的链式力除以第四对象的质量。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.
第二方面,本申请实施例提供一种电子设备,包括:In a second aspect, an embodiment of the present application provides an electronic device, including:
对象显示模块,用于在用户界面显示第一对象和第二对象,第一对象和第二对象的类型相同、外观不同;An object display module, configured to display 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;
动画生成模块,用于响应于作用在第一对象上的第一操作,生成第一对象的第一运动动画;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;
动画生成模块,还用于响应于作用在第二对象上的第二操作,生成第二对象的第二运动动画,第一操作和第二操作相同,第一运动动画和第二运动动画不同。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.
第三方面,提供一种电子设备,包括处理器,处理器用于运行存储器中存储的计算机程序,使电子设备实现本申请第一方面任一项的方法。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.
第四方面,提供一种芯片系统,包括处理器,处理器与存储器耦合,处理器执行存储器中存储的计算机程序,以使电子设备实现本申请第一方面任一项的方法。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.
第五方面,提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被一个或多个处理器执行时使电子设备实现本申请第一方面任一项的方法。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.
第六方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在设备上运行时,使得设备执行上述第一方面中任一项方法。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.
可以理解的是,上述第二方面至第六方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。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
图1为本申请实施例提供的一种界面中对象的动画生成方法的应用场景示意图;FIG1 is 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;
图2为本申请实施例提供的执行界面中对象的动画生成方法的电子设备的硬件结构示意图;FIG2 is a schematic diagram of the hardware structure of an electronic device for executing a method for generating animation of an object in an interface provided in an embodiment of the present application;
图3为本申请实施例提供的一种界面中对象的动画生成方法的流程示意图;FIG3 is a schematic diagram of a flow chart of a method for generating animation of an object in an interface provided by an embodiment of the present application;
图4为本申请实施例提供的一种计算界面中对象的外边框颜色的示意图;FIG4 is a schematic diagram of the outer border color of an object in a computing interface provided by an embodiment of the present application;
图5(a)至图5(d)为本申请实施例提供的一种界面中对象的碰撞动画的场景示意图;FIG. 5( a) to FIG. 5( d ) are schematic diagrams of scenes of collision animation of objects in an interface provided in an embodiment of the present application;
图6(a)至图6(d)为本申请实施例提供的一种界面中对象的按压回弹动画的场景示意图;FIG. 6( a) to FIG. 6( d ) are schematic diagrams of scenes of a pressing rebound animation of an object in an interface provided by an embodiment of the present application;
图7(a)至图7(c)为本申请实施例提供的一种界面中对象的按压倾斜动画的场景示意图;FIG. 7( a) to FIG. 7( c) are schematic diagrams of scenes of a pressing and tilting animation of an object in an interface provided by an embodiment of the present application;
图8(a)至图8(b)为本申请实施例提供的一种界面中对象的按压倾斜动画的受力示意图;FIG8(a) to FIG8(b) are force diagrams of a pressing and tilting animation of an object in an interface provided by an embodiment of the present application;
图9(a)至图9(c)为本申请实施例提供的一种界面中对象的按压动画的场景示意图;FIG9(a) to FIG9(c) are schematic diagrams of scenes of a pressing animation of an object in an interface provided by an embodiment of the present application;
图10为本申请实施例提供的一种界面中对象的立体动画和平面动画的场景示意图;FIG10 is 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;
图11为本申请实施例提供的另一种界面中对象的立体动画和平面动画的场景示意图;FIG11 is 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;
图12为本申请实施例提供的一种界面中对象的链式排布的结构示意图;FIG12 is a schematic diagram of a chain arrangement of objects in an interface provided by an embodiment of the present application;
图13为本申请实施例提供的一种界面中对象的链式动画的动画示意图;FIG13 is an animation schematic diagram of a chain animation of an object in an interface provided by an embodiment of the present application;
图14为本申请实施例提供的一种电子设备的功能架构模块的示意框图。FIG14 is a schematic block diagram of a functional architecture module of an electronic device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。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.
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and/or combinations thereof.
还应当理解,在本申请实施例中,“一个或多个”是指一个、两个或两个以上;“和/或”,描述关联对象的关联关系,表示可以存在三种关系;例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。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.
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。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.
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。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.
本申请实施例提供的界面中对象的动画生成方法可以应用在图1所示的应用场景中。如图1所示,电子设备的显示屏显示用户界面,图1中的第1个图中显示联系人界面,该联系人界面中存在联系人的名片,每个联系人的名片可以作为一个对象。图1中的第2个图中显示电子设备的主界面,电子设备的主界面中的每个应用程序的图标也可以作为一个对象。当用户的手势作用于界面中的对象时,使得对象在界面中进行运动,从而生成对象的运动动画。为了使得界面中的对象的运动动画更接近于真实世界中物体的运动过程,可以为界面中的对象赋予一些物理参数,例如,对象的质量、对象的刚度等。然后基于对象的物理参数以及对象的初始参数(例如,作用在对象上的推力,对象的初始速度等)计算对象的运动参数,例如,对象随时间变化的速度、对象随时间变化的位移等。最后基于对象的运动参数生成对象的运动动画。The method for generating an animation of an object in an interface provided by an embodiment of the present application can be applied to the application scenario shown in FIG. 1. As shown in FIG. 1, the display screen of an electronic device displays a user interface, and the first figure in FIG. 1 displays a contact interface, in which there are contact business cards, and each contact business card can be used as an object. The second figure in FIG. 1 displays 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 an object in the interface, the object is moved 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 an object in the real world, some physical parameters can be assigned to the object in the interface, such as the mass of the object, the stiffness of the object, etc. Then, the motion parameters of the object are calculated 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.), 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.
作为示例,界面中的两个对象发生碰撞时,其中一个对象可能会发生反弹运动。然而,对于不同的对象,发生反弹时的速度和反弹的位移可能存在差异,这些差异是基于对象的物理参数产生的,而不是开发人员预先根据不同对象设置的不同动画效果。由于对象的运动动画与对象的物理参数相关,因此,为了获得不同对象之间的差异化的运动动画以及使得对象的运动动画更符合真实世界中物体的运动过程,需要为每个对象赋予个性化的物理参数。用户对于用户界面中的对象的感知来自于对象的外观参数,例如,对象中像素点的颜色、对象的透明度等,因此,可以基于每个对象的外观参数生成每个对象个性化的物理参数。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.
本申请实施例提供的界面中对象的动画生成方法中,首先需要基于对象的外观参数生成对象的物理参数;然后根据对象的物理参数以及对象的初始参数生成对象的运动参数,最后,根据对象的运动参数生成对象的运动动画。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.
基于上述的理解,用户界面中可以显示至少两个同类型的对象,如图1所示的第二个用户界面中的应用A(可以为图4所示的日历图标)和应用C(可以为图4所示的计算器图标)。由于应用A和应用C均为APP的图标,所以应用A和应用C的类型相同。由于应用A和应用C为不同的APP的图标,所以应用A和应用C的外观不同(图4中未示出与颜色相关的外观差异)。Based on the above understanding, at least two objects of the same type can be displayed in the user interface, such as application A (which can be the calendar icon shown in FIG. 4 ) and application C (which can be the calculator icon shown in FIG. 4 ) in the second user interface shown in FIG. 1 . Since application A and application C are both 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 (the appearance difference related to color is not shown in FIG. 4 ).
当用户在应用A上进行向右的推动操作时,应用A向右运动撞击应用B后,应用A被反弹,应用A向左运动,应用B继续保持静止。应用A的反弹运动可以参照图5(b)中所示的对象A的运动动画示意,应用A碰撞后发生反弹以原来的运动方向相反的方向运动,被碰撞的应用B的运动动画可参照图5(b)中所示的对象B的运动动画示意,应用B保持静止。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.
当用户在应用C上进行向左的推动操作时,应用C向左运动撞击应用B后,应用C继续向左运动,应用B也向左运动。应用C的运动动画可以参照图5(c)中所示的对象A的运动动画示意,应用C碰撞后以与原来的运动方向相同的方向运动,被碰撞的应用B的运动动画可参照图5(c)中所示的对象B的运动动画示意,应用B和应用C保持同方向的运动。用户作用在应用A上的操作为向右的推动操作,用户作用在应用C上的操作为向左的推动操作。虽然操作方向存在差异,然而均为推动操作,所以,用户作用在应用A上的向右的推动操作和用户作用在应用C上的向左的推动操作为相同的操作。上述操作过程可以理解为给应用A和应用C相同的推力值或者相同的初速度值。When the user pushes application C to the left, application C moves to the left and hits application B, then 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 FIG5(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 FIG5(c). Application B and application C maintain the same direction of motion. The user's operation on application A is a push operation to the right, and the user's operation 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 user's push operation on application A to the right and the user's push operation on application C to the left are the same operation. The above operation process can be understood as giving application A and application C the same thrust value or the same initial velocity value.
通过图5(b)所示对象A和对象B的运动动画和图5(c)所示的对象A和对象B的运动动画可以理解,相同的操作作用在应用A上和应用C上、且应用A和应用C碰撞的对象也相同时,应用A和应用C产生的运动动画是不同的。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.
而产生运动动画不同的原因在于,应用A的外观使得应用A像是真实世界中质量较轻的物体。应用C的外观使得应用C像是真实世界中质量较重的物体。而真实世界中这两种物体碰撞同一物体可能产生不同的运动。因此,本申请实施例提供的界面中对象的动画生成方法可以基于对象之间的外观差异,生成差异化的动画;并且生成的对象的动画更接近真实世界中物体的运动。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, the collision of these two objects with the same object may produce different motions. 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.
上述实施例中如何根据对象的外观得到对象的质量或者其他物理参数可以参照后续实施例的描述。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.
作为另一实施例,图1所示的第二个界面中显示的应用A和应用D均为APP的图标,即类型相同。由于应用A和应用D的外观不同,当用户在应用A和应用B上分别进行按压操作时,应用A被按压后可能回弹2次,应用B被按压后可能回弹4次。即外观不同的应用A和应用D对于相同操作生成的运动动画不同。对于按压回弹的运动动画的生成过程可参照后续实施例中的描述。As another embodiment, the application A and application D displayed in the second interface shown in FIG1 are both APP icons, that is, they are of the same type. Since the appearances 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 for the same operation by application A and application D with different appearances are different. For the generation process of the motion animation of pressing and rebounding, please refer to the description in the subsequent embodiments.
需要说明,图1所示应用场景仅为一种示例,在实际应用中,还可能存在其他应用场景,本申请实施例对界面中对象的动画生成方法的应用场景不做限制。It should be noted that the application scenario shown in FIG. 1 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.
本申请实施例提供一种界面中对象的动画生成方法,该方法可以适用于电子设备中。电子设备可以为:手机、平板电脑、可穿戴设备、车载设备、智能音箱、智慧屏、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personaldigital assistant,PDA)等电子设备。本申请实施例对电子设备的具体类型不作限定。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.
图2示出了一种电子设备的结构示意图。电子设备200可以包括处理器210,外部存储器接口220,内部存储器221,通用串行总线(universal serial bus,USB)接口230,充电管理模块240,电源管理模块241,电池242,天线1,天线2,移动通信模块250,无线通信模块260,音频模块270,扬声器270A,受话器270B,麦克风270C,耳机接口270D,传感器模块280,马达291,摄像头293,显示屏294,以及用户标识模块(subscriber identificationmodule,SIM)卡接口295等。其中传感器模块280可以包括压力传感器280A,陀螺仪传感器280B,加速度传感器280E,触摸传感器280K等。2 shows a schematic diagram of the structure of an electronic device. 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.
可以理解的是,本申请实施例示意的结构并不构成对电子设备200的具体限定。在本申请另一些实施例中,电子设备200可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。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.
处理器210可以包括一个或多个处理单元,例如:处理器210可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。例如,处理器210用于执行本申请实施例中的界面中对象的动画生成方法。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.
其中,控制器可以是电子设备200的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。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.
处理器210中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器210中的存储器为高速缓冲存储器。该存储器可以保存处理器210刚用过或循环使用的指令或数据。如果处理器210需要再次使用该指令或数据,可从存储器中直接调用。避免了重复存取,减少了处理器210的等待时间,因而提高了系统的效率。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.
在一些实施例中,处理器210可以包括一个或多个接口。接口可以包括用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serialbus,USB)接口等。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.
USB接口230是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口230可以用于连接充电器为电子设备200充电,也可以用于电子设备200与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。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.
外部存储器接口220可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备200的存储能力。外部存储卡通过外部存储器接口220与处理器210通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。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.
内部存储器221可以用于存储计算机可执行程序代码,可执行程序代码包括指令。处理器210通过运行存储在内部存储器221的指令,从而执行电子设备200的各种功能应用以及数据处理。内部存储器221可以包括存储程序区和存储数据区。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.
此外,内部存储器221可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。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.
充电管理模块240用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块240可以通过USB接口230接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块240可以通过电子设备200的无线充电线圈接收无线充电输入。充电管理模块240为电池242充电的同时,还可以通过电源管理模块241为电子设备供电。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.
电源管理模块241用于连接电池242,充电管理模块240与处理器210。电源管理模块241接收电池242和/或充电管理模块240的输入,为处理器210,内部存储器221,外部存储器,显示屏294,摄像头293,和无线通信模块260等供电。电源管理模块241还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。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).
在其他一些实施例中,电源管理模块241也可以设置于处理器210中。在另一些实施例中,电源管理模块241和充电管理模块240也可以设置于同一个器件中。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.
电子设备200的无线通信功能可以通过天线1,天线2,移动通信模块250,无线通信模块260,调制解调处理器以及基带处理器等实现。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.
天线1和天线2用于发射和接收电磁波信号。电子设备200中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。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.
移动通信模块250可以提供应用在电子设备200上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块250可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块250可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块250还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。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.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器270A,受话器270B等)输出声音信号,或通过显示屏294显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器210,与移动通信模块250或其他功能模块设置在同一个器件中。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.
无线通信模块260可以提供应用在电子设备200上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块260可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块260经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器210。无线通信模块260还可以从处理器210接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。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 processing, 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.
在一些实施例中,电子设备200的天线1和移动通信模块250耦合,天线2和无线通信模块260耦合,使得电子设备200可以通过无线通信技术与网络以及其他设备通信。无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(codedivision multiple access,CDMA),宽带码分多址(wideband code division multipleaccess,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidounavigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellitesystem,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。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).
电子设备200通过GPU,显示屏294,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏294和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器210可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。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.
显示屏294用于显示图像,视频等。显示屏294包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备200可以包括1个或N个显示屏294,N为大于1的正整数。作为示例,电子设备的显示屏可以显示用户界面。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.
电子设备200可以通过音频模块270,扬声器270A,受话器270B,麦克风270C,耳机接口270D,以及应用处理器等实现音频功能。例如音乐播放,录音等。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.
音频模块270用于将数字音频信号转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块270还可以用于对音频信号编码和解码。在一些实施例中,音频模块270可以设置于处理器210中,或将音频模块270的部分功能模块设置于处理器210中。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.
扬声器270A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备200可以通过扬声器270A收听音乐,或收听免提通话。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.
受话器270B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备200接听电话或语音信息时,可以通过将受话器270B靠近人耳接听语音。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.
麦克风270C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风270C发声,将声音信号输入到麦克风270C。电子设备200可以设置至少一个麦克风270C。在另一些实施例中,电子设备200可以设置两个麦克风270C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备200还可以设置三个,四个或更多麦克风270C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。例如,麦克风270C可以用于采集本申请实施例涉及到的音频信号。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.
耳机接口270D用于连接有线耳机。耳机接口270D可以是USB接口230,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。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.
压力传感器280A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器280A可以设置于显示屏294。压力传感器280A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器280A,电极之间的电容改变。电子设备200根据电容的变化确定压力的强度。当有触摸操作作用于显示屏294,电子设备200根据压力传感器280A检测触摸操作强度,从而生成作用于界面中对象上的外力,使得界面中的对象基于该外力产生相应的运动。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.
陀螺仪传感器280B可以用于确定电子设备200的运动姿态。在一些实施例中,可以通过陀螺仪传感器280B确定电子设备200围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器280B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器280B检测电子设备200抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备200的抖动,实现防抖。陀螺仪传感器280B还可以用于导航,体感游戏场景。作为示例,用户可以通过调整电子设备200的位姿,使得界面中自由活动的对象基于自身的重力产生相应的运动。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.
加速度传感器280E可检测电子设备200在各个方向上(一般为三轴)加速度的大小。当电子设备200静止时可检测出重力的大小及方向。作为示例,用户可以调整电子设备200的加速度,向界面中自由活动的对象施加相应的加速度,使得界面中自由活动的对象基于该加速度产生相应的运动。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.
触摸传感器280K,也称“触控面板”。触摸传感器280K可以设置于显示屏294,由触摸传感器280K与显示屏294组成触摸屏,也称“触控屏”。触摸传感器280K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏294提供与触摸操作相关的视觉输出。作为示例,电子设备200可以通过触摸传感器检测用户施加在对象上的外力的位置,从而使得界面中的对象基于该外力的位置产生相应的运动。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.
马达291可以产生振动提示。马达291可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏294不同区域的触摸操作,马达291也可对应不同的振动反馈效果。作为示例,电子设备200可以基于界面中的对象的运动动画产生相应的振动效果,例如,当两个对象发生碰撞时,可以产生振动反馈效果。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.
SIM卡接口295用于连接SIM卡。SIM卡可以通过插入SIM卡接口295,或从SIM卡接口295拔出,实现和电子设备200的接触和分离。电子设备200可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口295可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口295可以同时插入多张卡。多张卡的类型可以相同,也可以不同。SIM卡接口295也可以兼容不同类型的SIM卡。SIM卡接口295也可以兼容外部存储卡。电子设备200通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备200采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备200中,不能和电子设备200分离。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.
本申请实施例并未特别限定一种界面中对象的动画生成方法的执行主体的具体结构。只要可以通过运行记录有本申请实施例提供的一种界面中对象的动画生成方法的程序,以根据本申请实施例的一种界面中对象的动画生成方法进行通信即可。例如,本申请实施例提供的一种界面中对象的动画生成方法的执行主体可以是电子设备中能够调用程序并执行程序的功能模块,或者为应用于电子设备中的通信装置,例如,芯片。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 applied to an electronic device, such as a chip.
本申请实施例以对用户界面上的对象进行操作后,电子设备在用户界面上生成对象的运动动画的场景为例,描述对象的运动动画的生成过程。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.
参照图3所示,为本申请实施例提供的一种界面中对象的动画生成方法的流程示意图,如图所示,该方法包括:3 is a flow chart of a method for generating animation of an object in an interface provided by an embodiment of the present application. As shown in the figure, the method includes:
步骤301,检测到作用在对象上的操作。Step 301: An operation on an object is detected.
如图1所示,用户界面中的对象可以是主界面中应用程序的图标,还可以是联系人界面中联系人的名片。实际应用中,用户界面中的对象可以是用户界面中具有颜色特征和边界的元素。例如,图标、具有边界框的文字、图像、各种控件等。As shown in Figure 1, the object in the user interface can be an application icon in the main interface, or a contact's business 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, such as an icon, text with a boundary box, an image, and various controls.
检测到作用在对象上的操作,可以是检测到作用在对象上手势操作,例如,检测到作用在对象上的拖动操作、按压操作等。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.
检测到作用在对象上的操作,还可以是检测其他对象对本对象的操作,例如,对象A在运动过程中碰撞对象B,则检测到作用在对象B上的操作可以是检测到对象A对对象B的碰撞。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.
步骤302,获取对象的外观参数,并根据对象的外观参数为对象赋予物理参数。Step 302: Acquire appearance parameters of the object, and assign physical parameters to the object according to the appearance parameters of the object.
本申请实施例中,电子设备的显示屏可以呈现用户界面,本申请实施例将用户界面中的对象看作是真实世界中的物体。由于真实世界中的物体具有一些物理参数,例如:质量、重心、刚度等。因此,若要电子设备的用户界面中的对象具有与真实世界相似的运动过程,需要为电子设备的用户界面中的对象赋予一些物理参数。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.
为了提高用户的交互体验,可以从用户对对象的感知的角度为对象赋予物理参数。用户对于用户界面中的对象的感知来自于对象的外观,例如,对象的颜色,对象的颜色分布,对象的透明度,对象的模糊度等。为了使得电子设备的处理器能够获得对象的外观,可以获得对象中像素点的颜色,对象中像素点的坐标,对象的透明度、对象的模糊度等。本申请实施例将这些参数记为对象的外观参数。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.
作为示例,对象的颜色越深,对象的单位质量就越大,例如,将对象的颜色分为多个等级,不同等级对应不同的单位质量。或者设置对象的单位质量和对象的颜色之间的函数关系,通过该函数关系以及对象的颜色生成对象的单位质量。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.
作为另一示例,对象越模糊,对象的粗糙度就越大,该对象和其他对象相互摩擦时,摩擦系数就越大。也可以设置对象和与该对象所在背景之间的摩擦系数与该对象的模糊度以及该背景的模糊度之间的函数关系,通过该函数关系以及对象的模糊度和背景的模糊度得到对象和背景之间的摩擦系数。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.
以上根据对象的外观参数为对象赋予物理参数的过程仅用于示例,根据对象不同的外观参数,为对象赋予不同的物理参数的过程可参照后续实施例中的描述。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.
步骤303,获取对象的初始参数。Step 303, obtaining initial parameters of the object.
在现实世界中,一个物体受到了外部的作用力,该物体可能产生运动。该作用在对象上的外部力可以为对象的初始参数。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.
作为示例,作用在对象上的操作为按压操作时,对象的初始参数可以是施加在对象上的按压力的值(该值可以为定值,也可以根据按压操作的受力面积等参数获得),对象的初始参数还可以是施加在对象上的按压力的位置。作用在对象上的操作为推动操作时,对象的初始参数可以是根据推动操作的推动距离生成的推力。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.
在一些实施例中,为简化生成对象的运动动画的过程,可以为对象赋予初始速度作为对象的初始参数。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.
作为示例,当作用在对象上的操作为推动操作时,对象的初始参数可以为对象的初始速度,用户停止推动后,该对象以该初始速度匀速运动,或者该对象根据受到的摩擦力以该初始速度减速运动。当该对象以初始速度匀速运动时,该对象的运动轨迹上存在另一对象,则该对象和另一对象发生碰撞。As an example, when the operation 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.
对象的初始参数还可以是其他参数,具体可以参照后续实施例中的描述。The initial parameters of the object may also be other parameters, and the details may refer to the description in the subsequent embodiments.
步骤304,基于对象的物理参数和对象的初始参数,生成对象的运动动画。Step 304: Generate a motion animation of the object based on the physical parameters of the object and the initial parameters of the object.
对象的运动并不限定于狭义上的产生了位移,也可以是该对象产生了形变。即只要对象的位置和/或形状发生了改变,就认为对象运动了。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.
以对象产生了位移的运动为例,对象在运动过程中,还可能受到空气阻力、摩擦力等。在实际应用中,可以将对象固有的质量、重心和刚度等参数记为对象的静态物理参数,将对象在产生位移的运动过程中伴随的摩擦力和空气阻力记为对象的动态物理参数。当然,由于只有在特定动画场景的运动动画中才会考虑摩擦力和空气阻力,也可以将对象固有的重量、重心和刚度等参数记为对象的物理参数,而摩擦力和空气阻力作为特定动画场景中的受力参数。本申请实施例对这些参数的划分不做限制。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.
在实际应用中,不同的动画场景(例如,对象的按压回弹场景、对象的按压倾斜场景、对象的按压形变场景)下设置的运动模型(一个或多个数学公式组成)可能不同,导致需要的物理参数可能不同。即使同一动画场景下,由于采用的运动模型的差异,也可能导致该动画场景下采用的物理参数存在不同。鉴于上述理解,在一些动画场景的实施例中,可能用到了上述物理参数中的部分或全部,也可能用到上述物理参数以外的其他物理参数,本申请对此并不限定。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.
对象的运动动画通常体现在至少两个方面:位置和形状。因此,当一个用户界面中存在多个对象的情况下,可以设置某些对象是位置和形状均不固定的对象,某些对象是位置和形状均固定的对象,某些对象是形状固定或位置固定的对象。对位置不固定的对象施加外力,使得该对象产生与位置变化相关的动画;对形状不固定的对象施加外力,使得该对象产生与形状变化相关的动画;当用户对位置固定且形状固定的对象施加外力,该位置固定且形状固定的对象不会产生运动动画。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.
另外,针对不同的对象,可以设置不同的动画场景,例如,设定联系人名片的下方存在弹簧,则针对联系人名片,设置的动画场景为按压回弹场景;设定应用图标为刚度较低时,则针对应用图标,设置的动画场景为按压变形场景。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.
当然,实际应用中,也可以针对用户作用在对象上的手势,设置不同的动画场景,例如,针对应用图标上用户的点击手势设置按压回弹场景,针对应用图标上用户的滑动手势设置沿着滑动方向运动的场景,当沿着滑动方向存在其他对象的情况下,该应用图标可以和其他对象发生碰撞的场景。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.
当然,还可能存在其他情况,当一个对象受到其他对象的影响时,可以基于其他对象的运动状态确定该对象的运动场景。作为举例,可以设置:当一个对象(对象A)被其他对象(对象B)撞击时,可以设置对象A参与的运动动画为碰撞场景(简称场景1)。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).
当作用在一个对象(对象A)上的第一操作为用户手势时,可以设置对象A为按压倾斜场景(简称场景2)。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).
通过场景1和场景2可以理解,在不同的动画场景中,采用不同的运动模型(一个或多个数学公式组成运动模型)。同时由于真实世界中物体的运动是个相对复杂的运动过程,因此,生成所述对象在所述动画场景中的运动参数的过程中,可能会对现有的运动模型进行改进或重新设置符合该动画场景的运动模型,以降低处理器的计算量。本申请实施例对采用的运动模型不做限制。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.
如前所述,对象的运动模型可以由一个或多个数学公式组成,运动模型中的输入参数包括对象的物理参数(例如质量、刚度、重心等)和对象的初始参数(例如,作用在对象上的力、对象的初始速度等),运动模型的输出参数包括对象的运动参数(例如,对象随时间变化的速度、随时间变化的位移、对象的形变面积等)。根据一个或多个数学公式组成的运动模型,以及对象的物理参数和初始参数,就可以得到对象的运动参数。生成对象的运动参数的过程可以参照后续实施例中的描述。在获得对象的运动参数后,可以基于对象的运动参数仿真获得对象的运动动画。在仿真时,可能采用不同的动画引擎,该动画引擎中设置有相应的运动参数,通过改变动画引擎中的运动参数,仿真获得对象的运动动画。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 speed 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.
本申请实施例中,对象的外观参数可以包括:对象中像素点的颜色,对象中像素点的坐标,对象的面积或体积,对象所在用户界面中的主题颜色、对象的透明度、对象的模糊度等。通过对象的外观参数的描述可以理解,对象的外观参数为从用户的视觉角度可以直观观察到不同对象之间差异的参数。本申请实施例基于对象的外观参数为对象赋予物理参数,使得对象的物理参数遵循真实世界中用户的视觉感知。通过对象的物理参数生成的对象的运动参数能够更符合真实世界中的物体运动过程。因此,通过本申请实施例获得的对象的运动动画不仅能够提供不同对象间差异化的动画效果;还能够使得生成的对象的运动动画更符合真实世界中对象的运动过程,提高用户的交互体验。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.
下面将描述步骤302中的根据对象的外观参数,为对象赋予物理参数的实现过程。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.
以对象的质量进行举例,描述基于对象的外观参数赋予用户界面中对象的质量的方法。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.
从生活中的经验来看,物体的颜色越深,物体的质量往往越大。因此,可以根据所述对象中像素点的颜色,计算所述对象的质量。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.
在对象所在的界面中,有可能存在亮色的主题背景,还可能存在暗色的主题背景。在亮色的主题背景中,用户界面中的对象的颜色与主题背景的颜色的差异越大,则对象的质量越大;反之,暗色的主题背景中,用户界面中对象的颜色与主题背景的颜色的差异越大,则对象的质量也越大。因此,可以基于对象中的每个像素点的颜色和所述对象所在用户界面的主题颜色之间的第一差异,计算对象的质量。实际应用中,可以采用能够代表两个值(像素点的颜色值和主题颜色值)的差异的函数作为对象的质量的计算模型。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.
作为举例,可以通过以下函数关系计算对象中每个像素点的质量,然后再根据每个像素点的质量,生成对象的质量。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.
或, or,
其中,mi表示对象中第i个像素点的质量,ai表示对象中第i个像素点的颜色,b表示用户界面的主题的颜色。Among them, mi represents the quality of the i-th pixel in the object, ai represents the color of the i-th pixel in the object, and b represents the color of the theme of the user interface.
实际应用中,可以预先设置用户界面的主题的颜色为两类,分别为亮色主题和暗色主题。其中亮色主题的颜色值为白色表示的值,例如,0XFFFFFF;暗色主题的颜色值为黑色表示的值,例如,0X000000。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.
当电子设备的用户界面中的主题为用户自定义的图片时,还可以先将主题图片生成灰度图像,计算该灰度图像中像素点的灰度均值,并设置灰度阈值,在该主题图片的灰度均值大于灰度阈值的情况下,认为当前主题为亮色主题,在该主题图片的灰度均值小于灰度阈值的情况下,认为当前主题为暗色主题。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.
在计算获得对象中每个像素点的质量之后,还可以对计算获得的每个像素点的质量进行归一化处理:After calculating the mass of each pixel in the object, the mass of each pixel calculated can also be normalized:
mi'=(mi-μ)/(mmax-mmin);m i '=(m i -μ)/(m max -m min );
其中,mi'表示对象中第i个像素点的归一化质量,μ为自主定义的一个常数,mmax表示颜色的最大值,可以设置为0XFFFFFF,mmin表示颜色的最小值,可以设置为0X000000。Wherein, mi ' represents the normalized quality of the i-th pixel in the object, μ is a self-defined constant, mmax represents the maximum value of the color, which can be set to 0XFFFFFF, and mmin represents the minimum value of the color, which can be set to 0X000000.
若μ=0,则每个像素点归一化后的质量在0到1的范围内,因此,可以通过常数μ调节像素点归一化后的质量范围。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 μ.
对于真实世界中物体,体积越大,则物体的质量越大。相应的,对于二维物体,面积越大,则物体的质量越大。电子设备的显示屏呈现的用户界面中的对象通常为平面显示。可以理解为用户界面中的对象为二维物体。因此,用户界面中的对象的质量与用户界面中对象的面积相关。可以通过以下方式计算对象的质量。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.
其中,M表示对象的质量,mi'表示对象中第i个像素点的归一化质量,n表示对象中像素点的数量。Where M represents the mass of the object, mi ' represents the normalized mass of the i-th pixel in the object, and n represents the number of pixels in the object.
从用户的视觉角度,越透明的物体,质量越轻。因此,用户界面中对象的质量还与对象的透明度有关。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.
鉴于上述分析可以得出:当考虑对象透明度对质量的影响时, Based on the above analysis, it can be concluded that when considering the impact of object transparency on quality,
其中,K表示透明度。K可以取0-1范围内的数值。对象越透明,K越小,对象的质量越轻。当然,实际应用中,还可以通过其他函数关系表示透明度和对象的质量的正向关系。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.
其中,对象的透明度可以通过调用系统内部的透明度参数获取。例如,电子设备的设置界面中存在为对象设置透明度的选项,用户可以通过该选项设置透明度。在需要为该对象赋予质量、且需要考虑透明度对质量的影响时,可以获取用户在透明度设置选项设置的透明度值。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.
当然,若系统未对对象的透明度进行设置,则可以默认对象的透明度为预先设置的定值,例如,K可以为1。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.
为了便于区分,也可以将未考虑对象的透明度生成的对象的质量记为第一质量值,将考虑了对象的透明度生成的对象的质量记为第二质量值。实际应用中,可以根据具体情况考虑将第一质量值或者还第二质量值作为对象的质量参数。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.
以对象的重心进行举例,描述基于对象的外观参数赋予用户界面中对象的重心的方法。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.
如前所述,可以计算获得对象中每个像素点的质量,而对象中每个像素点的坐标可以获得,即已知对象的质量分布,因此,可以根据对象中的每个像素点的质量以及对象的质量分布计算获得对象的重心。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.
在计算对象的重心时,可以采用迭代法,具体可参照如下过程:When calculating the center of gravity of an object, an iterative method can be used. The specific process is as follows:
在二维空间中,采用空间直角坐标系O-XY。对象可以微元出n个质点(或者n个像素点),第i个质点的坐标为(xi,yi),第i个质点的质量为mi',对象的质量M=m1'+…+mi'+…+mn'。In two-dimensional space, a spatial rectangular coordinate system O-XY is used. The object can be differentiated into n particles (or n pixels), the coordinates of the ith particle are ( xi , yi ), the mass of the ith particle is mi ', and the mass of the object is M = m1 '+...+ mi '+...+ mn '.
对象的重心的坐标为G(x,y),通过以下公式计算获得。The coordinates of the center of gravity of the object are G(x,y), which are calculated by the following formula.
x=(x1m1'+…+ximi'+…+xnmn')/M;x=(x 1 m 1 '+...+x i m i '+...+x n m n ')/M;
y=(y1m1'+…+yimi'+…+ynmn')/M。y=(y 1 m 1 '+...+y i m i '+...+y n m n ')/M.
上述公式中计算重心的坐标时,采用每个像素点的归一化质量,实际应用中,还可以采用每个像素点归一化前的质量。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.
当然,实际应用中,电子设备的显示屏呈现的用户界面中要实现三维对象在三维空间中的动画效果的情况下,还可以在三维对象所在的空间中确定空间直角坐标系O-XYZ。对象可以微元出n个质点(或者n个像素点),第i个质点的坐标为(xi,yi,zi),第i个质点的质量为mi',对象的质量M=m1'+…+mi'+…+mn'。Of course, in practical applications, if 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 the electronic device, the 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), the coordinates of the i-th particle are ( xi , yi , zi ), the mass of the i-th particle is mi ', and the mass of the object is M = m1 '+...+ mi '+...+ mn '.
对象的重心的坐标为G(x,y,z),通过以下公式计算获得。The coordinates of the center of gravity of the object are G(x,y,z), which are calculated by the following formula.
x=(x1m1'+…+ximi'+…+xnmn')/M;x=(x 1 m 1 '+...+x i m i '+...+x n m n ')/M;
y=(y1m1'+…+yimi'+…+ynmn')/M;y=(y 1 m 1 '+...+y i m i '+...+y n m n ')/M;
z=(z1m1'+…+zimi'+…+znmn')/M。z=(z 1 m 1 '+...+z i m i '+...+z n m n ')/M.
上述公式中计算重心的坐标时,采用每个像素点的归一化质量,实际应用中,还可以采用每个像素点归一化前的质量。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.
以对象的刚度进行举例,描述基于对象的外观参数赋予用户界面中对象的刚度的方法。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.
通常,刚度与物体的单位质量有一定关系,例如,常规存在的棉花和铁块,同样体积的面积和铁块,棉花的质量较轻,刚度较小,铁块的质量较重,刚度较大。因此,为了获得与真实世界相似的动画效果,可以设置单位质量越大的对象,刚度越大;反之,单位质量越小的对象,刚度越小。即对象的刚度与对象的单位质量呈正向关系。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 animation effects 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.
另外,对象的颜色也会与对象的刚度有关,在真实世界中,颜色越深的物体,用户的感觉越厚重,认为刚度越大。在亮色主题背景中,可以设置对象的外边框颜色与用户界面的主题颜色的差异越大,则对象的刚度越大;在暗色主题背景中,可以设置对象的外边框颜色与用户界面的主题颜色的差异越大,则对象的刚度越大。即对象的刚度与对象的外边框和用户界面的主题颜色的差异呈正向关系。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.
基于上述分析,可以得出用户界面中对象的刚度为:Based on the above analysis, it can be concluded that the stiffness of objects in the user interface is:
G=|b-c|×kG×Ms;G = |bc| × kG × Ms ;
其中,G表示对象的刚度,b表示用户界面主题的颜色,c表示对象的外边框颜色,kG表示刚度换算系数,Ms表示对象的单位质量。为了便于描述,将所述对象的外边框的颜色和所述对象所在用户界面的主题颜色之间的差异记为第二差异。Wherein, G represents the stiffness of the object, b represents the color of the user interface theme, c represents the color of the outer frame of the object, kG represents the stiffness conversion coefficient, and Ms represents 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.
其中,刚度换算系数kG可以为预先设置的正数,刚度换算系数的设置是为了使得计算获得的对象的刚度值在合理的范围内。例如,自然界中常用金属的刚度值在105MPa量级,通过该刚度换算系数,使得计算获得的对象的刚度值也在105MPa量级。The stiffness conversion coefficient k G may be a preset positive number, and the stiffness conversion coefficient is set to make the stiffness value of the object obtained by calculation within a reasonable range. For example, the stiffness value of commonly used metals in nature is in the order of 10 5 MPa, and through the stiffness conversion coefficient, the stiffness value of the object obtained by calculation is also in the order of 10 5 MPa.
如前所述,可以预先设置用户界面的主题的颜色为两类,分别为亮色主题和暗色主题。其中亮色主题的颜色值为白色表示的值,例如,0XFFFFFF;暗色主题的颜色值为黑色表示的值,例如,0X000000。c可以是对象的外边框范围(例如图4中日历图标中的外边框范围)中像素点的均值,若对象的外边框范围没有固定区域,则可以以对象的最外围边界向内延伸预设宽度作为外边框范围(图4中计算器图标的最外围边界和虚线之间的范围)内像素点的均值作为对象的外边框的颜色,该预设宽度可以设置。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 the value represented by white, for example, 0XFFFFFF; the color value of the dark theme is the value represented by black, for example, 0X000000. c can be the average value of the pixels in the outer border range of the object (for example, the outer border range of the calendar icon in Figure 4). If the outer border range of the object does not have a fixed area, the outer border range (the range between the outermost border of the calculator icon in Figure 4 and the dotted line) extending inward from the outermost boundary of the object can be used as the average value of the pixels in the outer border range as the color of the outer border of the object. The preset width can be set.
当对象为二维元素时,Ms=M/S,S表示对象的面积;当对象为三维元素时,Ms=M/V,V表示对象的体积。刚度换算系数用于调节对象的刚度值,实际应用中,也可以设置刚度换系数kG=1。When the object is a two-dimensional element, Ms = M/S, where S represents the area of the object; when the object is a three-dimensional element, Ms = M/V, where 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 kG can also be set to 1.
另外,还可以设置对象的刚度与透明度呈正向关系,可以设置对象的透明度为K,则对象的刚度为: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:
G=|b-c|×K×kG×Ms。G = |bc| × K × k G × Ms.
其中,对象的透明度K的取值、获取方式可参照生成对象的质量值时对对象的透明度的描述。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.
其次,对象的刚度还可能与用户界面中对象的模糊度(或清晰度)相关。当对象本身存在模糊效果,就会产生类似于棉花吸能的感觉,会降低对象的刚度。因此,在考虑模糊度的影响的情况下,对象的刚度表示如下: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:
G=|b-c|×K×kG×Ms×A。G = |bc| × K × kG × Ms ×A.
其中,A表示对象的模糊度。Where A represents the blurriness of the object.
实际应用中,A可以设置A为从0到1的值,对象越模糊,A的值越小,对象的模糊度也可以理解对象的清晰度。对象越模糊、该对象的清晰度越小,对象的刚度越小。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.
当然,在实际应用中,在为对象赋予刚度值的时候,还可以在不考虑对象的透明度的影响的情况下,考虑对象的模糊度的影响。即对象的刚度还可以表示如下: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:
G=|b-c|×kG×Ms×A。G = |bc| × kG × Ms ×A.
在实际应用中,对象的模糊度可以按照如下方式获得:在存在对象的模糊度(或清晰度)的设置界面的情况下,可以获取该设置界面中模糊度的值。在不存在设置界面以供用户设置对象的模糊度的情况下,电子设备可以截屏获取该对象的图像,计算截屏中该对象的图像区域的清晰度。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.
为了便于描述,可以将未考虑了对象的透明度和模糊度生成的对象的刚度记为第一刚度,将考虑了对象的透明度生成的对象的刚度记为第二刚度,将考虑了对象的模糊度生成的对象的刚度记为第三刚度,将同时考虑了对象的透明度和模糊度生成的刚度记为第四刚度。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.
如前所述,只有在对象的位置发生变化的运动中才会产生一些参数,例如,对象在运动过程中受到的摩擦力,对象运动过程中受到的空气阻力。这些参数可能与对象的外观参数相关,也可能与对象的外观参数无关。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.
下面将描述在对象的位置发生改变的动画场景中,为对象赋予动态物理参数(或如前所述的受力参数)的方法。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.
以作用在对象的摩擦力进行举例,描述赋予用户界面中对象的摩擦力的方法。Taking the friction acting on an object as an example, the method of adding friction to objects in the user interface is described.
在真实世界的运动场景中,摩擦力是必不可少的。因此,为了获得和真实世界中的运动相似的动画效果,需要在动画场景中增加摩擦力。而在对象的动画场景中,通常考虑作用在对象上的滑动摩擦力。因此,可以将滑动摩擦力作为对象的一个物理参数。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.
在电子设备的用户界面中,主要考虑对象和与对象产生相对运动的另一对象之间的摩擦力。当对象与用户界面中的背景接触、且相对于用户界面中的背景运动的场景中,该另一对象为用户界面中的背景。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.
另外,通常对象的质量也会影响摩擦力的大小,所以,可以得出作用在对象上的摩擦力为: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:
Ff=M×OBE;F f =M×O BE ;
其中,Ff为作用在对象上的摩擦力,M为对象的质量,OBE为对象和该对象所在背景之间的相对摩擦系数。Among them, Ff is the friction force acting on the object, M is the mass of the object, and OBE is the relative friction coefficient between the object and the background where the object is located.
一个对象和该对象所在背景之间的相对摩擦系数可以通过以下方式获得:The relative friction coefficient between an object and its background can be obtained as follows:
首先计算该对象所在的背景角度的摩擦力,通常考虑颜色越深的对象,摩擦力越大。另外,由于真实世界中不存在完全光滑的物体,所以,需要设置背景角度的摩擦力的最小值大于0,基于上述描述,可以得出该对象所在背景角度的摩擦力: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 greater than 0. Based on the above description, the friction of the background angle where the object is located can be obtained:
Bf=e1+|0XFFFFFF-d|×kfB;B f =e 1 +|0XFFFFFF-d|×k fB ;
其中,Bf为背景摩擦力,e1为设置的最小背景摩擦力,d为对象所在背景的颜色,kfB为预先设置的背景摩擦力换算系数。Wherein, Bf is the background friction, e1 is the set minimum background friction, d is the color of the background where the object is located, and kfB is the preset background friction conversion coefficient.
其中,0XFFFFFF为白色对应的值。由于自然界中不存在摩擦力为0的背景物体,因此,可以设置正数作为最小背景摩擦力,作为举例,最小背景摩擦力可以为0.001、0.05、0.2、1、1.2等,本申请实施例对最小背景摩擦力的具体数值不做限制。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.
背景摩擦力换算系数可以调节得到的背景摩擦力的取值范围,使得得到的背景摩擦力与真实世界中的摩擦力属于同一量级。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.
实际应用中,d为对象所在背景中像素点的颜色的均值,作为举例,对象在蓝天场景中滑动,此时对象所在背景中像素点的颜色的均值表示蓝天场景中像素点的均值。或者,从对象所在背景中随机选取若干个像素点,计算选取的像素点的均值,将该均值作为对象所在背景中像素点的颜色的均值。In practical applications, d is the mean color of the pixels in the background where the object is located. For example, when the object slides in a blue sky scene, the mean color of the pixels in the background where the object is located represents the mean 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 mean of the selected pixels is calculated, and the mean is used as the mean color of the pixels in the background where the object is located.
基于背景角度的摩擦力的计算方法,可以得出对象角度的摩擦力:Based on the calculation method of the friction at the background angle, the friction at the object angle can be obtained:
Ef=e2+|0XFFFFFF-a|×kfE;E f =e 2 +|0XFFFFFF-a|×k fE ;
其中,Ef为对象摩擦力,e2为设置的最小对象摩擦力,a为对象的底色,kfE为预先设置的对象摩擦力换算系数。Where Ef is the object friction, e2 is the set minimum object friction, a is the background color of the object, and kfE is the preset object friction conversion coefficient.
其中,0XFFFFFF为白色对应的值。由于自然界中不存在摩擦力为0的物体,因此,可以设置正数作为最小对象摩擦力,作为举例,最小对象摩擦力可以为0.001、0.05、0.2、1、1.2等,本申请实施例对最小对象摩擦力的具体数值不做限制。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.
对象摩擦力换算系数可以调节得到的对象摩擦力的取值范围,使得得到的对象摩擦力与真实世界中的摩擦力属于同一量级。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.
实际应用中,a可以是对象中的像素点的颜色的均值。In practical applications, a can be the average color of the pixels in the object.
其中,背景摩擦力换算系数和对象摩擦力换算系数可以相等。The background friction conversion coefficient and the object friction conversion coefficient may be equal.
一个对象和该对象所在背景之间的相对摩擦系数可以基于背景摩擦力和对象摩擦力确定,在实际应用中,对象和该对象所在背景之间的相对摩擦系数(OBE)可以是背景摩擦力和对象摩擦力的积(Bf×Ef)等其他数据特征值。The relative friction coefficient between an object and its background can be determined based on the background friction and the object friction. In practical applications, the relative friction coefficient (O BE ) between the object and its background can be the product of the background friction and the object friction (B f ×E f ) or other data feature values.
真实世界中,一个物体越粗糙,通常摩擦力越大。对于用户界面中的对象,对象的模糊度也可以理解为真实世界中物体表面的粗糙度,因此,摩擦力还与用户界面中对象的模糊度有关。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.
基于上述的分析,可以得出摩擦力为:Based on the above analysis, the friction force can be obtained as:
其中,A表示对象的模糊度,对象的模糊度可以取0-1之间的数值。对象越模糊,A的取值越小,摩擦力越大,因此,对象的模糊度与摩擦力呈反向关系。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.
该示例中,对象的模糊度可参照上述描述,本申请实施例在此不再赘述。另外,为了便于描述,可以将未考虑对象的模糊度生成的对象的摩擦力记为第一摩擦力,将考虑对象的模糊度生成的对象的摩擦力记为第二摩擦力。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.
在真实世界的物体运动过程中,不可避免还会存在空气阻力。为了使得用户界面中对象的运动动画效果更接近于真实世界中的运动效果,还可以为对象的运动过程附加空气阻力,以模拟真实世界中的空气阻力。由于该空气阻力为对象运动过程中附加在对象上的,所以可以将该空气阻力设为对象的物理参数。通常可以理解为物体的运动速度越快,空气阻力越大。对于用户界面中的对象,也可以设置对象的运动速度越快,空气阻力越大。因此,可以设置空气阻力和运动速度之间的正向关系函数。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 also 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.
Fz=f(v);F z = f(v);
其中,Fz表示施加在运动的对象上的空气阻力,v表示对象的运动速度。Where Fz represents the air resistance exerted on the moving object, and v represents the moving speed of the object.
当然,实际应用中,还可以设置一个全局阻力FQ,该全局阻力为固定的阻力,可以设置的比较小。由于该全局阻力比较小,对于界面中对象参与的动画影响较小,也可以不配置该全局阻力。Of course, in actual applications, a global resistance F Q can also be set. The global resistance is a fixed resistance and can be set relatively small. Since the global resistance is relatively small, it has little effect on the animations participated in by objects in the interface, and the global resistance may not be configured.
为了匹配不同动画场景,还可以为对象赋予其他参数,或者采用其他运动模型为对象赋予上述物理参数,本申请实施例对此不做限制。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.
在为用户界面中的对象设置了一些物理参数后,就可以针对不同的动画场景中设置的运动模型生成对象的运动参数。本申请实施例后续通过几个动画场景进行举例,说明可以在不同的动画场景下,可以采用不同的运动模型获得对象的运动参数,从而生成对象的运动动画。当然,在相同的动画场景中,也可以采用不同的运动模型获得对象的运动参数,从而生成对象的运动动画。After setting some physical parameters for the object in the user interface, the motion parameters of the object 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 object in different animation scenes, thereby generating the motion animation of the object. Of course, in the same animation scene, different motion models can also be used to obtain the motion parameters of the object, thereby generating the motion animation of the object.
作为本申请的一个实施例,在用户界面中的对象参与的动画中,经常会有两个或两个以上的对象发生接触碰撞的过程。为了使得用户界面中对象参与的动画与真实世界中两个物体发生碰撞后的运动相似,可以根据对象的外观参数生成对象的物理参数,然后基于对象的物理参数生成对象的运动参数,从而根据对象的运动参数生成对象的运动动画。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.
以对象A和对象B的碰撞为例,可以根据动量守恒定律(MAvruA+MBvruB=MAvA0+MBvB0)和动能守恒定律(1/2MAvruA 2+1/2MBvruB 2=1/2MAvA0 2+1/2MBvB0 2)计算对象A和对象B的碰撞后的初速度。其中,vruA表示碰撞时对象A的速度(第一入速度),vruB表示碰撞时对象B的速度(第二入速度),vA0表示碰撞后对象A的速度(第一出速度),vB0表示碰撞后对象B的速度(第二出速度)。在获得碰撞后对象A的速度后,可以根据对象A受到的摩擦力和对象A碰撞后对象A的速度获得对象A随时间变化的瞬时速度以及相应的位移。碰撞后对象A的运动参数参照对象A的运动参数的计算过程,不再赘述。Taking the collision between object A and object B as an example, the initial velocity of object A and object B after the collision can be calculated according to the law of conservation of momentum (MAvruA+MBvruB = MAvA0 + MBvB0 ) and the law of conservation of kinetic energy ( 1 / 2MAvruA2 + 1 /2MBvruB2= 1 / 2MAvA02 + 1 / 2MBvB02 ). Wherein, vruA represents the velocity of object A at the time of collision (first entry velocity ) , vruB represents the velocity of object B at the time of collision (second entry velocity), vA0 represents the velocity of object A after the collision (first exit velocity), and vB0 represents the velocity of object B after the collision (second exit velocity). After obtaining the velocity of object A after the collision, the instantaneous velocity of object A changing with time and the corresponding displacement can be obtained according to the friction force on object A and the velocity of object A after the collision with object A. 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.
当然,实际应用中,还可以对上述模型进行修改,以形成新的运动模型获得该应用场景中对象A和对象B的运动参数。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.
作为示例,参照图5(a)所示,用户的手势给对象A(黑色小球)一个向对象B(应用D的图标)方向的力,对象A朝向对象B运动,使得对象A和对象B发生碰撞,该运行场景为运动的对象A碰撞静止的对象B。其中,静止的对象B可能是位置不固定的对象,也可能是位置固定的对象。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.
以运动的对象A碰撞静止的对象B为例,描述对象A和对象B发生碰撞后生成对象A和对象B的运动动画的过程。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.
1.1,根据对象A的外观参数生成对象A的物理参数,根据对象B的外观参数生成对象B的物理参数;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;
该动画场景中,物理参数包括:对象A的质量和对象B的质量,对象A的刚度和对象B的刚度。可以参照上述描述为对象赋予质量和刚度的相关描述。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.
1.2,获取对象A和对象B发生碰撞前对象A的瞬时速度vru(第三入速度);1.2, obtain the instantaneous velocity v ru (third input velocity) of object A before the collision between object A and object B;
在本申请实施例中,从对象A当前的位置运动到与对象B碰撞之前可以分为两个阶段: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:
第一个阶段,用户的手指从电子设备的触控屏抬起前,对象A受到向下的推力,向上的摩擦力(通过上述描述赋予对象的摩擦力),对象A从静止开始运动。其中,对象A受到的推力可以预先设置为定值,向上的摩擦力可以通过上述实施例中描述的赋予对象的摩擦力的方法确定。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.
第二个阶段,用户的手指从电子设备的触控屏抬起后,对象A受到向上的摩擦力,对象A开始减速运动直至与对象B发生碰撞。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.
通过上述描述可以得到对象A和对象B发生碰撞前对象A的瞬时速度vru。Through the above description, the instantaneous velocity v ru of object A before the collision between objects A and B can be obtained.
1.3,计算对象A和对象B发生碰撞后对象A的初始速度vA0(第三出速度)和对象B的初始速度vB0(第四出速度)。1.3, calculate the initial velocity v A0 (third outgoing velocity) of object A and the initial velocity v B0 (fourth outgoing velocity) of object B after the collision between objects A and B.
在本申请实施例中,可以将对象A的初始速度vA0和对象B的初始速度vB0的和记为vchu;In the embodiment of the present application, the sum of the initial velocity v A0 of object A and the initial velocity v B0 of object B may be recorded as v chu ;
其中,vchu=vru×Elose。Elose表示能量损失率,而碰撞产生的能量吸收损失通常与物理的刚性的特性相关,正是由于物体的非完全刚性的特性,导致碰撞过程会产生吸能。因此,可以设置: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, it can be set:
Elose=(GA+GB)/2×Gmax,Gmax为自定义的刚度的最大常量。E lose =( GA + GB )/2× Gmax , where Gmax is the maximum constant of the user-defined stiffness.
当然,实际应用中,还可以设置对象A和对象B为完全刚性的对象,这种情况下,不存在能量损失,则vchu=vru。Of course, in practical applications, object A and object B may also be set as completely rigid objects. In this case, there is no energy loss, and v chu =v ru .
在计算获得vchu之后,需要将vchu分配给对象A和对象B。After v chu is calculated, v chu needs to be assigned to object A and object B.
参照图5(b)所示,当对象B为位置固定的对象的情况下,则分配给对象B的速度为0,因此,vchu全部分配给对象A,即vA0=vchu,vB0=0。5( b ), when the object B is a fixed-position object, the velocity allocated to the object B is 0, and therefore, v chu is entirely allocated to the object A, that is, v A0 =v chu , v B0 =0.
参照图5(c)所示,当对象B为位置不固定的对象的情况下,将vchu分配给对象A和对象B。在实际应用中,可以根据对象A的质量和对象B的质量之间的关系,将vchu分配给对象A和对象B。5(c), when object B is an object with a non-fixed position, v chu is allocated to object A and object B. In practical applications, v chu can be allocated to object A and object B according to the relationship between the mass of object A and the mass of object B.
作为举例, As an example,
当然,还可能存在图5(d)所示的应用场景。该应用场景下,除了可以通过动量守恒定律(MAvru=MAvA0+MBvB0)和动能守恒定律(1/2MAvru 2=1/2MAvA0 2+1/2MBvB0 2)计算对象A和对象B的碰撞后的初速度,还可以采用其他运动模型以计算对象A和对象B碰撞后的初速度,该应用场景下的计算过程不再进行举例。Of course, there may also be an application scenario as shown in Figure 5(d). In this application scenario, in addition to calculating the initial velocity of object A and object B after the collision by the law of conservation of momentum (MAvru = MAvA0 + MBvB0 ) and the law of conservation of kinetic energy (1/ 2MAvru2 = 1 / 2MAvA02 + 1 / 2MBvB02 ), 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.
1.4,计算对象A受到的摩擦力FfA和空气阻力FzA以及对象B受到的摩擦力FfB和空气阻力FzB。1.4. Calculate the friction force F fA and air drag F zA on object A, and the friction force F fB and air drag F zB on object B.
该步骤可以参照上述描述的为对象赋予摩擦力和空气阻力的相关描述。This step may refer to the above description of imparting friction and air resistance to the object.
在对象B为位置不固定的对象的情况下,需要计算对象B受到的摩擦力FfB和空气阻力FzB。When the object B is an object whose position is not fixed, the friction force F fB and the air resistance F zB to which the object B is subjected need to be calculated.
在对象为位置固定的对象的情况下,不需要考虑对象B碰撞后的运动,因此不需要计算对象B受到的摩擦力FfB和空气阻力FzB。When the object is a fixed position object, the movement of the object B after the collision does not need to be considered, and therefore the friction force F fB and the air resistance F zB on the object B do not need to be calculated.
1.5,通过vAt=vA0+aAt计算对象A随时间变化的速度vAt。1.5, calculate the velocity v At of object A changing with time by v At =v A0 +a At .
其中,对象A的加速度aA=FfA+FzA/MA。Here, the acceleration of the object A is a A =F fA +F zA / MA .
当对象B为位置不固定的对象的情况下,vBt=vB0+aBt计算对象B随时间变化的速度vBt,其中,对象B的加速度aB=FfB+FzB/MB。When the object B is an object with a non-fixed position, v Bt =v B0 +a Bt is used to calculate the velocity v Bt of the object B that changes with time, wherein the acceleration of the object B a B =F fB +F zB / MB .
基于上述计算出的对象A和对象B随着时间变化的速度(也可以是位移),可以构建更贴近真实世界的碰撞后的运动动画。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.
通过上述描述可以理解,在计算对象A和对象B发生碰撞后的运动参数的过程中,可以根据具体场景选择合适的运动模型。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.
作为本申请另一实施例,在真实世界中,当一些物体下方存在弹簧的情况下(或者物体所在的支撑物存在弹力的情况下),当用户对该物体施加向下的按压力,则该物体会存在回弹的现象。本申请实施例以该应用场景进行举例,描述如何基于对象的外观参数模拟出接近真实世界中的按压回弹动画。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.
参照图6(a)至图6(d)所示,在用户界面中用户对对象进行按压操作时,假定该对象下方的用户界面存在弹力的情况下,可能出现该对象的回弹现象。因此,以用户界面中的联系人名片模拟按压回弹动画。在生成回弹动画之前,首先需要计算回弹动画所需要的物理参数。6(a) to 6(d), when a user presses an object in a user interface, assuming that there is elastic force 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 the rebound animation, the physical parameters required for the rebound animation need to be calculated first.
2.1,根据对象的外观参数计算对象的质量。2.1, the mass of the object is calculated based on its appearance parameters.
该步骤可参照如前描述的赋予对象质量的过程。其中,对象可以是图6(a)至图6(d)中lily的名片。This step may refer to the process of assigning mass to an object as described above. The object may be Lily's business card as shown in FIG. 6( a ) to FIG. 6( d ).
2.2,根据反弹度以及对象的质量,计算得到作用在对象上的回弹力。2.2, based on the rebound degree and the mass of the object, calculate the rebound force acting on the object.
在实际应用中,可以认为在对象的底端设有弹簧,用户通过在电子设备的触控屏上按压施加给对象一个按压力。在电子设备的触控屏中设有压力传感器的情况下,可以将压力传感器采集的用户对屏幕的按压力设置为作用于对象上的按压力。当然,在电子设备的触控屏未设置压力传感器的情况下,通过在系统中预先设定好当触控屏监测到用户的触点的情况下,可以根据触点的按压时间(接触时间)或触点的接触面积,获得施加在对象上的按压力。用户的手势的触点与触控屏的按压时间越长或接触面积越大,相应的按压力越大,对象向下压的程度越大(也可以理解为弹簧的压缩距离越大)。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 monitors 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).
当然,也可以在系统中设置施加在对象上的按压力是固定的值。在具体实现时,可以基于电子设备的处理器的处理能力选择适合的获得对象受到的按压力的模型。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.
假设作用在对象上的按压力为FY,对象的重力为Gg,根据作用力和反作用力相等的原理,可以得到作用在对象上的回弹力FT=FY+Gg。Assuming that the pressing force acting on the object is F Y and the gravity of the object is G g , according to the principle that the action force and the reaction force are equal, the rebound force acting on the object can be obtained as FT = F Y + G g .
作为本申请另一实施例,还可以设置与按压方向相反的反弹度KT。由于反弹度需要克服对象的重力促使该对象回弹,因此,可以通过该反弹度以及对象的质量得到作用在该对象上的回弹力。As another embodiment of the present application, a rebound K T in the opposite direction to the pressing direction may be set. Since the rebound needs to overcome the gravity of the object to cause the object to rebound, the rebound force acting on the object may be obtained by the rebound and the mass of the object.
即FT=KT/M。That is, FT = KT /M.
在实际应用中,可以将反弹度设置为定值,从而计算获得对象受到的回弹力;也可以基于用户的按压力、按压时间或接触面积获得相应的反弹度,从而基于反弹度和对象的质量计算获得作用在对象上的回弹力FT。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 FT acting on the object based on the rebound degree and the mass of the object.
作为本申请另一实施例,由于对象可能为非完全刚性物体,可以参照上述示例计算对象的刚度。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.
在具体实现时,在计算回弹力时,通过乘以该对象的刚度,以获得施加在该对象上的回弹力。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.
例如,FT=G×KT/M。For example, FT = G x KT /M.
为了便于描述,可以将未考虑对象的刚度生成的回弹力记为第一回弹力,将考虑对象的刚度生成的回弹力记为第二回弹力。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 by considering the stiffness of the object may be recorded as the second resilience.
2.3,根据回弹力计算获得对象按压位移。2.3, the object pressing displacement is obtained based on the rebound force calculation.
在实际应用中,可以设置对象下方的弹簧的弹簧系数是定值。则可以得出,弹簧的压缩长度(对象的按压位移)为: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:
x=FT/k。x = FT /k.
当然,由于对象的重力作用,对象和对象下方的弹簧处于平衡状态时,弹簧处于压缩的状态,因此,可以通过xp=G/k计算对象和弹簧处于平衡状态下弹簧的压缩长度(或对象的平衡位移),通过x-xp获得按压时弹簧压缩了多少长度。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, the compressed length of the spring when the object and the spring are in equilibrium (or the equilibrium displacement of the object) can be calculated by x p =G/k, and the length of the spring compressed when pressed can be obtained by x p .
参照图6(a)所示,当用户向下压一个名片的时候,名片可以向下运动一定距离。由于用户的视角,距离越远的物体,看起来越小。因此,从用户的视角,该对象看起来好像变小了,其中,图6(a)中虚线表示的位置是未施加按压力时名片的位置。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.
通过步骤2.1至步骤2.3可以理解,当作用于对象上的按压力不是定值的情况下,随着用户的按压力度增大、手势中触点的接触时间变长、或手势中触点的接触面积增加,名片可能越来越小。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.
2.4,在弹簧的弹簧系数、弹簧的压缩长度、弹簧上方的对象的质量已知的情况下,可以计算当用户的手势抬离电子设备的触控屏后对象的运动参数,从而生成对象的运动动画。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.
在用户的手势抬离电子设备的触控屏后,在对象弹起到平衡状态对应的位置之前,对象受到的作用力为向下的重力以及向上的回弹力。其中,对象的重力不变,对象受到的向上的回弹力与弹簧的压缩长度相关。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.
在实际应用中,根据弹簧的弹性势能和动能的转化的原理,对象可能在回弹力和重力的作用下,向上弹起到平衡状态对应的位置(图6(b)所示),由于重力的作用该位置时弹簧处于压缩状态;然后继续向上弹起超出平衡位置(图6(c)),超出平衡状态对应的位置后,名片变大;最后再回落到平衡状态对应的位置(图6(d)),该位置时名片与平衡状态对应的位置的名片一样大。当然,实际应用中,还存在空气阻力,才能使得对象和弹簧回到平衡状态并稳定。因为,在考虑弹簧的弹性势能和动能的转化的原理的同时,还考虑空气阻力做功的影响。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)). Due to the action of gravity, the spring is in a compressed state at this position; 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.
即通过可以得出对象在每个位置上的速度。That is, through The velocity of the object at each position can be found.
当然,实际应用中,在对象的质量较轻或按压力度较大的时候,可能中间会回弹几次后,才会回到平衡状态对应的位置;在对象的质量较重或按压力度较小的时候,可能从按压位置直接回弹到平衡状态对应的位置。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 pressing position to the position corresponding to the equilibrium state.
需要说明,在实际应用中,在计算对象的运动参数的过程中,可以对现有的一些物理定理进行修订以降低计算量,本申请实施例对此不做限制。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 limit this.
作为本申请另一实施例,在真实世界中,当对一个物体施加按压力的情况下,还可能出现该物体的倾斜、变形等情况。本申请实施例将描述对界面中的对象施加按压力时,生成对象的运动动画的方法。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 application embodiment will describe a method for generating a motion animation of an object when a pressure is applied to an object in an interface.
3.1,计算对象的质量和重心;3.1, calculate the mass and center of gravity of the object;
该步骤可参照如前所述的为对象赋予质量和重心的方法。This step may refer to the method of assigning mass and center of gravity to the object as described above.
3.2,获得按压力。3.2, obtain pressing force.
本申请实施例中,可以预先设置了按压力和按压面积(用户的手势与触控屏的接触面积)之间的对应关系,作为举例,可以设置用户的手势与触控屏之间的接触面积和按压力之间的正向函数关系,当然,实际应用中,还可以将按压面积设置为多个区间,不同区间对应不同的按压力。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.
当然,实际应用中,也可以在设置了压力传感器的触控屏上,通过设置的压力传感器获得按压力。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.
3.3,根据按压力的大小,计算对象的倾斜位移。3.3, calculate the tilt displacement of the object according to the magnitude of the pressing force.
该步骤中,遵循对象被按压后,重心不变的原则(即对象发生倾斜时的倾斜轴与对象的重心重合)。参照图7(a)至图7(c)所示,图7(a)中,对象上方的圆点表示对象的重心所在的位置。当用户在图7(b)所示的位置施加向下的按压力的情况下,该对象以重心所在的轴为倾斜轴(按压力的位置和重心位置的直线与倾斜轴呈垂直关系),形成图7(b)所示的倾斜,其中,虚线表示的为该对象未施加按压力前的位置。当用户在图7(c)所示的位置施加向下的按压力的情况下,该对象以重心所在的轴为倾斜轴(按压力的位置和重心位置的直线与倾斜轴呈垂直关系),形成图7(c)所示的倾斜。其中,虚线表示的为该对象未施加按压力前的位置。In this step, the principle that the center of gravity of the object remains unchanged after being pressed is followed (i.e., the tilt axis when the object tilts coincides with the center of gravity of the object). Referring to Figures 7(a) to 7(c), in Figure 7(a), the dot above the object indicates the position of the center of gravity of the object. When the user applies a downward pressing force at the position shown in Figure 7(b), the object takes 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 Figure 7(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 Figure 7(c), the object takes 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 Figure 7(c). Wherein, the dotted line represents the position of the object before the pressing force is applied.
在实际应用中,电子设备的显示界面不仅要呈现倾斜效果,还需要呈现倾斜的动画过程。因此,需要根据按压力的位置以及按压力的大小,计算对象的倾斜过程。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.
图7(a)至图7(c)所示,类似于真实世界中两个人在玩跷跷板的场景,由于支点为重心,因此相当于跷跷板两侧的人的重量一致,在对其中一侧施加一个向下的力后,要想该侧的人再次翘起来就需要该侧的人通过腿踏地给一个向上的弹力。因此,可以在图7(a)所示场景中,对象位于重心两侧的下方分别设置一个弹簧,该弹簧用于给对象向上的弹力。具体可参照图8(a)和图8(b)所示。As shown in Figures 7(a) to 7(c), 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 Figure 7(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 Figures 8(a) and 8(b).
参照图8(a)所示,对象的两侧下方分别设有一个弹簧,以左侧为例,该侧受到向上的弹力,该弹力可以用kx表示,其中,k表示弹簧系数,x表示弹簧的伸缩距离,同时该侧还受到向下的重力,可以用表示,基于定理F=ma可以得出 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
参照图8(b)所示,可以设定弹簧的弹簧系数由施加的作用力的位置与重心之间的距离和力矩确定,例如可以采用k=aL表示。a为力矩系数,L表示施加的作用力的位置与重心之间的距离。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 can be used to represent it, where a is the moment coefficient and L represents the distance between the position of the applied force and the center of gravity.
通过上述两个公式可以获得对象随时间变化的倾斜位移。The above two formulas can be used to obtain the tilt displacement of the object over time.
当然,实际应用中,还可以是其他形式的倾斜效果,参照图9(a)所示,最上层显示的为未施加按压力的情况下对象的状态;中间层显示的为当在对象的其中一个角施加按压力时,以该角相对的另一个角作为支点,产生倾斜效果(虚线表示该对象的原始状态);最下层显示的为当在对象的其中一个边施加按压力时,以该边相对的另一边作为倾斜轴,产生倾斜效果(虚线表示该对象的原始状态)。当然,还可以产生其他的倾斜效果,本申请实施例对此不做限定。由图9(a)可以理解,倾斜轴与第一连线(作用在所述对象上的按压力的受力点和所述对象的重心之间的连线)垂直,但是倾斜轴与重心不重合。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.
3.4,计算对象的刚性,根据刚性和按压力,计算按压导致的对象形状变化的程度。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.
在实际应用中,可以预先设定对象的刚性越大,形变越小,按压力越大,形变越大。即形变度与对象的刚性呈反向关系,与按压力呈正向关系。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.
作为举例,Bx=X×FY/G;As an example, B x =X×F Y /G;
其中,Bx表示对象的形变度,X表示预先设置的常数,该常数可以调节对象的形变度,FY表示按压力,G表示对象的刚度。Among them, Bx represents the deformation of the object, X represents a preset constant that can adjust the deformation of the object, Fy represents the pressing force, and G represents the stiffness of the object.
形变度表示形变的程度。在形变的程度确定后,还可以根据对象的面积确定形变面积。例如,可以根据对象的面积乘以形变度得到该对象产生的形变面积。最后根据形变面积生成对象的形变区域。可以预先设置形变区域的中心为作用在所述对象上的按压力的受力点。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.
另外,由于形变区域与按压力的受力点为中心,计算得到的形变区域可能超出了对象本身的区域,这种情况下,在对象的区域内生成形变动画,在对象以外的区域,生成形变动画。In addition, since the deformation area is centered on the point of pressure, the calculated deformation area may exceed the area of the object itself. In this case, a deformation animation is generated in the area of the object, and a deformation animation is generated in the area outside the object.
参照图9(b)所示,最上层显示的为未施加按压力的情况下对象的状态;中间层显示的为当在对象的其中一个角施加按压力时,该角产生形变效果(虚线表示该对象的原始状态);最下层显示的为当在对象的其中一个边施加按压力时,该边产生形变效果(虚线表示该对象的原始状态)。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).
通过图9(b)所示,当用户按压该对象的一个角时,产生的形变区域可能是以该角为中心的形变区域,由于计算获得的形变区域只有1/4在对象所在的区域内,其中3/4的形变区域在对象所在的区域以外,因此,生成的对象的形变动画为所在的区域内的1/4形变区域。当然,还可以产生其他的形变效果,本申请实施例对此不做限定。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.
当然,除了需要生成形变区域,还可以生成形变深度(按压下去的深度),该形变深度与形变度相关,形变度越大,形变深度越大。形变深度与形变度呈正向关系,例如,可参照hF=khBx,其中,hF为形变深度,kh为预设的深度系数,用于调节形变深度。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, h F = k h B x can be referred to, where h F is the deformation depth and k h is a preset depth coefficient for adjusting the deformation depth.
3.5,根据对象的质量,计算按压导致的对象的位置和弹性变化。3.5. Calculate the position and elastic changes of the object caused by pressing according to the mass of the object.
步骤3.5可参照上一实施例中描述的按压回弹的运动动画生成的过程,也可以对上一实施例描述的按压回弹过程采用的运动模型进行简化,在此不再赘述。Step 3.5 may refer to the process of generating the motion animation of the press-rebound 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.
参照图9(c)所示,3个图中上层显示的为未施加按压力的情况下对象的状态,下层分别显示的按压力不同的效果,图9(c)中的3个图,从左至右表示按压力从小到大的按压效果,图9(c)中的第一个图中作用在对象上的按压力最小,对象的按压位移也最小,图9(c)中的第三个图中作用在对象上的按压力最大,对象的按压位移也最大。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.
通过图9(a)至图9(c)可以理解,步骤3.3将按压导致的对象的倾斜考虑在对象的按压动画中,步骤3.4将按压导致的对象的形变考虑在对象的按压动画中,步骤3.5将按压导致对象的位移和按压回弹考虑在对象的按压动画中。当然,实际应用中,还可以设置在对象的按压动画中,考虑倾斜、形变、位移回弹中的一种、两种或三种,本申请实施例对此不做限定。It can be understood from Figures 9(a) to 9(c) 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 embodiments of the present application are not limited to this.
在本申请实施例中,生成对象的按压动画中,还可以生成立体的按压动画效果,或平面的按压动画效果。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.
参照图10所示,图10中的第一个图为对象的俯视图,第二个图为对象为立体的按压效果图,第3个图为对象为平面的按压效果图。图10中的虚线表示对象按压前的平面位置图。Referring to Figure 10, the first figure in Figure 10 is a top view of the object, the second figure is a three-dimensional pressing effect diagram of the object, and the third figure is a two-dimensional pressing effect diagram of the object. The dotted line in Figure 10 represents the plane position diagram of the object before pressing.
参照图11所示,图11中的第一个图为对象的俯视图,第二个图为对象为立体的按压效果图,第3个图为对象为平面的按压效果图。图11中的虚线表示对象按压前的平面位置图。Referring to Figure 11, the first figure in Figure 11 is a top view of the object, the second figure is a three-dimensional pressing effect diagram of the object, and the third figure is a two-dimensional pressing effect diagram of the object. The dotted line in Figure 11 represents the plane position diagram of the object before pressing.
实际应用中,图11中的第二个图和第三个图中用户的手指对应的位置也可以存在按压形变的效果,例如,以手指对应的位置为中心的凹陷形变。图11中未示出以手指对应的位置为中心的凹陷形变。图11中的凹陷形变可以参照图9(b)中第三个图所示的按压形变效果图,图9(b)中第三个图所述的按压形变效果,可以理解为图11中以按压力的受力点所在的直线作为剖面线,剖开图11中的第三个图后的凹陷形变的剖面效果图。In actual applications, the positions corresponding to the user's fingers in the second and third figures in FIG11 may also have a pressing deformation effect, for example, a concave deformation centered on the position corresponding to the finger. The concave deformation centered on the position corresponding to the finger is not shown in FIG11. The concave deformation in FIG11 can refer to the pressing deformation effect diagram shown in the third figure in FIG9(b). The pressing deformation effect described in the third figure in FIG9(b) can be understood as a cross-sectional effect diagram of the concave deformation after cutting the third figure in FIG11 with the straight line where the force point of the pressing force is located as the section line.
作为本申请另一实施例,在真实世界中多个物体之间链式排布时,对其中一个物体施加的外力会造成链式排布的多个物体进行链式运动。而在用户界面中存在多个对象,且多个对象之间链式排布时,如果对其中一个对象施加外力,链式排布的多个对象也可以按照真实世界中一样生成链式运行的动画。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.
作为举例,参照图12所示,为链式排布的多个对象的立体图(图12中右侧的图)和对应的俯视图(图12中左侧的图)以及左视图(图12中下方的图)。若设定多个对象之间存在弹性连接,在具体实现过程中,可以按照如下方式生成链式运动的运动动画。As an example, as shown in FIG12, there is a three-dimensional view (the right side of FIG12) and a corresponding top view (the left side of FIG12) and a left view (the bottom of FIG12) of multiple objects arranged in a chain. If elastic connections are set between multiple objects, in the specific implementation process, a motion animation of chain motion can be generated in the following manner.
(1)计算出链式排布的每个对象的质量。(1) Calculate the mass of each object in the chain arrangement.
该步骤参照上述赋予对象的质量的描述,在此不再赘述。This step refers to the above description of assigning mass to the object, which will not be repeated here.
(2)基于施加的外力,使得当前对象产生运动。(2) Based on the applied external force, the current object moves.
作为举例,参照图13所示,当对对象A施加向上的拉力时,当前对象会产生向上的运动。As an example, referring to FIG. 13 , when an upward pulling force is applied to object A, the current object will move upward.
(3)将当前元素的运动效果传递给相邻的其他对象。(3) Transfer the motion effect of the current element to other adjacent objects.
作为举例,当对象A产生向上的运动的情况下,与对象A相邻的对象B1和对象B2也会产生向上的运动效果。For example, when object A moves upward, objects B1 and B2 adjacent to object A will also produce an upward movement effect.
(4)每个对象受到传递的外力后,使得当前元素产生运动,并继续影响相邻的元素。(4) After each object is subjected to the transmitted external force, the current element moves and continues to affect the adjacent elements.
同样的,对象B1产生相应的运动后,与对象B1相邻的C1也会生成相应的运动;对象B2产生相应的运动后,与对象B2相邻的C2也会生成相应的运动,相应的,对象D1和D2也会产生相应的运动。其中,对象B1的施力对象为对象A,对象C1的施力对象为对象B1,对象D1的施力对象为对象C1。对象B2的施力对象为对象A,对象C2的施力对象为对象B2,对象D2的施力对象为对象C2。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.
当然,实际应用中,传递的效果会因为对象的质量不同而不同,作为举例,若传递的链式力(通过链式排布的对象中的施力对象传递来的力)为F,且不考虑质量的影响,则接收链式力的对象受到的链式力就是F,如果考虑质量的影响,则受到的链式力Fch=F/M。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.
将质量因素考虑到链式运动中,这是由于一般物体的质量越大,则在拖动的过程中,物体受到的拖动影响越小,物体的质量越小,则在拖动过程中,物体受到的拖动的影响越大。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.
需要说明,由于在生成对象的运动动画时,对象并不是真实世界存在的物体,在计算对象的运动参数时,为了降低计算量不可避免会对一些运动模型进行修订,从而得到不同的运动模型,导致生成的运动动画存在一些差异。或者由于真实世界中的物体的运动比较复杂,将比较复杂的运动过程拆分为多个运动阶段,在不同运动阶段采用不同的运动模型,从而降低计算量。本申请实施例并不限定在得到对象的物理参数后,采用何种运动模型得到对象的运动参数从而生成对象的运动动画。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.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。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.
本申请实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应每一个功能划分每一个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。下面以采用对应每一个功能划分每一个功能模块为例进行说明: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:
参照图14,该电子设备1400包括:14 , the electronic device 1400 includes:
对象显示模块1401,用于在用户界面显示第一对象和第二对象,第一对象和第二对象的类型相同、外观不同;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;
动画生成模块1402,用于响应于作用在第一对象上的第一操作,生成第一对象的第一运动动画;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;
动画生成模块1402,还用于响应于作用在第二对象上的第二操作,生成第二对象的第二运动动画,第一操作和第二操作相同,第一运动动画和第二运动动画不同。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, the first operation and the second operation being the same, and the first motion animation and the second motion animation being different.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
检测到作用在第一对象上的第一操作;detecting a first operation acting on a first object;
获取第一对象的外观参数,并根据第一对象的外观参数为第一对象赋予物理参数;Acquire appearance parameters of the first object, and assign physical parameters to the first object according to the appearance parameters of the first object;
获取第一对象的初始参数;Get 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.
作为本申请另一实施例,第一对象的外观参数包括:第一对象中像素点的颜色,第一对象的物理参数包括:第一对象的质量;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;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
根据第一对象的外观参数为第一对象赋予物理参数包括:Assigning physical parameters to the first object according to the appearance parameters of the first object includes:
根据第一对象中像素点的颜色,生成第一对象的质量。The mass of the first object is generated according to the colors of the pixels in the first object.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
根据第一对象中像素点的颜色和第一对象所在用户界面的主题颜色之间的第一差异,生成第一对象的第一质量值,并将第一对象的第一质量值作为第一对象的质量。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.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
根据第一对象中像素点的颜色和第一对象所在用户界面的主题颜色之间的第一差异,生成第一对象中像素点的像素质量;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 the pixel quality of the pixels in the first object.
作为本申请另一实施例,第一对象的外观参数包括:第一对象的透明度;动画生成模块1402还用于: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:
在将第一对象的第一质量值作为第一对象的质量之前,根据第一对象的透明度和第一对象的第一质量值生成第一对象的第二质量值,并将第一对象的第二质量值作为第一对象的质量。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.
作为本申请另一实施例,第一对象的外观参数包括:第一对象中像素点的颜色和第一对象中像素点的坐标;第一对象的物理参数包括:第一对象的重心坐标;As another embodiment of the present application, the appearance parameters of the first object include: the color of the 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;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
根据第一对象中像素点的颜色和第一对象所在用户界面的主题颜色之间的第一差异,生成第一对象中像素点的像素质量;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.
作为本申请另一实施例,第一对象的外观参数还包括:第一对象的外边框颜色,第一对象的面积或体积;第一对象的物理参数包括:第一对象的刚度;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;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
计算第一对象的外边框的颜色和第一对象所在用户界面的主题颜色之间的第二差异;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;
根据第一对象的质量,以及第一对象的面积或体积,生成第一对象的单位质量;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;
根据第二差异和第一对象的单位质量,生成第一对象的第一刚度,并将第一对象的第一刚度作为第一对象的刚度。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.
作为本申请另一实施例,第一对象的外观参数还包括:第一对象的透明度;As another embodiment of the present application, the appearance parameter of the first object further includes: transparency of the first object;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
在将第一对象的第一刚度作为第一对象的刚度之前,根据第一对象的第一刚度和第一对象的透明度,生成第一对象的第二刚度,并将第一对象的第二刚度作为第一对象的刚度。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.
作为本申请另一实施例,第一对象的外观参数还包括:第一对象的模糊度;As another embodiment of the present application, the appearance parameter of the first object further includes: blurriness of the first object;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
在将第一对象的第一刚度作为第一对象的刚度之前,根据第一对象的第一刚度和第一对象的模糊度,生成第一对象的第三刚度,并将第一对象的第三刚度作为第一对象的刚度。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.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
根据第一对象的底色和第一对象所在背景的颜色,生成第一对象和第一对象所在背景之间的相对摩擦系数;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 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.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
根据第一对象的底色生成第一对象的对象摩擦力;generating an object friction force for 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.
作为本申请另一实施例,第一对象的外观参数还包括:第一对象的模糊度;As another embodiment of the present application, the appearance parameter of the first object further includes: blurriness of the first object;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
在将第一摩擦力作为第一对象运动过程中作用在第一对象上的摩擦力之前,根据第一摩擦力和第一对象的模糊度,生成作用在第一对象上的第二摩擦力,并将第二摩擦力作为第一对象运动过程中作用在第一对象上的摩擦力。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.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
获取第一对象的速度,根据第一对象的速度生成第一对象运动过程中作用在第一对象上的空气阻力。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.
作为本申请另一实施例,动画生成模块1402还用于:As another embodiment of the present application, the animation generation module 1402 is further used for:
基于第一对象的物理参数和第一对象的初始参数,生成第一对象的运动参数;generating motion parameters of the first object based on the physical parameters of the first object and the initial parameters of the first object;
根据第一对象的运动参数,生成第一对象的运动动画。作为本申请另一实施例,第一操作作用在第一对象上后,第一对象和第三对象发生碰撞;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;
第一对象的物理参数包括第一对象的质量,第一对象的初始参数包括第一对象的第一入速度;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;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
获取第三对象的物理参数和第三对象的初始参数,第三对象的物理参数包括第三对象的质量,第三对象的初始参数包括第三对象的第二入速度;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 a 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 based on 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.
作为本申请另一实施例,第一操作作用在第一对象上后,第一对象碰撞静止的第三对象;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;
第一对象的物理参数包括第一对象的质量和第一对象的刚度,第一对象的初始参数包括第一对象的第三入速度;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;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
获取第三对象的物理参数,第三对象的物理参数包括第三对象的质量和第三对象的刚度;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;
根据第一对象的第三入速度、第一对象的刚度和第三对象的刚度,计算第一对象的第三出速度和第三对象的第四出速度之和;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;
根据第一对象的第三出速度和第三对象的第四出速度之和,以及第一对象的质量和第三对象的质量之比,计算第一对象的第三出速度和第三对象的第四出速度;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;
根据第一对象的第三出速度和碰撞后作用在第一对象上的摩擦力,计算碰撞后第一对象随时间变化的速度和/或位移;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;
根据第三对象的第四出速度和碰撞后作用在第三对象上的摩擦力,计算碰撞后第三对象随时间变化的速度和/或位移。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.
作为本申请另一实施例,第一操作为作用在第一对象上的按压操作,第一对象产生按压回弹;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;
第一对象的物理参数包括:第一对象的质量;第一对象的初始参数包括:作用在第一对象上的反弹度和作用在第一对象上的弹性部件的弹性系数;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;
动画生成模块1402还用于:根据反弹度和第一对象的质量,生成作用在第一对象上的第一回弹力;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;
根据第一回弹力和弹性系数,计算第一对象的按压位移;Calculating a pressing displacement of the first object according to the first resilience force and the elastic coefficient;
根据第一对象的按压位移和弹性系数,计算第一对象所在场景中的弹性势能;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;
基于弹性势能等于第一对象的动能和作用在第一对象上的空气阻力做功的模型,获得第一对象的运动参数。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.
作为本申请另一实施例,第一对象的物理参数还包括:第一对象的刚度;As another embodiment of the present application, the physical parameter of the first object further includes: stiffness of the first object;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
根据第一回弹力和第一对象的刚度,生成作用在第一对象上的第二回弹力;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.
作为本申请另一实施例,第一操作为所用在第一对象上的按压操作,第一对象产生按压倾斜;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;
第一对象的物理参数包括:第一对象的重心;第一对象的初始参数包括:作用在第一对象上的按压力的受力点;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.
作为本申请另一实施例,第一对象的倾斜轴与第一对象的重心重合。As another embodiment of the present application, the tilt axis of the first object coincides with the center of gravity of the first object.
作为本申请另一实施例,第一操作为作用在第一对象上的按压操作,第一对象产生按压形变;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;
第一对象的物理参数包括:第一对象的刚度;第一对象的初始参数包括作用在第一对象上的按压力和按压力的受力点;第一对象的运动参数包括第一对象的形变区域;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;
动画生成模块1402还用于:The animation generation module 1402 is also used for:
根据作用在第一对象上的按压力和第一对象的刚度,计算第一对象的形变度;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;
根据第一对象的形变度和第一对象的面积,计算第一对象的形变面积;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.
作为本申请另一实施例,第一操作作用在第一对象上时,第一对象和与第一对象链式排布的第四对象之间产生链式运动,其中,第四对象受到的链式力为第四对象的施力对象受到的链式力除以第四对象的质量。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.
需要说明的是,上述电子设备/模块之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。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.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将电子设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中,上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。另外,各功能模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述电子设备中模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。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.
本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时使电子设备可实现上述各个方法实施例中的步骤。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.
本申请实施例还提供了一种计算机程序产品,当计算机程序产品在第一设备上运行时,使得第一设备可实现上述各个方法实施例中的步骤。An embodiment of the present application also provides a computer program product. When the computer program product runs on a first device, the first device can implement the steps in the above-mentioned method embodiments.
集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,计算机程序包括计算机程序代码,计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读介质至少可以包括:能够将计算机程序代码携带到第一设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。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.
本申请实施例还提供了一种芯片系统,芯片系统包括处理器,处理器与存储器耦合,处理器执行存储器中存储的计算机程序,以使电子设备实现本申请任一方法实施例的步骤。芯片系统可以为单个芯片,或者多个芯片组成的芯片模组。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.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。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.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及方法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。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.
以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。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, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such 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 be included in the protection scope of the present application.
Claims (24)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110169797.8A CN114880053B (en) | 2021-02-05 | 2021-02-05 | Animation generation method for objects in interface, electronic device and storage medium |
| PCT/CN2021/140952 WO2022166456A1 (en) | 2021-02-05 | 2021-12-23 | Animation generation method for objects in interface, and electronic device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110169797.8A CN114880053B (en) | 2021-02-05 | 2021-02-05 | Animation generation method for objects in interface, electronic device and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114880053A CN114880053A (en) | 2022-08-09 |
| CN114880053B true CN114880053B (en) | 2024-09-06 |
Family
ID=82666949
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110169797.8A Active CN114880053B (en) | 2021-02-05 | 2021-02-05 | Animation generation method for objects in interface, electronic device and storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN114880053B (en) |
| WO (1) | WO2022166456A1 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118151762B (en) * | 2024-05-10 | 2024-10-22 | 阿里云飞天(杭州)云计算技术有限公司 | Interactive page making method, system, editor, medium and program product |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1692329A (en) * | 2002-11-12 | 2005-11-02 | 索尼计算机娱乐公司 | Method and apparatus for processing files utilizing a concept of weight so as to visually represent the files in terms of whether the weight thereof is heavy or light |
| CN103853423A (en) * | 2012-11-28 | 2014-06-11 | 三星电子株式会社 | Method for providing user interface based on physical engine and an electronic device thereof |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101354630B (en) * | 2008-09-12 | 2010-08-11 | 华为终端有限公司 | Human-machine interaction method of terminal equipment and terminal equipment thereof |
| KR101638056B1 (en) * | 2009-09-07 | 2016-07-11 | 삼성전자 주식회사 | Method for providing user interface in mobile terminal |
| US9367233B2 (en) * | 2011-10-31 | 2016-06-14 | Samsung Electronics Co., Ltd. | Display apparatus and method thereof |
| CN103412708B (en) * | 2013-07-31 | 2016-12-28 | 华为技术有限公司 | Task management method on terminal unit and terminal unit |
| CN108351750B (en) * | 2016-06-12 | 2019-08-13 | 苹果公司 | Apparatus, method, and graphical user interface for processing intensity information associated with touch input |
| CN108920229A (en) * | 2018-06-11 | 2018-11-30 | 网易(杭州)网络有限公司 | Information processing method, device and storage medium and terminal |
| CN111714880B (en) * | 2020-04-30 | 2023-10-20 | 完美世界(北京)软件科技发展有限公司 | Picture display method and device, storage medium and electronic device |
-
2021
- 2021-02-05 CN CN202110169797.8A patent/CN114880053B/en active Active
- 2021-12-23 WO PCT/CN2021/140952 patent/WO2022166456A1/en not_active Ceased
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1692329A (en) * | 2002-11-12 | 2005-11-02 | 索尼计算机娱乐公司 | Method and apparatus for processing files utilizing a concept of weight so as to visually represent the files in terms of whether the weight thereof is heavy or light |
| CN103853423A (en) * | 2012-11-28 | 2014-06-11 | 三星电子株式会社 | Method for providing user interface based on physical engine and an electronic device thereof |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2022166456A1 (en) | 2022-08-11 |
| CN114880053A (en) | 2022-08-09 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112835445B (en) | Interaction method, device and system in virtual reality scene | |
| JP2022522491A (en) | Gesture processing method and device | |
| CN110141857A (en) | Facial display methods, device, equipment and the storage medium of virtual role | |
| EP4174625B1 (en) | Image display method and apparatus, computer readable storage medium, and electronic apparatus | |
| CN113552987A (en) | Graphical interface display method, electronic device, medium and program product | |
| CN104134230A (en) | Image processing method, image processing device and computer equipment | |
| CN109753892B (en) | Face wrinkle generation method and device, computer storage medium and terminal | |
| CN107103581B (en) | Image reflection processing method and device and computer readable medium | |
| US20230005227A1 (en) | Electronic device and method for offering virtual reality service | |
| US20230119849A1 (en) | Three-dimensional interface control method and terminal | |
| CN110660032A (en) | Object shielding method, object shielding device and electronic device | |
| CN110717964B (en) | Scene modeling method, terminal and readable storage medium | |
| CN107730433A (en) | One kind shooting processing method, terminal and computer-readable recording medium | |
| CN109324837A (en) | A kind of game running method, terminal and computer readable storage medium | |
| US20250193416A1 (en) | Adaptive Quantization Matrix for Extended Reality Video Encoding | |
| CN114880053B (en) | Animation generation method for objects in interface, electronic device and storage medium | |
| CN114201030A (en) | Device interaction method, electronic device and interaction system | |
| CN108022227A (en) | A kind of black and white background photo acquisition methods, device and computer-readable recording medium | |
| CN108848298B (en) | Picture shooting method, flexible terminal and computer readable storage medium | |
| CN114904279B (en) | Data preprocessing method, device, medium and equipment | |
| CN115469955B (en) | Real-time background blurring processing method, device and computer readable storage medium | |
| CN116048681B (en) | Icon display method, electronic device and computer-readable storage medium | |
| CN115499577B (en) | Image processing method and terminal device | |
| CN115220621B (en) | Graphical interface display method, electronic device, medium and program product | |
| CN115220620B (en) | Graphical interface display method, electronic device, medium and program product |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |