Animation generation method, device and electronic equipment
By generating random motion parameters for moving objects during the virtual lottery process and calculating their display positions in each animation frame in real time, the problems of poor animation smoothness and visual effects are solved, thereby improving user experience and retention rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2026-03-03
- Publication Date
- 2026-06-12
AI Technical Summary
In existing technologies, the animation in the virtual lottery process suffers from poor smoothness and visual effects due to the limited number of sequence frames, which affects the user's visual experience and retention rate.
By generating random motion parameters, including motion direction and target motion position, the display position of the moving object in each animation frame is calculated in real time, forming an animation of multiple moving objects moving randomly, avoiding reliance on sequence frames.
It improved the smoothness and visual effects of animations, enhancing the user's visual experience and retention rate.
Smart Images

Figure CN122199757A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of animation technology, and more specifically, to an animation generation method, apparatus, and electronic device. Background Technology
[0002] In virtual lotteries across various software programs, gashapon machines or lottery-like games can serve as lottery elements. Once the lottery starts, these elements need to bounce randomly around within a container. At the end of the lottery, the elements typically need to be arranged according to a pre-calculated lottery result, or the element corresponding to the winning result may exit the container from the bottom exit. Related technologies usually generate animations by playing pre-set sequence frames. However, to conserve system resources, the number of sequence frames is usually limited, making it difficult to achieve smooth and realistic animations, resulting in a poor user experience and impacting user retention to some extent. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide an animation generation method, apparatus and electronic device to improve the smoothness and visual effect of animation, enhance the user's visual experience and increase user retention rate.
[0004] In a first aspect, embodiments of the present invention provide an animation generation method, which provides a graphical user interface through a terminal device; the graphical user interface displays multiple moving objects; the method includes: responding to a preset trigger event, determining preset stop positions corresponding to the multiple moving objects according to the result of a target event; generating random motion parameters for each moving object, the random motion parameters including a motion direction and a target motion position; determining the display positions of the multiple moving objects in each animation frame in real time based on the initial display positions of the multiple moving objects in the graphical user interface and the random motion parameters; and displaying each animation frame in the graphical user interface based on the display positions of the multiple moving objects in each animation frame to form an animation; wherein, determining the display positions of the multiple moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determining its corresponding preset stop position as the display position of the moving object in the next frame.
[0005] Secondly, embodiments of the present invention provide an animation generation apparatus, which provides a graphical user interface through a terminal device; the graphical user interface displays multiple moving objects; the apparatus includes: a stop position determination module, used to determine preset stop positions corresponding to the multiple moving objects respectively in response to a preset trigger event and based on the result of a target event; a random parameter generation module, used to generate random motion parameters for each moving object, the random motion parameters including motion direction and target motion position; a display position determination module, used to determine the display positions of the multiple moving objects in each animation frame in real time based on the initial display positions of the multiple moving objects in the graphical user interface and the random motion parameters; and an animation frame display module, used to display each animation frame in the graphical user interface based on the display positions of the multiple moving objects in each animation frame, thereby forming an animation; wherein, the random parameter generation module is further used to: for each moving object, if the moving object is in a first motion state, determine the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determine its corresponding preset stop position as the display position of the moving object in the next frame.
[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described animation generation method.
[0007] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the above-described animation generation method.
[0008] The embodiments of the present invention bring the following beneficial effects: The aforementioned animation generation method, apparatus, and electronic device, in response to a preset trigger event, determine preset stop positions corresponding to multiple moving objects based on the result of a target event; generate random motion parameters for each moving object, including motion direction and target motion position; determine the display positions of the multiple moving objects in each animation frame in real time based on the initial display positions of the multiple moving objects in the graphical user interface and the random motion parameters; and display each animation frame in the graphical user interface based on the display positions of the multiple moving objects in each animation frame to form an animation. Specifically, determining the display positions of the multiple moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determining its corresponding preset stop position as the display position of the moving object in the next frame. This method calculates the display positions of each moving object in each animation frame in real time based on random motion parameters, forming an animation of multiple moving objects moving randomly in the graphical user interface, improving the smoothness and visual effect of the animation, enhancing the user's visual experience, and to some extent improving user retention.
[0009] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0011] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0012] Figure 1 A flowchart of an animation generation method provided in an embodiment of the present invention; Figure 2 A schematic diagram of a central angle provided in an embodiment of the present invention; Figure 3 A schematic diagram of a container containing small balls provided in an embodiment of the present invention; Figure 4 A schematic diagram of another central angle provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an animation generation device provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] In social media and gaming software, to implement various forms of lottery games, the server-side typically calculates the probabilities and sends the results to the client for animation. When implementing a 2D animation for a gashapon or lottery-like game, after the draw begins, the balls need to bounce randomly around within a container, and then have a customizable fixed arrangement after stopping. The winning ball can exit from the bottom exit.
[0015] In related technologies, 2D gashapon (capsule toy) lottery animations primarily rely on frame sequences. Based on the gashapon's color and the winning color, a corresponding sequence of frames is played. A pop-up window then displays the reward. Typically, to save storage space, the animation doesn't consist of many frames, resulting in a lower frame rate and a smaller movement range for the gashapon. A larger movement range would require more frames; otherwise, the distance between gashapon positions in each frame would be too large, appearing choppy. Furthermore, the lack of randomness in the frame sequences leads to a poor user experience.
[0016] Based on this, embodiments of the present invention provide an animation generation method, apparatus, and electronic device, which can be applied to virtual lottery processes.
[0017] See Figure 1 First, we will introduce an animation generation method provided by an embodiment of the present invention.
[0018] This method provides a graphical user interface (GUI) via a terminal device; the GUI displays multiple moving objects. These moving objects can be 2D or 3D models. When applied to a lottery scenario, the moving objects can be icons corresponding to lottery elements such as gashapon machines or balls. The display effects of multiple moving objects can be the same or different. For example, different moving objects are usually different in one or more of their attributes, such as size, color, texture, shape, or labeled characters.
[0019] Each moving object typically corresponds to a result of a target event. When this method is applied to a lottery scenario, the target event is usually a lottery event, and each moving object typically has a corresponding prize. Different moving objects may correspond to the same or different prizes. When no target event is generated, multiple moving objects are usually displayed statically in the graphical user interface.
[0020] The method includes the following steps: Step S102: In response to a preset trigger event, determine the preset stop positions corresponding to multiple moving objects based on the result of the target event.
[0021] The aforementioned preset trigger events are typically generated by users interacting with the terminal device. For example, a control that generates a preset trigger event can be set in the graphical user interface. When the user triggers this control through human-computer interaction, the preset trigger event is generated.
[0022] Typically, a probability can be set for each moving object, or for a game item that has a corresponding relationship with the moving object. The server corresponding to the application running on the terminal device usually determines the target event result based on the aforementioned pre-set probabilities. The target event result can correspond to a specific moving object or a specific game item. Therefore, based on the correspondence between moving objects and game items, the target item among multiple moving objects can be determined according to the game item corresponding to the target event result. After determining the target event result, the server will send it to the terminal device. Alternatively, the target event result can be generated by the terminal device based on a preset probability, which can be set according to specific circumstances.
[0023] Typically, a fixed position is set in the graphical user interface (GUI) as the preset stop position for the moving object corresponding to the target event result. The preset stop positions for other moving objects in the GUI can be randomly determined or randomly selected from multiple preset positions, depending on the requirements. This will not be discussed here.
[0024] Step S104: Generate random motion parameters for each moving object. The random motion parameters include the direction of motion and the target position.
[0025] To make the movement of an object random, its direction of movement in a graphical user interface (GUI) typically changes. To make the movement of an object continuous, a target position is usually set, and the object changes its direction of movement after moving to the target position. The target position can usually be set at the edge of the GUI, or the object's range of motion can be predefined, in which case the target position is a location on the boundary of that range.
[0026] For each moving object, the direction of movement can be randomly determined first, and then the target movement position can be determined by triggering the object to move along the direction of movement from its initial display position in the graphical user interface. As mentioned above, the target movement position is located at the edge of the graphical user interface, or at the edge of a preset movable range. The line connecting the initial display position and the target display position is aligned with the direction of movement.
[0027] Alternatively, the target movement position of the moving object in the graphical user interface can be determined randomly from the edge of the graphical user interface or the edge of a preset movable range. Then, the direction of the line connecting the initial display position of the moving object and the target movement position can be determined as the movement direction of the moving object.
[0028] Step S106: Based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters, determine the display position of multiple moving objects in each animation frame in real time.
[0029] The process of generating animation is essentially the process of refreshing the graphical user interface at a frame rate. During animation playback, multiple moving objects can be required to move throughout the entire playback process, or different moving objects can be limited to moving at different time periods during the animation playback process, remaining stationary at other time periods.
[0030] The motion state of a moving object can be called the first motion state, and the stationary state can be called the second motion state. For each moving object, if the moving object is in the first motion state, the display position of the moving object in the next frame is determined based on the display position of the moving object in the current frame and random motion parameters; if the moving object is in the second motion state, its corresponding preset stop position is determined as the display position of the moving object in the next frame.
[0031] When a moving object is in its first motion state, its display position in the next frame is usually different from its display position in the current frame. The motion speed of the moving object can be preset; it can be constant or change over time. For example, the motion speed can be set from slow to fast, then from fast to slow, and finally to 0. Different motion speeds can also be set for the target moving object corresponding to the target event result and other moving objects. For example, the target moving object's motion speed can always be the first speed, while the motion speed of other moving objects can change from the first speed to a slower second speed.
[0032] To reflect the randomness of a moving object's motion, a random direction of motion can be set for it. The direction of motion can be updated every specified number of animation frames.
[0033] The movement distance of a moving object between two animation frames can be determined based on the object's speed and the time interval between adjacent animation frames. Then, based on the movement distance, direction of movement, and the object's display position in the current frame, the object's display position in the next frame can be determined.
[0034] If the display position of the moving object in the next frame exceeds the target movement position, the random motion parameters need to be updated. In practice, it can be determined whether the distance between the current position of the moving object and the target movement position is less than the moving object's movement distance. If it is less, the random motion parameters need to be updated. Then, based on the updated random motion parameters and the display position of the moving object in the current frame, the display position of the moving object in the next frame is determined.
[0035] Typically, after a moving object enters its second motion state, it needs to be displayed at a corresponding preset stop position. As mentioned above, this position is usually determined based on the result of the target event. Therefore, its corresponding preset stop position is determined as the display position of the moving object in the next frame.
[0036] Step S108: Based on the display positions of multiple moving objects in each animation frame, display each animation frame in the graphical user interface to form an animation.
[0037] During the refresh of the graphical user interface (GUI), multiple lottery icons are displayed in the GUI according to the predetermined display positions of multiple moving objects in the current animation frame. The GUI refreshes according to the frame rate, displaying multiple continuously playing animation frames to form the animation.
[0038] The aforementioned animation generation method, in response to a preset trigger event, determines preset stop positions corresponding to multiple moving objects based on the result of the target event; generates random motion parameters for each moving object, including motion direction and target motion position; determines the display positions of multiple moving objects in each animation frame in real time based on the initial display positions of multiple moving objects in the graphical user interface and the random motion parameters; and displays each animation frame in the graphical user interface based on the display positions of multiple moving objects in each animation frame, forming an animation. Specifically, determining the display positions of multiple moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determining its corresponding preset stop position as the display position of the moving object in the next frame. This method calculates the display positions of each moving object in each animation frame in real time based on random motion parameters, forming an animation of multiple moving objects moving randomly in the graphical user interface, improving the smoothness and visual effect of the animation, enhancing the user's visual experience, and to some extent improving user retention.
[0039] The following embodiment provides a method for generating random motion parameters for each moving object, including motion direction and target motion position.
[0040] Typically, multiple candidate stop positions are pre-set. A designated position among these candidate stop positions is used to display the moving object corresponding to the target event result. The first position can be one or more positions. After obtaining multiple preset stop positions, the preset stop position of the target moving object corresponding to the target event result is determined as the designated position among the multiple candidate stop positions. In specific implementation, it is necessary to first determine the target moving object based on the target event result, then determine the preset stop position of the target moving object as the designated position, and then set the preset stop positions of other moving objects to correspond one-to-one with the other candidate stop positions.
[0041] The following embodiment provides a method for generating random motion parameters for each moving object, including motion direction and target motion position.
[0042] A target area can be preset in the graphical user interface (GUI) to restrict the movement of multiple moving objects within that area. In practice, the GUI can display a container icon; when the container icon includes the container's edge, the multiple moving objects are typically displayed within the target area defined by the container's edge. The container's shape can be polygonal, circular, or irregular, and there are no restrictions on its form.
[0043] For each moving object, the target motion position is randomly determined from the edge positions of the target area. An edge position can be randomly assigned as the target motion position. When the target area is circular, the target central angle corresponding to the moving object can be randomly determined. Then, based on a preset reference direction and the target central angle, the target motion position is determined from the edge positions of the target area; the angle between the direction from the center of the target area to the target motion position and the reference direction is equal to the target central angle. The reference direction is typically horizontal to the right, similar to the positive X-axis direction. Figure 2 As shown, OB represents the reference direction and C represents the target position corresponding to the moving object.
[0044] Furthermore, the direction of motion of a moving object can be determined based on its initial display position and target motion position in the graphical user interface. For example... Figure 2 As shown, assuming the initial display position of the moving object is the location of point A, the direction of movement can be the direction indicated by AC.
[0045] The following embodiments provide an implementation method for determining the display position of multiple moving objects in each animation frame in real time based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters.
[0046] In practical applications, this can be achieved through the following steps: (1) The preset playback duration corresponding to the animation is determined as the remaining playback duration of the animation.
[0047] Here, you can initialize a parameter to represent the remaining playback duration of the animation. Before the animation starts playing, its remaining playback duration is the preset playback duration of the animation.
[0048] (2) Determine the display position of multiple moving objects in the next frame based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters.
[0049] In practical implementation, calculations need to be performed for each moving object. First, the target distance between the initial display position and the target movement position of the moving object is calculated. This can be done using a two-point distance formula. Based on the moving object's speed and a preset time interval, the moving distance is determined. The preset time interval typically refers to the time difference between two adjacent animation frames, often called the "frame interval." As mentioned above, the moving speed can be fixed or variable. If fixed, the product of the moving speed and the frame interval can be used as the moving distance. If variable, the average moving speed between two animation frames needs to be determined, and the product of the average moving speed and the frame interval is used as the moving distance.
[0050] If the moving distance is less than or equal to the target distance, meaning the moving object will not exceed the target position, the display position of the moving object in the next frame can be determined directly based on its initial display position, direction of movement, and moving distance. Specifically, the position after moving the initial display position by the specified distance along the direction of movement can be determined as the display position of the moving object in the next frame.
[0051] If the moving distance exceeds the target distance, the moving object will exceed the target position. In this case, the random motion parameters of the moving object need to be updated. The method for updating the random motion parameters is similar to the method for determining the random motion parameters, and will not be elaborated here. When the distance between the updated target position and the original target position is too close, the moving object may still exceed the updated target position. Therefore, the distance between the updated target position and the current target position can be limited to be greater than or equal to a preset distance threshold, such as greater than twice the moving distance of the moving object. The specific setting can be configured according to requirements and is not limited here.
[0052] When a graphical user interface includes a circular target area to define the movement range of multiple moving objects, the target movement position is typically determined based on a randomly determined central angle. To limit the distance between the target movement positions before and after the update, preset conditions can be set for the central angle. Then, it can be determined whether the updated target movement position and the target movement position before the update meet the preset conditions. The preset conditions include: the angle between the direction from the center of the target area to the target movement position before the update and the direction from the center of the target area to the target movement position after the update is greater than or equal to a preset angle threshold. Generally, when the angle is limited to the range [0°, 180°], the larger the angle, the greater the distance between the target movement positions before and after the update. If this condition is not met, the random motion parameters need to be updated again until the updated target movement position and the target movement position before the update meet the preset conditions.
[0053] After updating the random motion parameters, the display position of the moving object in the next frame can be determined based on the updated random motion parameters and the display position of the moving object in the current frame. The specific implementation method will not be elaborated here.
[0054] (3) The next frame is determined as the current frame, and after the next frame is displayed in the graphical user interface, the remaining playback duration of the animation is updated based on the preset time interval between adjacent animation frames, and the target motion state corresponding to multiple motion objects is determined based on the updated remaining playback duration.
[0055] In practical implementation, the remaining playback time of the animation can be subtracted from the preset time interval to determine the updated remaining playback time. Further, if the updated remaining playback time is greater than 0, the target motion state corresponding to multiple moving objects is determined as the first motion state; that is, the multiple moving objects need to continue moving. If the updated remaining playback time is less than or equal to 0, the target motion state corresponding to multiple moving objects is determined as the second motion state; that is, the multiple moving objects need to prepare to stop and move to the preset stop position.
[0056] (4) If multiple moving objects are in the first motion state, for each moving object, the display position of the moving object in the next frame is determined based on the display position of the moving object in the current frame and the random motion parameters.
[0057] Similar to the implementation method of determining the display position of a moving object in the next frame based on its initial display position in the graphical user interface and random motion parameters, it is necessary to determine the distance the moving object travels within a preset time interval between the current frame and the next frame. Then, it is determined whether the target distance between the moving object's display position in the current frame and its current target motion position is greater than this travel distance. If it is greater than or equal to this distance, the display position of the moving object in the next frame can be determined based on its display position in the current frame, its motion direction, and this travel distance. If it is less than this distance, the random motion parameters need to be updated, and the display position of the moving object in the next frame is further determined based on the updated random motion parameters.
[0058] (5) Determine whether the multiple moving objects are in the second motion state; if not, execute the above step (3); if yes, execute step (6).
[0059] As mentioned above, when the remaining playback time of the animation is less than or equal to 0, the moving object is determined to be in the second state, indicating that the animation playback is about to end, and the moving object needs to enter the preset stop position and end the movement.
[0060] (6) For each moving object, the preset stop position corresponding to the moving object is determined as the display position of the moving object in the next frame.
[0061] The following embodiment uses a circular icon representing the moving object and applies it to a lottery scenario to illustrate the specific implementation of the above animation generation method.
[0062] When the above method is applied to a lottery scenario, the preset trigger event is the lottery event; each moving object has a corresponding reward element, and the reward elements corresponding to different moving objects can be the same or different; the target event result is the target lottery result, which indicates the target reward element of the reward elements corresponding to multiple moving objects, and the target reward element can be one or multiple.
[0063] For the sake of brevity, the circular icon will be referred to as the "ball". In this scenario, the movement of the ball is also limited to the interior of the container shown in the graphical user interface by displaying a container icon. This can be achieved in the following way: 1. Initialize the graphical user interface, set or calculate some constants, such as the number of balls, the initial position of each ball, the ending position of each ball, the color of each ball, and the winning symbol.
[0064] First, some interface constants are set, such as the number of spheres inside the container, the number of sphere colors, and the radius R of the spheres. This can be viewed as the process of setting up a moving object.
[0065] We also need to set global state variables for the animation. The pseudocode is as follows: #Animation Global Status ANIMATION_STATE_NONE = 0 # This means the animation is stopped. ANIMATION_STATE_SHAKING = 1 # Animation is playing, the ball is moving around (corresponding to the "first motion state" mentioned above) ANIMATION_STATE_SHOW_RESULT = 2 # The lottery results are about to be revealed. In this state, after the ball hits the wall, its next target position is the stopping position (corresponding to the "second motion state" mentioned above). It's also necessary to calculate the preset stopping position for each ball after the lottery stops. For example, if there are 10 ball icons, these 10 positions are calculated as candidate stopping positions after rotation, and a position list D is created for multiple candidate stopping positions. For aesthetic purposes, list D can be manually assigned from the beginning. The stopping positions can be set to have 3 positions in the bottom row, 4 in the second row, 2 in the third row, and 1 at the exit. When manually assigned, multiple lists D can be set, and a different ending position list is used in rotation after each lottery.
[0066] Of course, this list of positions D can also be generated by code. If the radius of the sphere is R, then the Y-axis coordinate of the center of the sphere in the nth row is (2n-1). R+dy, where dy is a random number less than 1 / 3R, which makes the ball distribution look more natural. The x-coordinate of the center of the ball in the m-th column is given by (2m-1). R+dx, where dx is a random number less than 1 / 3R. Simultaneously, ensure the X-coordinate does not exceed the container's edge to the left or right. In the list position D, the first position is defaulted to the exit location, such as... Figure 3 As shown, this is the center of the gray rectangle below the running container.
[0067] Initialize all the ball icons within the container, setting their initial positions (similar to the stopping position described above). For subsequent frame updates, simply replace the icons and update their positions. For two-color ball lotteries, each ball can be labeled with a number, and after the animation finishes, the target ball will move to the exit. For gashapon machines where the outcome is unknown, only the ball's color can be displayed; the label will be shown after the ball reaches the exit. Both types of lotteries control a target ball to move to the container exit after a certain period.
[0068] Because a reward pool (a collection of reward elements) is pre-set, a reward list E[1,2,4,6,7,8,11,23,45,88] can be configured, containing 10 rewards. This allows the generation of 10 balls within the container, each corresponding to a reward, with the corresponding reward identifier displayed on the ball. This results in a corresponding object list F, where the object list indicates the arrangement order of multiple balls (i.e., moving objects).
[0069] 2. Pre-calculation before the animation starts: calculate the target position of each ball's next straight-line movement, and set the animation running time and animation running status.
[0070] In-game lotteries, to avoid network lag and other issues, the client typically requests a lottery, the server calculates the result based on probability settings, and sends the result protocol to the client. The client then simulates the animation process based on the lottery result. After obtaining the target lottery result, the ball number corresponding to the reward of the target lottery result is found in the ball list F. Then, based on the specified position's arrangement in the position list, the target arrangement position of the target moving object is determined. For example, if the specified position is the first position in the position list, the target moving object also needs to be arranged in the first position in the object list. Then, the object list and reward list can be updated. Specifically, the winning reward and the winning ball can be moved from lists E and F respectively to the same arrangement position in their respective lists as the specified position used to display the target event result, thus obtaining updated lists E2 and F2. The arrangement position of the target moving object in the updated object list is the target arrangement position, and the arrangement position of the reward element in the updated reward list is consistent with the arrangement position of the corresponding moving object in the updated object list. This method can achieve a one-to-one correspondence with the end and stop position list D.
[0071] It is also necessary to generate the next collision position (equivalent to the "target motion position" mentioned above) and the actual angle of deviation from the center for each ball. For example... Figure 3As shown, the container holds a spherical object. Since the game simulation is a 2D animation, the ball can be considered a circle with point O as the center, radius R, and angle BOC as the included angle α. Ignoring collisions between balls, the ball will bounce when it hits the circular container wall during its straight-line motion. The initial position of each ball is known. Before the animation starts, the included angle α is randomly set, and the coordinates C of the next landing point on the circular container need to be calculated. The OB line segment is located on the X-axis, and O is the origin. Simultaneously, if the current included angle α1 = 90 degrees and the position is C1, the next target position for the straight-line motion, with an included angle α2, will be C2. If the included angles α1 and α2 are close, it will cause the positions C1 and C2 to be too close, resulting in the ball vibrating nearby without making a large-scale movement. Figure 4 As shown. Therefore, the condition (a1-a2) is added, and the absolute value of the remainder of 360 degrees must be greater than the angle b, which is assumed to be b=30 degrees.
[0072] The specific calculation process is as follows: (1) Input the previous angle a1 (where a1 is -90 degrees the first time, i.e. the negative half of the Y-axis, to avoid running to the exit on the first time), randomly generate an angle a2, the absolute value of (a1-a2) remainder 360 degrees must be greater than angle b=30 degrees. If a2 does not meet the requirements, then generate a2 in a loop.
[0073] (2) After obtaining angle a2, first convert it to radians, a3 = a2 math.pi / 180, where math.pi is pi; therefore, the x-coordinate of the corresponding point C2 is x2 = radius. math.cos(a3); Y-coordinate is y2 = radius math.cos(a3), the target position C2 is set to (x2, y2); (a2, x2, y2) is stored as data for the next movement of the ball, and used as data for each frame update.
[0074] After calculating the next target position for all balls, change the animation state from ANIMATION_STATE_NONE to ANIMATION_STATE_SHAKING, and set the animation state duration of the entire ANIMATION_STATE_SHAKING to timer_count=3 seconds.
[0075] 3. The animation is processed frame by frame in the game, updating the position of each ball, and determining whether to generate a new target position or change the animation state.
[0076] The operation steps when the game is updated per frame are as follows, and the time difference dt between the current frame and the previous frame is passed in. Among them, the following operation process is performed for each ball item.
[0077] When the animation state is ANIMATION_STATE_NONE, it means the animation has stopped, and all steps are directly skipped.
[0078] Subtract dt from the timing variable timer_count, that is, timer_count = timer_count - dt. When timer_count <= 0, set timer_count = 0, and set the animation state to ANIMATION_STATE_SHOW_RESULT.
[0079] The following operations are performed on each ball item: The displacement mov_dist of each ball in the current frame compared to the previous frame = run_speed dt; run_speed = 1000 # The moving speed of the small ball; The current position C1 (x1, y1) and the target position C2 (x2, y2) of each ball; # Calculate the Euclidean distance dist2 = math.sqrt((x2 - x1) 2 + (y2 - y1) 2) Perform the position judgment of the small ball: d_val_range = 5 # It is considered that the positions of the two are close within the error range If dist2 < d_val_range or dist2 <= mov_dist, it means that C1 and C2 are very close If dist2 < d_val_range or dist2 <= mov_dist is satisfied and the animation state play_animation_state is ANIMATION_STATE_SHAKING, then use the method of generating the next collision position of each ball and the actual deviation angle from the center of the circle above to generate the next target position C3 on the circle, and the new random angle is a4. The ball item continues to move towards C3.
[0080] If dist2 < d_val_range or dist2 <= mov_dist is satisfied and the animation state play_animation_state is ANIMATION_STATE_SHOW_RESULT, if the stored angle a2 is None, skip. If the angle a2 is not None, then retrieve the corresponding preset stop position C4 from the list D, and the ball item continues to move towards C4. Among them, if the ball item corresponds to the winning number, take the first position in the list D and will run to the container exit. Set the angle a2 to None.
[0081] If the condition dist2 < d_val_range or dist2 <= mov_dist is not satisfied, the following calculations are performed: rate = mov_dist 1.0 / dist2 x3 = (x2 - x1) rate + x1 y3 = (y2 - y1) rate + y1 Among them, (x2 - x1) can represent the component of the movement direction of the small ball in the x-axis direction, and (y2 - y1) represents the component of the movement direction of the small ball in the y-axis direction. Set the position of the ball to (x3, y3) and continue to move towards C2.
[0082] If the angles a2 of all the balls are None, it means that the animation has completely stopped moving. At this time, pop up another UI to prompt the detailed information of winning the prize.
[0083] This method calculates the movement position of the moving object in real time and can freely control the landing point when the moving object stops. It does not depend on sequence frames and does not need to store a large number of pictures. By controlling multiple two-dimensional spherical pictures to move in a straight line and randomly change the direction to continue moving after hitting the container wall. Since the position of each ball is generated per frame, it can be controlled in real time according to the set movement direction and speed, which can improve the randomness and activity range of the gacha bouncing in the two-dimensional container. At the same time, the method proposed in this article can flexibly control the position where each gacha stops moving, that is, it can control which ball appears at the container exit after multiple balls move randomly.
[0084] For the above method embodiments, see Figure 5 An animation generation device shown, which provides a graphical user interface through a terminal device; the graphical user interface displays multiple moving objects; the device includes: A stop position determination module 502, configured to respond to a preset trigger event and determine the preset stop positions corresponding to the multiple moving objects according to the target event result; The random parameter generation module 504 is used to generate random motion parameters for each moving object. The random motion parameters include the direction of motion and the target motion position. The display position determination module 506 is used to determine the display position of multiple moving objects in each animation frame in real time based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters. The animation frame display module 508 is used to display each animation frame in the graphical user interface based on the display positions of multiple moving objects in each animation frame, thus forming an animation. The random parameter generation module is also used to: for each moving object, if the moving object is in a first motion state, determine the display position of the moving object in the next frame based on the display position of the moving object in the current frame and random motion parameters; if the moving object is in a second motion state, determine its corresponding preset stop position as the display position of the moving object in the next frame.
[0085] The display position determination module is also used to: for each moving object, if the moving object is in a first motion state, determine the display position of the moving object in the next frame based on the display position of the moving object in the current frame and random motion parameters; if the moving object is in a second motion state, determine its corresponding preset stop position as the display position of the moving object in the next frame.
[0086] The aforementioned animation generation device, in response to a preset trigger event, determines preset stop positions corresponding to multiple moving objects based on the result of a target event; generates random motion parameters for each moving object, including motion direction and target motion position; determines the display positions of the multiple moving objects in each animation frame in real time based on the initial display positions of the multiple moving objects in the graphical user interface and the random motion parameters; and displays each animation frame in the graphical user interface based on the display positions of the multiple moving objects in each animation frame, thus forming an animation. Specifically, determining the display positions of the multiple moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determining its corresponding preset stop position as the display position of the moving object in the next frame. This method calculates the display positions of each moving object in each animation frame in real time based on random motion parameters, forming an animation of multiple moving objects moving randomly in the graphical user interface, improving the smoothness and visual effect of the animation, enhancing the user's visual experience, and to some extent improving user retention.
[0087] The aforementioned graphical user interface includes a target area; multiple moving objects move within the target area; the random parameter generation module is also used to: for each moving object, randomly determine the target movement position of the moving object from the edge position of the target area; and determine the movement direction of the moving object based on the initial display position of the moving object in the graphical user interface and the target movement position.
[0088] The target area mentioned above is a circular area; the random parameter generation module is also used to: randomly determine the target central angle corresponding to the moving object; based on the preset reference direction and the target central angle, determine the target movement position of the moving object from the edge position of the target area; the angle between the direction from the center position of the target area to the target movement position and the reference direction is equal to the target central angle.
[0089] The aforementioned display position determination module is further configured to: determine the preset playback duration corresponding to the animation as the remaining playback duration of the animation; determine the display position of multiple moving objects in the next frame based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters; determine the next frame as the current frame; after the next frame is displayed in the graphical user interface, update the remaining playback duration of the animation based on the preset time interval between adjacent animation frames, and determine the target motion state corresponding to multiple moving objects based on the updated remaining playback duration; if multiple moving objects are in the first motion state, for each moving object, determine the display position of the moving object in the next frame based on the display position of the moving object in the current frame and random motion parameters; continue to execute the step of determining the next frame as the current frame until multiple moving objects are in the second motion state; for each moving object, determine the preset stop position corresponding to the moving object as the display position of the moving object in the next frame.
[0090] The aforementioned display position determination module is also used to: calculate the target distance between the initial display position and the target movement position of each moving object; determine the movement distance of the moving object based on the moving speed and the preset time interval; and if the movement distance is less than or equal to the target distance, determine the display position of the moving object in the next frame based on the initial display position, movement direction, and movement distance of the moving object.
[0091] The aforementioned device further includes: a first random motion parameter update module, used to update the random motion parameters of the moving object if the moving distance is greater than the target distance.
[0092] The aforementioned graphical user interface includes a target area; multiple moving objects move within the target area; the target area includes a circular area; the target movement position is determined based on a randomly determined central angle; the aforementioned device further includes: a first judgment module, used to judge whether the updated target movement position and the original target movement position meet preset conditions; the preset conditions include: the angle between the direction from the center position of the target area to the original target movement position and the direction from the center position of the target area to the updated target movement position is greater than or equal to a preset angle threshold; a second random motion parameter update module, used to update the random motion parameters again if the conditions are not met, until the updated target movement position and the original target movement position meet the preset conditions.
[0093] The aforementioned display position determination module is also used to: determine the updated remaining playback duration by subtracting the preset time interval from the remaining playback duration of the animation; if the updated remaining playback duration is greater than 0, determine the target motion state corresponding to multiple moving objects as the first motion state; if the updated remaining playback duration is less than or equal to 0, determine the target motion state corresponding to multiple moving objects as the second motion state.
[0094] The aforementioned stop position determination module is also used to: obtain multiple preset candidate stop positions; use a specified position among the multiple candidate stop positions to display the moving object corresponding to the target event result; and determine the preset stop position of the target moving object corresponding to the target event result as the specified position among the multiple candidate stop positions.
[0095] The above-mentioned preset triggering event is a lottery event; each moving object has a corresponding reward element; the target event result is the target lottery result; the target lottery result indicates the target reward element of the reward elements corresponding to multiple moving objects.
[0096] The aforementioned multiple moving objects have a preset object list; the object list is used to indicate the arrangement order of the multiple moving objects; multiple candidate stopping positions form a position list; the aforementioned stopping position determination module is also used to: determine the target arrangement position of the target moving object based on the arrangement position of the specified position in the position list; update the object list so that the arrangement position of the target moving object in the updated object list is the target arrangement position; and determine the preset stopping position corresponding to each moving object based on the position list and the object list.
[0097] The reward elements corresponding to the above multiple moving objects form a reward list; the arrangement of the reward elements in the reward list is consistent with the arrangement of the corresponding moving objects in the object list; the above-mentioned stop position determination module is also used to: update the object list and the reward list so that the arrangement of the reward elements in the updated reward list is consistent with the arrangement of the corresponding moving objects in the updated object list.
[0098] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described animation generation method, for example: In response to a preset trigger event, the system determines preset stop positions for multiple moving objects based on the result of the target event; generates random motion parameters for each moving object, including motion direction and target motion position; determines the display positions of multiple moving objects in each animation frame in real time based on the initial display positions of multiple moving objects in the graphical user interface and the random motion parameters; and displays each animation frame in the graphical user interface based on the display positions of multiple moving objects in each animation frame to form an animation. Specifically, determining the display positions of multiple moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determining its corresponding preset stop position as the display position of the moving object in the next frame.
[0099] The above method calculates the display position of each moving object in each animation frame in real time based on random motion parameters, forming an animation of multiple moving objects moving randomly in the graphical user interface, which improves the smoothness and visual effect of the animation, enhances the user's visual experience, and improves the user retention rate to a certain extent.
[0100] Optionally, the graphical user interface includes a target area; multiple moving objects move within the target area; the step of generating random motion parameters for each moving object includes: for each moving object, randomly determining the target motion position of the moving object from the edge position of the target area; and determining the motion direction of the moving object based on the initial display position of the moving object in the graphical user interface and the target motion position.
[0101] Optionally, the target area is a circular area; the step of randomly determining the target motion position of the moving object from the edge position of the target area includes: randomly determining the target central angle corresponding to the moving object; determining the target motion position of the moving object from the edge position of the target area based on a preset reference direction and the target central angle; the angle between the direction from the center position of the target area to the target motion position and the reference direction is equal to the target central angle.
[0102] Optionally, the above-mentioned step of determining the display positions of multiple moving objects in each animation frame in real time based on the initial display positions of multiple moving objects in the graphical user interface and random motion parameters includes: determining the preset playback duration corresponding to the animation as the remaining playback duration of the animation; determining the display positions of multiple moving objects in the next frame based on the initial display positions of multiple moving objects in the graphical user interface and random motion parameters; determining the next frame as the current frame; after the next frame is displayed in the graphical user interface, updating the remaining playback duration of the animation based on the preset time interval between adjacent animation frames, and determining the target motion state corresponding to multiple moving objects based on the updated remaining playback duration; if multiple moving objects are in the first motion state, for each moving object, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and random motion parameters; continuing to execute the step of determining the next frame as the current frame until multiple moving objects are in the second motion state; for each moving object, determining the preset stop position corresponding to the moving object as the display position of the moving object in the next frame.
[0103] Optionally, the step of determining the display position of multiple moving objects in the next frame based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters includes: for each moving object, calculating the target distance between the initial display position of the moving object and the target motion position; determining the moving distance of the moving object based on the moving speed of the moving object and a preset time interval; if the moving distance is less than or equal to the target distance, determining the display position of the moving object in the next frame based on the initial display position, motion direction and moving distance of the moving object.
[0104] Optionally, the above method also includes: if the moving distance is greater than the target distance, updating the random motion parameters of the moving object.
[0105] Optionally, the graphical user interface includes a target area; multiple moving objects move within the target area; the target area includes a circular area; the target movement position is determined based on a randomly determined central angle; the method further includes: determining whether the updated target movement position and the original target movement position meet preset conditions; the preset conditions include: the angle between the direction from the center position of the target area to the original target movement position and the direction from the center position of the target area to the updated target movement position is greater than or equal to a preset angle threshold; if not, the random motion parameters are updated again until the updated target movement position and the original target movement position meet the preset conditions.
[0106] Optionally, the steps of updating the remaining playback duration of the animation based on the preset time interval between adjacent animation frames and determining the target motion state corresponding to multiple moving objects based on the updated remaining playback duration include: subtracting the preset time interval from the remaining playback duration of the animation to determine the updated remaining playback duration; if the updated remaining playback duration is greater than 0, determining the target motion state corresponding to the multiple moving objects as the first motion state; if the updated remaining playback duration is less than or equal to 0, determining the target motion state corresponding to the multiple moving objects as the second motion state.
[0107] Optionally, the steps described above for determining the preset stopping positions corresponding to multiple moving objects based on the target event result include: obtaining multiple preset candidate stopping positions; using a specified position among the multiple candidate stopping positions to display the moving object corresponding to the target event result; and determining the preset stopping position of the target moving object corresponding to the target event result as the specified position among the multiple candidate stopping positions.
[0108] Optionally, the above-mentioned preset triggering event is a lottery event; each moving object has a corresponding reward element; the target event result is the target lottery result; the target lottery result indicates the target reward element of the reward elements corresponding to multiple moving objects.
[0109] Optionally, the aforementioned multiple moving objects have a preset object list; the object list is used to indicate the arrangement order of the multiple moving objects; multiple candidate stopping positions form a position list; the step of determining the preset stopping position of the target moving object corresponding to the target event result as a specified position among the multiple candidate stopping positions includes: determining the target moving object among the multiple moving objects based on the target event result; determining the target arrangement position of the target moving object based on the arrangement position of the specified position in the position list; updating the object list so that the arrangement position of the target moving object in the updated object list is the target arrangement position; and determining the preset stopping position corresponding to each moving object based on the position list and the object list.
[0110] Optionally, the reward elements corresponding to the above multiple motion objects form a reward list; the arrangement of the reward elements in the reward list is consistent with the arrangement of the corresponding motion objects in the object list; the step of updating the object list includes: updating the object list and the reward list so that the arrangement of the reward elements in the updated reward list is consistent with the arrangement of the corresponding motion objects in the updated object list.
[0111] See Figure 6 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described animation generation method.
[0112] Furthermore, Figure 6 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0113] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0114] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. The processor 100 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams of the invention in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The method invented in conjunction with the embodiments of this invention can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and processor 100 reads information from memory 101 and, in conjunction with its hardware, completes the method of the aforementioned embodiments.
[0115] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described animation generation method.
[0116] The present invention provides an animation generation method, apparatus, and electronic device, including a computer-readable storage medium storing program code. The program code includes instructions that can be used to execute the methods described in the preceding method embodiments, for example: In response to a preset trigger event, the system determines preset stop positions for multiple moving objects based on the result of the target event; generates random motion parameters for each moving object, including motion direction and target motion position; determines the display positions of multiple moving objects in each animation frame in real time based on the initial display positions of multiple moving objects in the graphical user interface and the random motion parameters; and displays each animation frame in the graphical user interface based on the display positions of multiple moving objects in each animation frame to form an animation. Specifically, determining the display positions of multiple moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; if the moving object is in a second motion state, determining its corresponding preset stop position as the display position of the moving object in the next frame.
[0117] The above method calculates the display position of each moving object in each animation frame in real time based on random motion parameters, forming an animation of multiple moving objects moving randomly in the graphical user interface, which improves the smoothness and visual effect of the animation, enhances the user's visual experience, and improves the user retention rate to a certain extent.
[0118] Optionally, the graphical user interface includes a target area; multiple moving objects move within the target area; the step of generating random motion parameters for each moving object includes: for each moving object, randomly determining the target motion position of the moving object from the edge position of the target area; and determining the motion direction of the moving object based on the initial display position of the moving object in the graphical user interface and the target motion position.
[0119] Optionally, the target area is a circular area; the step of randomly determining the target motion position of the moving object from the edge position of the target area includes: randomly determining the target central angle corresponding to the moving object; determining the target motion position of the moving object from the edge position of the target area based on a preset reference direction and the target central angle; the angle between the direction from the center position of the target area to the target motion position and the reference direction is equal to the target central angle.
[0120] Optionally, the above-mentioned step of determining the display positions of multiple moving objects in each animation frame in real time based on the initial display positions of multiple moving objects in the graphical user interface and random motion parameters includes: determining the preset playback duration corresponding to the animation as the remaining playback duration of the animation; determining the display positions of multiple moving objects in the next frame based on the initial display positions of multiple moving objects in the graphical user interface and random motion parameters; determining the next frame as the current frame; after the next frame is displayed in the graphical user interface, updating the remaining playback duration of the animation based on the preset time interval between adjacent animation frames, and determining the target motion state corresponding to multiple moving objects based on the updated remaining playback duration; if multiple moving objects are in the first motion state, for each moving object, determining the display position of the moving object in the next frame based on the display position of the moving object in the current frame and random motion parameters; continuing to execute the step of determining the next frame as the current frame until multiple moving objects are in the second motion state; for each moving object, determining the preset stop position corresponding to the moving object as the display position of the moving object in the next frame.
[0121] Optionally, the step of determining the display position of multiple moving objects in the next frame based on the initial display position of multiple moving objects in the graphical user interface and random motion parameters includes: for each moving object, calculating the target distance between the initial display position of the moving object and the target motion position; determining the moving distance of the moving object based on the moving speed of the moving object and a preset time interval; if the moving distance is less than or equal to the target distance, determining the display position of the moving object in the next frame based on the initial display position, motion direction and moving distance of the moving object.
[0122] Optionally, the above method also includes: if the moving distance is greater than the target distance, updating the random motion parameters of the moving object.
[0123] Optionally, the graphical user interface includes a target area; multiple moving objects move within the target area; the target area includes a circular area; the target movement position is determined based on a randomly determined central angle; the method further includes: determining whether the updated target movement position and the original target movement position meet preset conditions; the preset conditions include: the angle between the direction from the center position of the target area to the original target movement position and the direction from the center position of the target area to the updated target movement position is greater than or equal to a preset angle threshold; if not, the random motion parameters are updated again until the updated target movement position and the original target movement position meet the preset conditions.
[0124] Optionally, the steps of updating the remaining playback duration of the animation based on the preset time interval between adjacent animation frames and determining the target motion state corresponding to multiple moving objects based on the updated remaining playback duration include: subtracting the preset time interval from the remaining playback duration of the animation to determine the updated remaining playback duration; if the updated remaining playback duration is greater than 0, determining the target motion state corresponding to the multiple moving objects as the first motion state; if the updated remaining playback duration is less than or equal to 0, determining the target motion state corresponding to the multiple moving objects as the second motion state.
[0125] Optionally, the steps described above for determining the preset stopping positions corresponding to multiple moving objects based on the target event result include: obtaining multiple preset candidate stopping positions; using a specified position among the multiple candidate stopping positions to display the moving object corresponding to the target event result; and determining the preset stopping position of the target moving object corresponding to the target event result as the specified position among the multiple candidate stopping positions.
[0126] Optionally, the above-mentioned preset triggering event is a lottery event; each moving object has a corresponding reward element; the target event result is the target lottery result; the target lottery result indicates the target reward element of the reward elements corresponding to multiple moving objects.
[0127] Optionally, the aforementioned multiple moving objects have a preset object list; the object list is used to indicate the arrangement order of the multiple moving objects; multiple candidate stopping positions form a position list; the step of determining the preset stopping position of the target moving object corresponding to the target event result as a specified position among the multiple candidate stopping positions includes: determining the target moving object among the multiple moving objects based on the target event result; determining the target arrangement position of the target moving object based on the arrangement position of the specified position in the position list; updating the object list so that the arrangement position of the target moving object in the updated object list is the target arrangement position; and determining the preset stopping position corresponding to each moving object based on the position list and the object list.
[0128] Optionally, the reward elements corresponding to the above multiple motion objects form a reward list; the arrangement of the reward elements in the reward list is consistent with the arrangement of the corresponding motion objects in the object list; the step of updating the object list includes: updating the object list and the reward list so that the arrangement of the reward elements in the updated reward list is consistent with the arrangement of the corresponding motion objects in the updated object list.
[0129] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0130] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0131] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0132] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0133] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An animation generation method, characterized in that, A graphical user interface is provided through the terminal device; The graphical user interface displays multiple moving objects; the method includes: In response to a preset trigger event, the preset stop positions corresponding to the multiple moving objects are determined based on the result of the target event. For each moving object, random motion parameters are generated, including the direction of motion and the target position. The display positions of the multiple moving objects in each animation frame are determined in real time based on the initial display positions of the multiple moving objects in the graphical user interface and the random motion parameters. Based on the display positions of the multiple moving objects in each animation frame, the animation frames are displayed in the graphical user interface to form the animation; The determination of the display position of the plurality of moving objects in each animation frame includes: for each moving object, if the moving object is in a first motion state, then the display position of the moving object in the next frame is determined based on the display position of the moving object in the current frame and the random motion parameters; If the moving object is in the second motion state, its corresponding preset stop position is determined as the display position of the moving object in the next frame.
2. The method according to claim 1, characterized in that, The graphical user interface includes a target area; the plurality of moving objects move within the target area; The step of generating random motion parameters for each of the moving objects includes: For each moving object, the target movement position of the moving object is randomly determined from the edge position of the target region; The direction of motion of the moving object is determined based on the initial display position of the moving object in the graphical user interface and the target motion position.
3. The method according to claim 2, characterized in that, The target area is a circular area; The step of randomly determining the target motion position of the moving object from the edge position of the target region includes: The target central angle corresponding to the moving object is randomly determined; Based on the preset reference direction and the target central angle, the target movement position of the moving object is determined from the edge position of the target area; the angle between the direction from the center position of the target area to the target movement position and the reference direction is equal to the target central angle.
4. The method according to claim 1, characterized in that, The step of determining the display positions of the multiple moving objects in each animation frame in real time based on their initial display positions in the graphical user interface and the random motion parameters includes: The preset playback duration corresponding to the animation is determined as the remaining playback duration of the animation; The display position of the multiple moving objects in the next frame is determined based on the initial display position of the multiple moving objects in the graphical user interface and the random motion parameters; The next frame is determined as the current frame; After the next frame is displayed in the graphical user interface, the remaining playback duration of the animation is updated based on the preset time interval between adjacent animation frames, and the target motion state corresponding to the multiple moving objects is determined based on the updated remaining playback duration. If the plurality of moving objects are in the first motion state, for each moving object, the display position of the moving object in the next frame is determined based on the display position of the moving object in the current frame and the random motion parameters; Continue executing the step of determining the next frame as the current frame until the plurality of moving objects are in the second motion state. For each moving object, determine the preset stop position corresponding to the moving object as the display position of the moving object in the next frame.
5. The method according to claim 4, characterized in that, The step of determining the display position of the plurality of moving objects in the next frame based on the initial display position of the plurality of moving objects in the graphical user interface and the random motion parameters includes: For each of the moving objects, calculate the target distance between the initial display position of the moving object and the target movement position; The distance the moving object travels is determined based on the moving speed of the moving object and the preset time interval; If the moving distance is less than or equal to the target distance, the display position of the moving object in the next frame is determined based on the initial display position of the moving object, the direction of movement, and the moving distance.
6. The method according to claim 5, characterized in that, The method further includes: If the moving distance is greater than the target distance, update the random motion parameters of the moving object; Based on the updated random motion parameters and the display position of the moving object in the current frame, the display position of the moving object in the next frame is determined.
7. The method according to claim 6, characterized in that, The graphical user interface includes a target area; the plurality of moving objects move within the target area; the target area includes a circular area; the target movement position is determined based on a randomly determined central angle; The method further includes: Determine whether the updated target motion position and the original target motion position meet preset conditions; the preset conditions include: the angle between the direction from the center position of the target area to the original target motion position and the direction from the center position of the target area to the updated target motion position is greater than or equal to a preset angle threshold; If the conditions are not met, the random motion parameters are updated again until the updated target motion position and the original target motion position satisfy the preset conditions.
8. The method according to claim 4, characterized in that, The step of updating the remaining playback duration of the animation based on a preset time interval between adjacent animation frames, and determining the target motion state corresponding to the multiple moving objects based on the updated remaining playback duration, includes: The remaining playback duration of the animation is subtracted from the preset time interval to determine the updated remaining playback duration; If the updated remaining playback time is greater than 0, the target motion state corresponding to the plurality of motion objects is determined as the first motion state; If the remaining playback time after the update is less than or equal to 0, the target motion state corresponding to the multiple motion objects is determined as the second motion state.
9. The method according to claim 1, characterized in that, The step of determining the preset stop positions corresponding to the multiple moving objects based on the target event results includes: Obtain multiple preset candidate stopping positions; a designated position among the multiple candidate stopping positions is used to display the moving object corresponding to the target event result; The preset stopping position of the target moving object corresponding to the result of the target event is determined as the specified position among the multiple candidate stopping positions.
10. The method according to claim 1, characterized in that, The preset trigger event is a lottery event; each of the moving objects has a corresponding reward element; the target event result is the target lottery result; the target lottery result indicates the target reward element of the reward elements corresponding to the multiple moving objects.
11. The method according to claim 9, characterized in that, The plurality of moving objects have a preset object list; the object list is used to indicate the arrangement order of the plurality of moving objects; the plurality of candidate stopping positions form a position list; The step of determining the preset stopping position of the target moving object corresponding to the target event result as the specified position among the multiple candidate stopping positions includes: Based on the result of the target event, the target moving object among the plurality of moving objects is determined; Based on the arrangement position of the specified position in the position list, determine the target arrangement position of the target moving object; Update the object list so that the arrangement position of the target moving objects in the updated object list is the target arrangement position; Based on the location list and the object list, a preset stop position is determined for each of the moving objects.
12. The method according to claim 11, characterized in that, The reward elements corresponding to the multiple moving objects form a reward list; the arrangement of the reward elements in the reward list is consistent with the arrangement of the corresponding moving objects in the object list; The step of updating the list of objects includes: Update the object list and the reward list so that the arrangement of reward elements in the updated reward list matches the arrangement of the corresponding motion objects in the updated object list.
13. An animation generation device, characterized in that, A graphical user interface is provided through the terminal device; The graphical user interface displays multiple moving objects; the device includes: The stop position determination module is used to determine the preset stop positions corresponding to the multiple moving objects respectively in response to a preset trigger event and based on the result of the target event. A random parameter generation module is used to generate random motion parameters for each moving object, the random motion parameters including the direction of motion and the target motion position; The display position determination module is used to determine the display position of the multiple moving objects in each animation frame in real time based on the initial display position of the multiple moving objects in the graphical user interface and the random motion parameters; An animation frame display module is used to display each animation frame in the graphical user interface based on the display position of the plurality of moving objects in each animation frame, thereby forming the animation; The random parameter generation module is further configured to: for each moving object, if the moving object is in a first motion state, determine the display position of the moving object in the next frame based on the display position of the moving object in the current frame and the random motion parameters; If the moving object is in the second motion state, its corresponding preset stop position is determined as the display position of the moving object in the next frame.
14. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the animation generation method according to any one of claims 1-12.
15. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the animation generation method according to any one of claims 1-12.