Animation playing method and device, storage medium, and electronic device
Controlling the playback of animation clips through the state transfer table solves the problem of high program complexity caused by the large number and complex relationships of animation clips in the prior art, and realizes the recovery function and complexity reduction of animation playback.
Patent Information
- Application Number
- CN202011579768.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-12-28
AI Technical Summary
Existing mobile animation playback solutions lead to high program complexity when the number of animation clips is large and the relationships are complex. A large number of flags and judgment conditions need to be set, and animation playback does not have a recovery function.
The state transfer table is used to control the playback of animation clips. The animation clips to be played and the playback conditions are obtained through the preset state transfer table. The playback and state transition of the animation clips are performed in response to the playback conditions and state transfer conditions, which reduces the program complexity and realizes Resume function for animation playback.
It reduces the settings of flag bits and judgment conditions, reduces the complexity of the animation playback program, solves the problem that animation playback does not have a recovery function, and improves the efficiency and maintainability of animation playback.
Smart Images

Figure CN112700515B
Abstract
Description
Background Art
[0002] In mobile applications, most animations are composed of a series of animation clips, which can be connected by time delays, movement of interface elements, or response to events.
[0003] In the existing animation playback scheme on mobile terminals, animation is mainly played by presetting animation sequence and adding flags. The presetting animation sequence is to combine various animation clips through "simultaneous playback" or "sequential playback" to form a total animation sequence set, which is triggered by external calls; the flag is used to record whether a certain animation clip has been played.
[0004] The following problems may occur when using a preset animation sequence and a playback solution with flags: when the number of animation clips is large and the relationships between the animation clips are complex, a large number of flags and judgment conditions will be set in the program, resulting in high program complexity.
[0005] Therefore, it is necessary to provide a new animation playing method.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0007] The purpose of the present invention is to provide an animation playback method, an animation playback device, a storage medium and an electronic device, thereby overcoming, at least to a certain extent, the problem of high program complexity in the animation playback solution of the mobile terminal caused by the limitations and defects of the related technology.
[0008] According to one aspect of the present disclosure, there is provided an animation playing method for controlling the playing of multiple animation clips, comprising:
[0009] Acquire a first playback state, and determine, according to a preset state transition table, a first animation clip to be played corresponding to the first playback state, a playback condition, and / or a state transition condition for converting the first playback state to a next playback state;
[0010] In response to the playing condition being satisfied, playing a first to-be-played animation clip corresponding to the playing condition;
[0011] In response to the state transition condition being met, the first play state is converted to the next play state, and the play of the multiple animation clips is controlled based on the next play state.
[0012] In an exemplary embodiment of the present disclosure, the state transfer condition includes at least one of a user control event, an animation clip playback completion event, or an animation clip playback interruption event.
[0013] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0014] When the animation clip playback interruption event occurs, based on a preset state transition table, the playback state corresponding to the animation clip being played is obtained, and the playback state corresponding to the animation clip being played is saved;
[0015] When the animation clip playback interruption event ends, the saved playback state is obtained, and based on a preset state transition table, a playback condition corresponding to the saved playback state and / or a state transition condition for converting the playback state corresponding to the animation clip being played to a next playback state is determined.
[0016] In an exemplary embodiment of the present disclosure, the preset state transition table records multiple play states, animation clips to be played corresponding to each play state, play conditions, and state transition relationships and state transition conditions between different play states.
[0017] In an exemplary embodiment of the present disclosure, in response to the playing condition being satisfied, playing a first animation clip to be played corresponding to the playing condition, includes:
[0018] When the playing condition is unconditional playing, the first to-be-played animation clip corresponding to the playing condition is directly played.
[0019] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0020] When the playing condition is a triggering condition playing, obtaining a second playing state;
[0021] Determine whether the second play state is the same as the first play state.
[0022] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0023] When the second playback state is different from the first playback state, determining a playback condition and / or a state transition condition corresponding to the second playback state based on the preset state transition table;
[0024] Based on the playback condition and / or state transition condition corresponding to the second playback state, the second animation clip to be played corresponding to the second playback state is played by the animation playback method corresponding to the second playback state.
[0025] In an exemplary embodiment of the present disclosure, in response to the state transition condition being satisfied, converting the first play state to the next play state includes:
[0026] Acquire a state transition condition corresponding to the first playback state;
[0027] Based on the state transition condition, a next play state corresponding to the first play state is determined by a state transition method corresponding to the first play state, and the first play state is converted to the next play state.
[0028] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0029] Determine whether the playing condition of the first animation clip to be played corresponding to the first playing state and the state transition condition for converting the first playing state to the next playing state are empty;
[0030] When the playing condition of the first animation clip to be played and the state transition condition for converting the first playing state to the next playing state are empty, the first playing state is set to the end state.
[0031] According to one aspect of the present disclosure, there is provided an animation playback device for controlling the playback of multiple animation clips, comprising:
[0032] A playback condition determination module, used to obtain a first playback state, and determine a first animation clip to be played corresponding to the first playback state and its playback condition and / or a state transition condition for converting the first playback state to a next playback state according to a preset state transition table;
[0033] A to-be-played animation clip playing module, configured to play a first to-be-played animation clip corresponding to the playing condition in response to the playing condition being satisfied;
[0034] The play state conversion module is used to convert the first play state to the next play state in response to the satisfaction of the state transfer condition, and control the play of the multiple animation clips based on the next play state.
[0035] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the animation playing method described in any one of the above is implemented.
[0036] According to one aspect of the present disclosure, there is provided an electronic device, including:
[0037] Processor; and
[0038] A memory, configured to store executable instructions of the processor;
[0039] Wherein, the processor is configured to execute any one of the above-mentioned animation playing methods by executing the executable instructions.
[0040] An animation playing method provided by an embodiment of the present disclosure obtains a first playing state, determines a first animation clip to be played corresponding to the first playing state and its playing condition and / or a state transfer condition for converting the first playing state to a next playing state according to a preset state transfer table; plays the first animation clip to be played corresponding to the playing condition in response to the playing condition being satisfied; converts the first playing state to the next playing state in response to the state transfer condition being satisfied, and controls the playing of the plurality of animation clips based on the next playing state. After obtaining the first playing state, it is only necessary to determine the first clip to be played corresponding to the first playing state and the playing condition for playing the first clip to be played and / or the state transfer condition for converting the first playing state to the next playing state based on a preset state transfer table. When the playing condition or the state transfer condition is satisfied, the animation clip is played or the state transfer is performed. The playing of the animation clip or the transfer of the playing state can be realized without setting a large number of flags and judgment statements, thereby solving the problem of needing to set a large number of flags and judgment conditions in the prior art and reducing the complexity of the animation playing program.
[0041] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0043] Figure 1 A cartoon clip playing sequence according to an exemplary embodiment of the present invention is schematically shown.
[0044] Figure 2 The following schematically shows a flow chart of an animation playing method according to an exemplary embodiment of the present invention.
[0045] Figure 3 A block diagram of an animation playing system according to an exemplary embodiment of the present invention is schematically shown.
[0046] Figure 4A schematic diagram schematically shows a state transition table according to an exemplary embodiment of the present invention.
[0047] Figure 5 The diagram schematically shows the relationship between a play state and an animation play executor according to an exemplary embodiment of the present invention.
[0048] Figure 6 A flowchart of a method for playing an animation when a playing condition is executed as a trigger condition according to an exemplary embodiment of the present invention is schematically shown.
[0049] Figure 7 A flowchart of an animation playing method when the state of an animation playing executor does not change according to an exemplary embodiment of the present invention is schematically shown.
[0050] Figure 8 The following schematically shows a flow chart of an animation playing method according to an exemplary embodiment of the present invention.
[0051] Fig. 9 A block diagram schematically shows an animation playing device according to an exemplary embodiment of the present invention.
[0052] Fig.10 An electronic device for implementing the above animation playing method according to an exemplary embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0053] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.
[0054] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0055] In today's mobile applications, the richer the animation effects, the greater the workload for designers and the more complex the code logic for developers. Because most animations are not a simple animation sequence, but a complete animation formed by a series of animation clips. Animation clips can be connected by time delay, movement of interface elements or response to events, and multiple animation clips can be played at the same time at a certain time. Therefore, an efficient, expandable and maintainable solution is needed for the playback of such complex animations.
[0056] In the existing animation playback solutions for mobile terminals, the animation to be played is mainly played by presetting the animation sequence and setting the flag. For some complex animations that are not simple permutations and combinations, trigger conditions are also required. Figure 1 In the animation clip playback sequence shown, animation A starts playing after event a occurs, and animation C can be played only after click event b occurs and animation B has been played. Otherwise, click event b will not trigger the animation playback. Therefore, during the playback of this type of animation, it is necessary to add a flag to record whether animation B has been played. When click event b occurs, the flag will be used to determine whether animation C needs to be played.
[0057] The solution of using a preset animation sequence plus flags to play animations will have the following problems: when the number of animation clips is large and the relationship between the animation clips becomes complicated, there will be a large number of flag variables and a large number of judgment statements in the program, the code logic is complex, and the program complexity is high, which increases the difficulty of fixing problems or adding new animations.
[0058] In addition, the correct playback of animation clips depends on the normal operation of the program, that is, if the animations in each time period are not intercepted and detected, and the determined animation playback code is fully executed, when the program encounters an interruption event, the animation execution chain may be interrupted, and when the playback is attempted again, the animation information to be played may be lost, and even the entire animation clip sequence may produce an exception. Figure 1In the animation clip playback sequence shown, if the application is interrupted when playing animation B, when the application resumes, the information that "animation A has been played" is lost, and only animation A can be played, and animation B cannot be played after the interruption. If animation B needs to be played, a flag needs to be added to determine whether animation A has been played. As the number of animations increases and the logic becomes more complicated, there are more and more judgment statements and flag variables in the program, and the maintainability is getting lower and lower.
[0059] Based on one or more of the above problems, this example implementation first provides an animation playback method, which can be run on a device terminal, which can include a PC terminal, a mobile terminal, etc. Of course, those skilled in the art can also run the method of the present invention on other platforms as required, and this example implementation does not specifically limit this. Figure 2 As shown, the animation playing method may include the following steps:
[0060] Step S210. Obtain a first playback state, and determine a first animation clip to be played corresponding to the first playback state, a playback condition, and / or a state transition condition for converting the first playback state to a next playback state according to a preset state transition table;
[0061] Step S220. In response to the playing condition being satisfied, playing the first animation clip to be played corresponding to the playing condition;
[0062] Step S230. In response to the state transition condition being satisfied, converting the first play state to the next play state, and controlling the play of the multiple animation clips based on the next play state.
[0063] The above-mentioned animation playing method obtains a first playing state, and determines a first to-be-played animation clip corresponding to the first playing state, a playing condition, and / or a state transition condition for converting the first playing state to a next playing state according to a preset state transition table; in response to the satisfaction of the playing condition, plays the first to-be-played animation clip corresponding to the playing condition; in response to the satisfaction of the state transition condition, converts the first playing state to the next playing state, and controls the playing of the multiple animation clips based on the next playing state. After obtaining the first playing state, it is only necessary to determine the first to-be-played clip corresponding to the first playing state, the playing condition for playing the first to-be-played clip, and / or the state transition condition for converting the first playing state to the next playing state based on the preset state transition table. When the playing condition or the state transition condition is satisfied, the animation clip is played or the state transition is performed. The playing of the animation clip or the transition of the playing state can be realized without setting a large number of flags and judgment statements, which solves the problem of needing to set a large number of flags and judgment conditions in the prior art and reduces the complexity of the animation playing program.
[0064] Hereinafter, each step involved in the animation playing method according to the exemplary embodiment of the present disclosure is explained and illustrated in detail.
[0065] First, the application scenarios and invention objectives of the exemplary embodiments of the present disclosure are explained and illustrated.
[0066] Specifically, the exemplary embodiments of the present disclosure can be used for animation playback of mobile application software, mainly for obtaining the first playback state of the current animation playback, and determining the first animation clip to be played corresponding to the first playback state, the playback condition for playing the first animation clip to be played, and / or the state transition condition for converting the current first playback state to the next playback state through a preset state transition table. There is no need to set a flag bit, which reduces the program complexity of the animation playback. When the playback condition for playing the first animation clip to be played is met, the first animation clip to be played is played, and when the state condition for converting the first playback state to the next playback state is met, the current first playback state is converted to the next playback state; in addition, when an animation playback interruption event occurs during the animation playback process, the playback state of the currently played animation clip is saved. When the animation playback interruption event ends, based on the saved playback state of the currently played animation clip, the playback condition and the state transition condition corresponding to the saved playback state of the currently played animation clip are determined through a preset state transition table. When its playback state or state transition condition is met, the currently played animation clip is played or the playback state is converted to the next playback state, which solves the problem in the prior art that the animation playback does not have a recovery function.
[0067] Next, the animation playback system involved in the exemplary embodiment of the present disclosure is explained and illustrated. Figure 3 As shown, the animation playback system may include a playback state saving module 310, an animation playback executor 320, and a mobile terminal 330. The playback state saving module 310 is used to obtain the current playback state of the current animation playback and save the current playback state when an interruption event occurs during the animation playback process; the animation playback executor 320 is connected to the playback state saving module 310 through a network, and is used to obtain the current playback state saved by the playback state saving module 310, and based on the current playback state, according to a preset state transition table, determine the execution condition corresponding to the current playback state, and execute the execution condition to complete the playback of the animation playback segment corresponding to the current playback state; the mobile terminal 330 is connected to the animation playback executor 320 through a network, and is used to display the animation segment being played.
[0068] The following will be combined Figure 3 Steps S210 to S240 are explained and illustrated.
[0069] In step S210, a first play state is acquired, and a first animation clip to be played corresponding to the first play state, a play condition and / or a state transition condition for converting the first play state to a next play state are determined according to a preset state transition table.
[0070] Among them, the first playback state can be the playback state of the animation clip being played by the animation playback executor 320, and the preset state transition table can be a two-dimensional table or a state diagram, which is not specifically limited in this example embodiment. For example, when the state transition table is a two-dimensional table, the horizontal dimension represents the multiple playback states included in the animation to be played, and the vertical dimension represents the multiple animation clips, playback conditions and state transition conditions corresponding to the multiple playback states. The intersection of the horizontal dimension and the vertical dimension represents the migration of the playback state after a certain state condition occurs in a certain playback state, or the corresponding animation clip in a certain playback state and the playback condition for playing the animation clip.
[0071] For example, based on Figure 1 Can generate Figure 1 The corresponding state transition table, the generated state transition table reference Figure 4 As shown, in Figure 4The initial state is S1. Only when event a occurs will the state change to S2. When the state changes to S2, animation A needs to be played immediately. After animation A is executed, the state will change from S2 to S3. When the state changes to S3, animation B is played immediately. After animation B is executed, the state changes from S3 to S4. When the state is S4, event b needs to be completed to change the state to S5. When the state is S5, animation C will be played immediately, and then to state S6. At this point, no events will be received and the animation playback ends.
[0072] In this example embodiment, the state transfer condition includes at least one of a user control event, an animation clip playback completion event, or an animation clip playback interruption event.
[0073] Specifically, the user control event may be that during the playback of an animation clip, the user actively skips the playback of the currently playing animation clip and enters the next animation clip to be played after the currently playing animation clip. Since the played animation clip has changed, the playback state has also changed based on a preset state transition table. The animation clip playback interruption event may be an incoming call event on the mobile terminal or a horizontal or vertical screen switching event, which is not specifically limited in this example embodiment.
[0074] Furthermore, when an animation clip playback interruption event occurs, the animation playback method further includes:
[0075] When the animation clip playback interruption event occurs, based on a preset state transition table, the playback state corresponding to the animation clip being played is obtained, and the playback state corresponding to the animation clip being played is saved;
[0076] When the animation clip playback interruption event ends, the saved playback state is obtained, and based on a preset state transition table, a playback condition corresponding to the saved playback state and / or a state transition condition for converting the playback state corresponding to the animation clip being played to a next playback state is determined.
[0077] Specifically, when the playback status saving module 310 detects an animation clip playback interruption event on the mobile terminal, the playback status of the animation clip currently being played on the mobile terminal is obtained based on the preset state transition table, and the obtained playback status is saved. When the animation clip playback interruption event ends, when the animation to be played is opened again, first, the playback status saved by the playback status saving module 310 is obtained. Secondly, according to the playback status, at least one of the playback conditions corresponding to the playback status and the state transition conditions for converting the playback status to the next playback status is found in the preset state transition table. When the playback condition is met, the playback of the currently playing animation clip is completed through the animation playback executor 320; or when the state transition condition is met, the playback status is converted to the next playback status through the animation playback executor 320.
[0078] In this example embodiment, the preset state transition table records a plurality of play states, the animation clip to be played corresponding to each play state, the play condition, and the state transition relationship and state transition condition between different play states.
[0079] Among them, the playback conditions include unconditional execution or trigger condition execution. Unconditional execution means that when entering the state of unconditional execution, the animation corresponding to the state is executed immediately. By setting the execution condition of unconditional execution, continuous animation clips that do not require any conditions can also be connected; trigger condition execution means that only when the trigger condition is executed, the playback of the animation clip corresponding to the trigger condition can be triggered. Specifically, generating a state transition table may include: obtaining all playback states included in the animation to be played, according to the animation clip included in each playback state, realizing the playback conditions for the animation clip playback, the state transition conditions for the conversion between different states, and the association relationship between the state conversion between different playback states, and generating a preset state transition table. Through the state transition table, the establishment of flags and judgment statements in the animation playback program is reduced, and the complexity of the animation playback program is reduced.
[0080] In addition, reference Figure 5 The relationship between the animation playback executor and the playback state shown can be: the animation playback executor includes the current playback state, the playback method and the state transfer method, wherein the execution of the animation playback executor depends on the playback method of the current playback state and the state transfer method of the current playback state, and the type of the current playback state belongs to the playback state, wherein the playback state may include: variables for unconditionally executing the animation, a mapping set of the association relationship between the execution conditions and the playback state, the playback method of the playback state and the state transfer method of the playback state, and the state transfer method of the playback state has a return value, and the type of the return value is the playback state.
[0081] In step S220, in response to the playing condition being met, the first animation clip to be played corresponding to the playing condition is played.
[0082] The playback condition can be unconditional execution or triggered execution. Specifically, when the animation playback executor 320 is turned on, first, the animation playback method of the first playback state is called. In the animation playback method, it is determined based on a preset state transition table whether the playback condition corresponding to the first playback state is unconditional execution. When the playback condition is unconditional execution, in response to the satisfaction of the playback condition, the first animation clip to be played corresponding to the playback condition is played, including:
[0083] The first animation clip to be played corresponding to the playing condition is played directly.
[0084] For example, when the playback status saving module 310 saves the playback status S2 when an animation clip playback interruption event occurs, when the animation clip playback interruption event ends, the saved playback status S2 is first obtained. In the preset state transition table, when the execution condition corresponding to the playback status S2 is unconditional execution, it is necessary to immediately play the animation clip corresponding to the playback status S2 in the state transition table, that is, play animation A immediately.
[0085] In addition, when the playback condition corresponding to the first playback state is executed as a trigger condition, refer to Figure 6 As shown, the animation playing method further includes:
[0086] Step S610. When the playback condition is a triggering condition, obtain a second playback state;
[0087] Step S620: Determine whether the second play state is the same as the first play state.
[0088] Step S610 and step S620 are explained and illustrated below. Specifically, when the animation playback method corresponding to the first playback state determines that the playback condition corresponding to the first playback state is executed as a trigger condition, the playback state corresponding to the animation clip being played by the animation playback executor 320 is obtained, wherein the obtained playback state is the second playback state. After the second playback state is obtained, it is determined whether the second playback state is the same as the first playback state, that is, it is determined whether the playback state of the animation playback executor 320 has been converted.
[0089] Further, when the playback state of the animation playback executor 320 does not change, refer to Figure 7 As shown, the animation playing method further includes:
[0090] Step S710. When the second playback state is different from the first playback state, determining a playback condition corresponding to the second playback state based on the preset state transition table;
[0091] Step S720: Based on the playback condition corresponding to the second playback state, the second animation clip to be played corresponding to the second playback state is played by the animation playback method corresponding to the second playback state.
[0092] In the following, step S710 and step S720 will be explained and illustrated. Specifically, when the playback condition corresponding to the first playback state is a trigger condition playback, the animation playback executor 320 first obtains the playback state of the currently played animation clip, that is, the second playback state, and determines whether the first playback state is the same as the second playback state. When the first playback state is different from the second playback state, that is, the playback state of the animation player 320 has changed, then based on the preset state transition table, at least one of the playback conditions or state transition conditions corresponding to the second playback state is determined, and the playback condition or state transition condition is passed as a parameter into the animation playback method corresponding to the second playback state to realize the judgment of the playback condition, and then complete the playback of the second playback animation clip corresponding to the second playback state.
[0093] For example, refer to Figure 4 According to the state transition table shown, when the first playback state saved by the playback state saving module 310 is S1, the animation playback executor 320 determines that the playback condition corresponding to the first playback state is event a based on the preset state transition table, that is, the playback condition corresponding to the first playback state is executed as a trigger condition. At this time, it is necessary to obtain the playback state of the animation playback executor 320 again. When the acquired second playback state is different from the first playback state, the second playback state is S2, then it is necessary to determine at least one of the playback condition or state transition condition corresponding to the second playback state through the preset state transition table, and then Figure 4 From the state transition table, it can be obtained that the play condition corresponding to the play state S2 is unconditional execution, and the animation A needs to be played immediately, and after the animation A is played, the second play state is converted from S2 to S3.
[0094] In addition, when the first play state is the same as the second play state, that is, the play state of the animation player 320 has not changed, the state transition condition corresponding to the first play state is waited to be satisfied.
[0095] Specifically, when the first playback state is the same as the second playback state, the state transition condition corresponding to the first playback state is waited for to be satisfied, wherein the state transition condition may be a user control event. When a user control event occurs, the user control event is executed by calling the state transition method of the animation playback executor 320. Furthermore, the animation playback executor 320 calls the state transition method corresponding to the first playback state. During the execution of the state transition method corresponding to the first playback state, the corresponding playback state in the same horizontal dimension as the user control event is returned based on the preset state transition table, i.e., the next playback state corresponding to the first playback state is determined.
[0096] After the first playing state is acquired, the animation playing method further includes:
[0097] Determine whether the playing condition of the first animation clip to be played corresponding to the first playing state and the state transition condition for converting the first playing state to the next playing state are empty;
[0098] When the playing condition of the first animation clip to be played and the state transition condition for converting the first playing state to the next playing state are empty, the first playing state is set to the end state.
[0099] Specifically, after the animation playback executor 320 obtains the first playback state, it first determines whether the playback conditions and state transition conditions of the first playback state are empty based on the preset state transition table. When the playback conditions of the first playback state in the preset state transition table do not exist for unconditional execution or trigger condition execution, and the state transition condition is also empty, the first playback state can be set to the end state.
[0100] The animation playing method and animation playing system provided by the exemplary embodiments of the present disclosure have at least the following advantages:
[0101] On the one hand, when an animation clip playback interruption event occurs during the playback of the animation to be played, the first playback state of the currently playing animation clip is saved, and when the animation clip playback interruption event ends, the first playback state is obtained, and based on a preset state transition table, at least one of the playback conditions or state transition conditions corresponding to the first playback state is determined to complete the playback of the animation to be played, thereby solving the problem that the animation playback in the prior art does not have a recovery function.
[0102] On the other hand, after the first playback state is obtained, at least one of the playback conditions or state transition conditions corresponding to the first playback state is determined according to a preset state transition table, without setting flags and judgment conditions, thereby reducing the complexity of the animation playback program.
[0103] The following, combined Figure 8 The animation playing method of the exemplary embodiment of the present disclosure is further explained and illustrated. The animation playing method may include the following steps:
[0104] Step S810: The animation playback executor is started to obtain the first playback state of the currently played animation clip;
[0105] Step S820. Call the play method of the animation player and the play method of the first play state;
[0106] Step S830. Determine whether the playback condition corresponding to the first playback state is unconditional execution by using the playback method corresponding to the first playback state;
[0107] Step S840. When the playback condition is unconditional execution, the animation clip corresponding to the first playback state is played immediately;
[0108] Step S850: The animation playback executor returns the next playback state corresponding to the first playback state based on the state transition table;
[0109] Step S860: Determine whether the next playback state is the same as the first playback state; when the playback states are the same, return to step S820.
[0110] Step S870. When the playback states are different, the animation playback executor waits for at least one of the playback conditions or state transition conditions corresponding to the next playback state to occur;
[0111] Step S880. When the state transition condition is obtained, the state transition method of the animation executor is called, and the state transition method corresponding to the next playback state is called;
[0112] Step S890. Determine the return state of the next playback state and the trigger event corresponding to the next playback state based on the state transition table by the state transition method;
[0113] Step S8100. The animation playback executor determines whether the next playback state is the same as the next playback state of the next playback state; if they are the same, it returns to execute step S820; if they are different, it returns to execute step S860.
[0114] The exemplary embodiment of the present disclosure also provides an animation playback device, referring to Fig. 9 As shown, the animation playing device may include: a playing condition determination module 910, a to-be-played animation segment playing module 920, and a playing state conversion module 930. Among them:
[0115] The playback condition determination module 910 is used to obtain a first playback state, and determine a first animation clip to be played corresponding to the first playback state and its playback condition and / or a state transition condition for converting the first playback state to a next playback state according to a preset state transition table;
[0116] The to-be-played animation clip playing module 920 is used to play the first to-be-played animation clip corresponding to the playing condition in response to the playing condition being met;
[0117] The play state conversion module 930 is used to convert the first play state to the next play state in response to the satisfaction of the state transfer condition, and control the play of the multiple animation clips based on the next play state.
[0118] In an exemplary embodiment of the present disclosure, the state transfer condition includes at least one of a user control event, an animation clip playback completion event, or an animation clip playback interruption event.
[0119] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0120] When the animation clip playback interruption event occurs, based on a preset state transition table, the playback state corresponding to the animation clip being played is obtained, and the playback state corresponding to the animation clip being played is saved;
[0121] When the animation clip playback interruption event ends, the saved playback state is obtained, and based on a preset state transition table, a playback condition corresponding to the saved playback state and / or a state transition condition for converting the playback state corresponding to the animation clip being played to a next playback state is determined.
[0122] In an exemplary embodiment of the present disclosure, the preset state transition table records multiple play states, animation clips to be played corresponding to each play state, play conditions, and state transition relationships and state transition conditions between different play states.
[0123] In an exemplary embodiment of the present disclosure, in response to the playing condition being satisfied, playing a first animation clip to be played corresponding to the playing condition, includes:
[0124] When the playing condition is unconditional playing, the first to-be-played animation clip corresponding to the playing condition is directly played.
[0125] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0126] When the playing condition is a triggering condition playing, obtaining a second playing state;
[0127] Determine whether the second play state is the same as the first play state.
[0128] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0129] When the second playback state is different from the first playback state, determining a playback condition and / or a state transition condition corresponding to the second playback state based on the preset state transition table;
[0130] Based on the playback condition and / or state transition condition corresponding to the second playback state, the second animation clip to be played corresponding to the second playback state is played by the animation playback method corresponding to the second playback state.
[0131] In an exemplary embodiment of the present disclosure, in response to the state transition condition being satisfied, converting the first play state to the next play state includes:
[0132] Acquire a state transition condition corresponding to the first playback state;
[0133] Based on the state transition condition, a next play state corresponding to the first play state is determined by a state transition method corresponding to the first play state, and the first play state is converted to the next play state.
[0134] In an exemplary embodiment of the present disclosure, the animation playing method further includes:
[0135] Determine whether the playing condition of the first animation clip to be played corresponding to the first playing state and the state transition condition for converting the first playing state to the next playing state are empty;
[0136] When the playing condition of the first animation clip to be played and the state transition condition for converting the first playing state to the next playing state are empty, the first playing state is set to the end state.
[0137] The specific details of each module in the above animation playing device have been described in detail in the corresponding animation playing method, so they will not be repeated here.
[0138] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0139] In addition, although the steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0140] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above-mentioned data packet transmission method is also provided.
[0141] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0142] Reference below Fig.10 The electronic device 1000 according to this embodiment of the present invention will be described. Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0143] like Fig.10 As shown, the electronic device is in the form of a general computing device. The components of the electronic device may include, but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.
[0144] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 2Step S210 shown in: obtaining a first playback state, and determining, according to a preset state transition table, a first animation clip to be played corresponding to the first playback state, a playback condition, and / or a state transition condition for converting the first playback state to a next playback state; step S220: in response to the playback condition being met, playing the first animation clip to be played corresponding to the playback condition; step S230: in response to the state transition condition being met, converting the first playback state to the next playback state, and controlling the playback of the multiple animation clips based on the next playback state.
[0145] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .
[0146] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0147] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0148] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0149] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0150] In an exemplary embodiment of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0151] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0152] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0153] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0154] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0155] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0156] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0157] Other embodiments of the invention will readily occur to those skilled in the art after considering the specification and practicing the invention invented herein. This application is intended to cover any variations, uses or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art that are not invented by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. An animation playing method, used to control the playing of multiple animation clips, characterized in that: include: Acquire a first playback state, and determine, according to a preset state transition table, a first animation clip to be played corresponding to the first playback state, a playback condition, and / or a state transition condition for converting the first playback state to a next playback state; In response to the playing condition being satisfied, playing the first animation clip to be played corresponding to the playing condition; when the playing condition is a triggering condition playing, acquiring a second playing state; Determining whether the second playback state is the same as the first playback state; when the second playback state is different from the first playback state, determining a playback condition and / or a state transition condition corresponding to the second playback state based on the preset state transition table; Based on the playback condition and / or state transition condition corresponding to the second playback state, the second to-be-played animation clip corresponding to the second playback state is played by the animation playback method corresponding to the second playback state; In response to the satisfaction of the state transition condition, the first playback state is converted to the next playback state, and the playback of the multiple animation clips is controlled based on the next playback state; wherein, in response to the satisfaction of the state transition condition, the first playback state is converted to the next playback state, comprising: obtaining the state transition condition corresponding to the first playback state; based on the state transition condition, determining the next playback state corresponding to the first playback state through the state transition method corresponding to the first playback state, and converting the first playback state to the next playback state.
2. The animation playing method according to claim 1, characterized in that: The state transfer condition includes at least one of a user control event, a cartoon clip play completion event, or a cartoon clip play interruption event.
3. The animation playing method according to claim 2, characterized in that: The animation playing method further comprises: When the animation clip playback interruption event occurs, based on a preset state transition table, the playback state corresponding to the animation clip being played is obtained, and the playback state corresponding to the animation clip being played is saved; When the animation clip playback interruption event ends, the saved playback state is obtained, and based on a preset state transition table, a playback condition corresponding to the saved playback state and / or a state transition condition for converting the playback state corresponding to the animation clip being played to a next playback state is determined.
4. The animation playing method according to claim 1, characterized in that: The preset state transition table records a plurality of play states, the animation clip to be played corresponding to each play state, the play condition, and the state transition relationship and state transition condition between different play states.
5. The animation playing method according to claim 1 or 4, characterized in that: In response to the playing condition being satisfied, playing a first animation clip to be played corresponding to the playing condition, comprising: When the playing condition is unconditional playing, the first to-be-played animation clip corresponding to the playing condition is directly played.
6. The animation playing method according to claim 1, characterized in that: The animation playing method further comprises: Determine whether the playing condition of the first animation clip to be played corresponding to the first playing state and the state transition condition for converting the first playing state to the next playing state are empty; When the playing condition of the first animation clip to be played and the state transition condition for converting the first playing state to the next playing state are empty, the first playing state is set to the end state.
7. An animation playing device for controlling the playing of multiple animation clips, characterized in that: include: A playback condition determination module, used to obtain a first playback state, and determine a first animation clip to be played corresponding to the first playback state and its playback condition and / or a state transition condition for converting the first playback state to a next playback state according to a preset state transition table; The to-be-played animation clip playing module is used to play the first to-be-played animation clip corresponding to the playing condition in response to the playing condition being met; when the playing condition is a trigger condition playing, obtain a second playing state; Determining whether the second playback state is the same as the first playback state; when the second playback state is different from the first playback state, determining a playback condition and / or a state transition condition corresponding to the second playback state based on the preset state transition table; Based on the playback condition and / or state transition condition corresponding to the second playback state, the second to-be-played animation clip corresponding to the second playback state is played by the animation playback method corresponding to the second playback state; A playback state conversion module is used to convert the first playback state to the next playback state in response to the satisfaction of the state transfer condition, and control the playback of the multiple animation clips based on the next playback state; wherein, in response to the satisfaction of the state transfer condition, converting the first playback state to the next playback state includes: obtaining the state transfer condition corresponding to the first playback state; based on the state transfer condition, determining the next playback state corresponding to the first playback state through the state transfer method corresponding to the first playback state, and converting the first playback state to the next playback state.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the animation playing method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the animation playing method described in any one of claims 1-6 by executing the executable instructions.
