Method and device for generating animation data, equipment, medium and program product
By calculating the animation progress and generating animation data, the vertical synchronization signal and animation framework are decoupled, and the programming complexity and screen tearing problems caused by the differences in display mechanisms in different animation frameworks are solved, and the unity and efficiency of animation data interfaces are achieved.
Patent Information
- Application Number
- CN202510098651.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-06
AI Technical Summary
In different animation frameworks, the display mechanism is independent and different, which leads to developers need to program animation effects separately for each animation framework. Due to the differences in display mechanisms, screen tearing is prone to problems such as screen tearing.
By obtaining the animation parameters and the keyframe sequence of the target animation, calculate the target animation progress corresponding to the vertical synchronization signal, and generate animation data based on the progress and keyframe sequence, decoupling the vertical synchronization signal and the animation frame, and providing a unified animation data interface.
Ensure that each animation frame directly obtains animation data for specific vertical synchronization signals, avoids obtaining data for the complete animation process, thereby providing an animation data interface with unified display frequency, solving problems such as screen tearing, and improving the efficiency of animation generation.
Smart Images

Figure CN119941931A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates generally to the field of computers, and more particularly to methods, devices, apparatuses, computer-readable storage media, and computer program products for generating animation data. Background Art
[0002] In today's mobile Internet era, people can see a variety of animation effects everywhere in the mobile applications they use every day. From simple interface switching to various icon animations, all of these are inseparable from the animation framework technology support behind them. Many mobile operating systems have their own unique animation frameworks.
[0003] Accordingly, cross-platform application development has received more and more attention, and users' requirements for application experience are also rising. Among them, animation effects have become a key factor in significantly improving the user interface interaction experience. Because different terminals may use different animation frameworks, developers need to develop novel animation effects for different animation frameworks to meet the needs of users using different terminals. Summary of the invention
[0004] According to an example embodiment of the present disclosure, a method, an apparatus, a device, a computer storage medium, and a computer program product for generating animation data are provided.
[0005] In a first aspect of the present disclosure, a method for generating animation data is provided, the method comprising obtaining animation parameters and a key frame sequence for a target animation. The method further comprises determining a target animation progress corresponding to a vertical synchronization signal according to the animation parameters, the vertical synchronization signal indicating a target time. The method further comprises generating animation data of an animation object at a target time according to the target animation progress and the key frame sequence.
[0006] In a second aspect of the present disclosure, a device for generating animation data is provided, the device comprising an acquisition module configured to acquire animation parameters and a key frame sequence for a target animation. The device further comprises a progress determination module configured to determine a target animation progress corresponding to a vertical synchronization signal according to the animation parameters, the vertical synchronization signal indicating a target time. The device further comprises a generation module configured to generate animation data of an animation object at a target time according to the target animation progress and the key frame sequence.
[0007] In a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processing unit; and at least one memory, wherein the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, and when the instructions are executed by the at least one processing unit, the electronic device executes the method described in the first aspect of the present disclosure.
[0008] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, which has machine-executable instructions stored thereon, and when the machine-executable instructions are executed by a device, the device performs the method described in the first aspect of the present disclosure.
[0009] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer executable instructions, wherein the computer executable instructions implement the method described according to the first aspect of the present disclosure when executed by a processor.
[0010] The invention summary is provided to introduce a series of concepts in a simplified form, which will be further described in the specific embodiments below. The invention summary is not intended to identify the key features or essential features of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easy to understand through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 A schematic diagram illustrating an example environment in which embodiments of the present disclosure can be implemented;
[0012] Figure 2 A flowchart of a method for generating animation data according to an embodiment of the present disclosure is shown;
[0013] Figure 3 A schematic diagram showing a progress curve according to an embodiment of the present disclosure;
[0014] Figure 4 A schematic diagram showing a transition curve according to an embodiment of the present disclosure;
[0015] Figure 5A-Figure 5B A communication schematic diagram for generating animation data according to an embodiment of the present disclosure is shown;
[0016] Figure 6 A schematic diagram showing a module architecture according to an embodiment of the present disclosure is shown;
[0017] Figure 7 A schematic block diagram showing an example apparatus according to some embodiments of the present disclosure is shown;
[0018] Figure 8 A block diagram of an example device that may be used to implement embodiments of the present disclosure is shown.
[0019] Throughout the drawings, the same or similar reference numbers denote the same or similar elements. DETAILED DESCRIPTION
[0020] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information. It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the type, scope of use, and usage scenarios of the personal information involved in the present disclosure should be informed to the user in an appropriate manner in accordance with relevant laws and regulations and the user's authorization should be obtained.
[0021] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server or storage medium that performs the operation of the technical solution of the present disclosure based on the prompt message. As an optional but non-limiting implementation method, in response to receiving an active request from a user, the method of sending a prompt message to the user can be, for example, a pop-up window, and the prompt message can be presented in text in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0022] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0024] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects, unless explicitly stated. Other explicit and implicit definitions may also be included below.
[0025] In the animation frameworks established by different operating systems, the display mechanisms are often independent and different from each other. In addition, the characteristics, motion effect functions, etc. of each animation framework are different, and the animation effects provided by each animation framework are too simple and basic. Therefore, developers need to program animations separately for specific animation frameworks. When programming animations for different animation frameworks, in order to improve the work efficiency of developers, related technologies provide some third-party libraries, which integrate function methods for implementing some animation effects for developers to call. These animation effects encapsulate the basic effects of each animation framework, so that developers do not need to develop animation effects separately for different animation frameworks. However, since the display mechanism is different in different animation frameworks, developers still need to adapt the display support for animation effects for different animation frameworks, otherwise problems such as screen tearing will occur.
[0026] In this regard, the present disclosure proposes a method for generating animation data. The method can decouple the vertical synchronization signal from the animation framework, and the subject executing the method (e.g., an application encoded on an application development framework other than the animation framework of the terminal) determines the animation data corresponding to the vertical synchronization signal by calculating the target animation progress and the animation data corresponding to the progress. This ensures that each animation framework directly obtains the animation data for a specific vertical synchronization signal, rather than obtaining the animation data for the complete animation process. Therefore, an animation data interface with a unified display frequency is provided, and there is no need to adapt the display work of the animation effect at the vertical synchronization signal level to the display mechanism of the animation framework itself.
[0027] The embodiments of the present disclosure will be described in detail below in conjunction with the accompanying drawings. Figure 1 A schematic diagram of an example environment 100 in which an embodiment of the present disclosure can be implemented is shown. The example environment 100 includes a computing device 110 and a computing device 120. The computing device 110 can process data and deploy an application development framework, such as a development framework for coding animation, to provide compilation services for user devices (such as computing device 120) accessing the computing device 110. In some embodiments, the computing device 120 communicates with the computing device 110 via a network 130. The network 130 may include a wired network, a wireless network, or a combination thereof, to provide communication between the computing device 120 and the computing device 110. In some embodiments, the computing device 120 may be connected to the computing device 110 via a data line, and the present disclosure does not limit the connection method between the computing device 110 and the computing device 120.
[0028] In this embodiment, the developer can input the animation parameters 144 and the key frame sequence 150 for the target animation on the computing device 120 and provide them to the computing device 110 through the network 130. In some embodiments, the computing device 120 and the computing device 110 can be the same computing device 110, and the developer inputs the animation parameters 144 and the key frame sequence 150 for the target animation into the computing device 110 through the input device in the application development framework provided by the computing device 110 to generate animation data. For example, the developer can reference a third-party library in the application development framework provided by the computing device 110, and the third-party library is provided with function methods for performing various operations of the method, and passes the animation parameters 144 and the key frame sequence 150 for the target animation as parameters to the instantiated acquisition module, and the acquisition module can be an instantiation of the base class provided by the third-party library. For convenience, the following description is made for the computing device 110 and the computing device 120 belonging to different devices.
[0029] In this embodiment, the computing device 110 may determine the target animation progress corresponding to the vertical synchronization signal 142 based on the animation parameter 144, and the vertical synchronization signal 142 indicates the target time. Figure 1 As shown, the computing device 110 can obtain the vertical synchronization signal 142 from the display device (not shown), can also obtain the vertical synchronization signal 142 from the computing device 110, and can also obtain the vertical synchronization signal 142 from the computing device 120. The vertical synchronization signal 142 is used as a time unit for generating animation data. In generating animation data, the animation data at which progress is to be generated is calculated based on the target time carried in the vertical synchronization signal 142. This needs to be determined in combination with the animation parameters 144. The animation parameters 144 can, for example, specify the time length of the target animation, the evolution law of the animation progress, etc. Figure 1 As shown, the computing device 110 may determine a target animation progress 148 at a target time from a progress curve 146 of the target animation according to the vertical synchronization signal 142 and the parameters 1 and 2 included in the animation parameters 144 .
[0030] In an embodiment, the computing device 110 may generate animation data 152 of the animation object at the target time according to the target animation progress 148 and the key frame sequence 150. For example, the key frame sequence 150 may include multiple key frames such as key frames 150-1 and 150-2. These key frames record the key action nodes of the animation object in the target animation. Figure 1 , the target animation can be an animation of a ball moving from left to right along a straight line, and different colors can be used during the movement. Figure 1As shown, the animation data may include the target time t carried by the vertical synchronization signal 142, the position information of the ball (for example, it may be in the middle position), the color of the ball (for example, it may be gray), and other data.
[0031] In an embodiment, computing device 110 may also send (or inform) animation data 152 to an animation object in computing device 120 , which in this embodiment is a control (eg, a View control) representing a sphere in key frame sequence 150 .
[0032] When the display device displays the animation effect corresponding to the vertical synchronization signal 142, the computing device 120 can apply the corresponding animation data to the animation object, and obtain the display content corresponding to the vertical synchronization signal 142 through processor rendering for display by the display device. For example, the generated animation effect shows that the ball rolls to the middle position and appears gray. Through this operation, the computing device 110 can decouple the vertical synchronization signal 142 from the animation framework on the computing device 120, so that no matter which animation framework is deployed in the computing device 120, the animation effect can be displayed according to the animation data according to the display mode specified by the computing device 110, thereby improving the efficiency of generating animation.
[0033] like Figure 1 As shown, in environment 100, network 130 can be used to transmit data between computing device 110 and computing device 120. Network 130 has a theoretical bandwidth, which refers to the maximum transmission speed supported by network 130, which indicates the maximum amount of data that can be transmitted by network 130 under ideal conditions, usually measured in bits per second (bps). For example, if the theoretical bandwidth of network 130 is 100Mbps, it means that it can transmit one hundred megabits of data per second under ideal conditions. However, in reality, due to other factors that may exist in the network (e.g., signal interference, bandwidth sharing, transmission delay, etc.), the actual transmission speed of 100Mbps may not be achieved.
[0034] As understood by those skilled in the art, an instance of the computing device 110 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server may be directly or indirectly connected via wired or wireless communications, which is not limited in this application.
[0035] The computing device 120 may be any type of mobile computing device, including a mobile computer (e.g., a personal digital assistant (PDA), a laptop computer, a notebook computer, a tablet computer, a netbook, etc.), a mobile phone (e.g., a cellular phone, a smart phone, etc.), a wearable computing device (e.g., a smart watch, a head-mounted device, including smart glasses, etc.), or other types of mobile devices. In some embodiments, the computing device 120 may also be a stationary computing device, such as a desktop computer, a game console, a smart TV, etc.
[0036] It should be understood that the architecture and functions in the example environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure. Embodiments of the present disclosure may also be applied to other environments with different structures and / or functions.
[0037] The process according to the embodiment of the present disclosure will be described in detail below in conjunction with other drawings. For ease of understanding, the specific data mentioned in the following description are exemplary and are not intended to limit the scope of protection of the present disclosure. It is understood that the embodiments described below may also include additional actions not shown and / or the actions shown may be omitted, and the scope of the present disclosure is not limited in this respect.
[0038] Figure 2 A flow chart of a method 200 for generating animation data according to certain embodiments of the present disclosure is shown. In this embodiment, the method can be performed by a computing device 110. In box 202, animation parameters and a key frame sequence for a target animation are obtained. As an example, the animation parameters may include parameters such as the animation name, the total duration of the animation, the animation effect identifier, and the progress curve of the target animation. A key frame describes the state of an animation at a specific point in time, including style attributes of an element such as position, color, transparency, etc. Each key frame contains specific values of attributes such as the position, rotation, and scale of an object at a specific point in time. A key frame sequence refers to an ordered set of key frames, which are arranged in chronological order and are used to describe the changes in various states of the target animation from the beginning to the end. By setting key frames, developers can determine the appearance or behavior of important moments in the animation.
[0039] In box 204, according to the animation parameters, the target animation progress corresponding to the vertical synchronization signal is determined, and the vertical synchronization signal indicates the target time. The vertical synchronization (VSync) signal is a concept in display technology, which is used to ensure that there is no tearing when the display refreshes the screen. In animation rendering, the vertical synchronization signal indicates a specific time point (i.e., the target time), i.e., the timing of screen refresh. When determining the target animation progress, this embodiment uses the target time indicated by the vertical synchronization signal as the basis for determination, so that the animation data generated subsequently also corresponds to the target time, so the animation data will be generated in units of the vertical synchronization signal, which is consistent with the refresh mechanism of the display device. The target animation progress indicates the action progress of the target animation. For example, if the target animation is a ball moving 10cm from the left to the right at a uniform speed, the total time length is 2 seconds, and the target time indicates that when the animation reaches 1 second, it can be determined that the target animation progress of the ball is 50%. If the target animation is a ball moving from the left side to the right side by 10 cm, with a slower speed during the 0-5 cm period and a faster speed during the 5-10 cm period, the total time length is 2 seconds, and the target time indicates that when the animation reaches 1 second, the target animation progress of the ball may be 30% or even 20% (should be less than 50%).
[0040] In frame 206, according to the target animation schedule and the key frame sequence, the animation data of the animation object at the target time is generated. Because the key frame sequence represents a series of actions of the action object in the complete target animation, it can be determined what kind of action the animation object should be at the target time according to the target animation schedule. Usually, the animation data can be generated by applying an interpolation function to the key frame sequence. After a pass of operation of frame 202-frame 206, an animation data corresponding to a vertical synchronization signal can be generated, and the computing device 120 can render the animation object according to the animation data to generate an animation effect for a vertical synchronization signal for display. Repeating the above operation continuously can generate an animation data sequence, and the computing device can generate a coherent target animation for display according to the animation data sequence in combination with the animation object.
[0041] According to the method of the embodiment of the present disclosure, the vertical synchronization signal can be decoupled from the animation framework, and the main body executing the method (such as a module for generating animation) determines the animation data corresponding to the vertical synchronization signal by calculating the target animation progress and the animation data corresponding to the progress. This ensures that each animation framework directly obtains the animation data for a specific vertical synchronization signal rather than obtaining the animation data for the complete animation process. Therefore, an animation data interface with a unified display frequency is provided, and there is no need to adapt the display mechanism of the animation framework itself to the display of the animation effect at the vertical synchronization signal level.
[0042] After triggering the entire process of generating animation data for the target animation, the vertical synchronization signal obtained is the first vertical synchronization signal, which means that the animation data sequence is started to be generated. At this time, the target time carried in the vertical synchronization signal can be determined as the start time of the target animation, and the first time length of the completed part of the target animation is zero (i.e., the starting value).
[0043] In the subsequent process of generating animation data, the target time carried in the vertical synchronization signal must be later than the start time. In an embodiment, the first time length of the completed part of the target animation can be determined according to the target time. For example, the first time length can be 1 second. In an embodiment, the animation parameters include a progress curve, which indicates the change process of the progress of the target animation over time, and the computing device 110 can determine the progress corresponding to the target time as the target animation progress according to the progress curve and the first time length. For example, the horizontal axis of the progress curve represents time, and the vertical axis represents the animation progress. Match the animation progress from the progress curve according to the first time length to obtain the target animation progress. If the first time length indicates 1 second, the horizontal axis of the progress curve starts from 0, and the vertical axis value corresponding to 1 second can be obtained from the progress curve as the target animation progress.
[0044] Figure 3 FIG. 2 shows a schematic diagram of a progress curve according to an embodiment of the present disclosure. Figure 3 As shown, progress curves can be of different types, and progress curve 302 is a linear curve, which means that the action of the animation object changes at a uniform speed over time in the key frame sequence. At this time, the target animation progress can be inferred based on the ratio of the first time length to the total time length. In an embodiment, the first time ratio is determined based on the first time length and the total time length of the target animation. In an embodiment, the progress corresponding to the first time ratio in the progress curve is determined as the target animation progress. If the first time length is 1 second and the total time length is 2 seconds, it can be determined that the target animation progress is 1 / 2=50%. For the total time length, it can be obtained from the animation parameters or from the progress curve.
[0045] The progress curve 304 is a nonlinear curve, and it can be seen that the animation progress of the target action develops slowly at the beginning stage, quickly in the middle stage, and slowly at the end stage. Therefore, the first time length needs to be input into the function of the progress curve 304 to determine the target animation progress of the animation object at the target time.
[0046] In an embodiment, if the target animation for the animation object is triggered, the status indicator is set to the playing state. In this way, the developer can understand whether the animation data of the target animation is in the process of being generated by reading the status indicator. After obtaining the vertical synchronization signal, if the first time length is calculated to be greater than the total time length, it means that the animation should have been played and there is no need to generate animation data, so the status indicator can be set to the end state. In this way, the developer only needs to read the value of the status indicator to know whether the animation data is in progress and whether it has ended.
[0047] After determining the target animation progress, the most relevant key frame sequence can be selected from the key frame sequence according to the target animation progress to generate animation data. In the animation parameters, each key frame can have a corresponding animation progress. In an embodiment, a preceding key frame (i.e., the first key frame) and a succeeding key frame (i.e., the second key frame) are selected from the key frame sequence according to the target animation progress, wherein the preceding key frame is the key frame that is closest to the target animation progress among the key frames that occur before the target time, and the succeeding key frame is the key frame that is closest to the target animation progress among the key frames that occur after the target time. The preceding key frame and the succeeding key frame can constitute a key frame interval for the target animation progress. The animation data to be generated is most closely related to these two key frames.
[0048] In an embodiment, an interpolation operation is performed based on the previous key frame and the subsequent key frame to generate raw animation data. Since the animation usually does not stop exactly on one key frame, but is located between two key frames, it is necessary to use a mathematical algorithm (such as linear interpolation, spline interpolation, etc.) to calculate the state of the animation object at any point between the two key frames. The result is a set of raw animation data that depicts the transition state of the animation object between the two key frames. In this embodiment, the interpolation method of the animation data is unified, so that the generated animation data has a more consistent animation style on different animation frames, and the animation performance of different animation frames is aligned.
[0049] In an embodiment, according to the animation object, the original animation data is encapsulated to generate the animation data. The next step is to convert the original animation data obtained by interpolation into a form suitable for the specific animation object. This involves the process of adapting according to the animation framework on the computing device 120, such as organizing the original data into a specific format, or adding additional information, such as the properties of the animation object, the transformation matrix, etc., so that the animation framework can correctly understand and display the data.
[0050] In this embodiment, it is used to ensure that the animation can be accurately and smoothly displayed at any given target time point, even if the time point does not fall exactly on any key frame. This method relies on the selection and interpolation of key frames, thereby ensuring the smoothness and accuracy of the animation data.
[0051] During the interpolation process, the original animation data can be further determined with the help of a transition curve. In an embodiment, the animation parameters include a transition curve, and the computing device 110 can determine the progress interval according to the first animation progress corresponding to the previous key frame and the second animation progress corresponding to the next key frame. The transition curve can be a mathematical function or a predefined shape (such as linear, slow in and slow out, elastic, etc.), which determines the speed at which the attribute value (or original animation data) of the animation target changes. When the user provides a key frame, the animation progress corresponding to the key frame can also be provided. For example, the target animation has 5 key frames, the first key frame corresponds to the animation effect with an animation progress of zero, the second key frame corresponds to the animation effect with an animation progress of 25%, the third key frame corresponds to the animation effect with an animation progress of 50%, the fourth key frame corresponds to the animation effect with an animation progress of 75%, and the fifth key frame corresponds to the animation effect with an animation progress of 100%. If the target animation progress is 40%, the second key frame and the third key frame can be determined as the previous key frame and the next key frame, and the corresponding progress interval is 20%-50%.
[0052] In an embodiment, the computing device 110 may determine a third progress according to the target animation progress and the progress interval. The third progress indicates the proportion of the target animation progress in the progress interval. Referring to the above example, if the target animation progress is 40%, the third progress may be (40%-20%) ÷ (50%-20%) = 66.7%.
[0053] In an embodiment, the computing device 110 may determine the transition ratio according to the third progress and the transition curve. In the transition curve, the starting endpoint of the curve is the animation data indicated by the previous key frame, and the ending endpoint of the curve is the animation data indicated by the next key frame. The horizontal axis of the transition curve represents the size of the third progress, and the vertical axis represents the transition ratio. In combination with the above example, when the third progress is 66.7%, the transition ratio may be 90%.
[0054] In an embodiment, the computing device 110 may generate animation data through interpolation operations based on the transition ratio, the first key frame, and the second key frame. Finally, the computing device 110 uses the transition ratio as a weight to perform a weighted average of the attributes between the first key frame and the second key frame to generate the final animation data. This means that if the transition ratio is close to 0, the result is closer to the first key frame; if it is close to 1, it is closer to the second key frame; and any value in between will produce a state in between, making the animation look smoother and more natural.
[0055] In summary, by introducing transition curves, the animation system can achieve more sophisticated and smooth transition effects between keyframes, rather than simple linear changes. This approach not only improves visual quality, but also better simulates physical behaviors in the real world or expresses specific artistic intent.
[0056] Figure 4 A schematic diagram of a transition curve according to an embodiment of the present disclosure is shown. As shown in the figure, the horizontal axis of the transition curve 402 can represent the third progress, the vertical axis can represent the transition ratio, the starting point represents the attribute value of the previous key frame 404, and the end point represents the attribute value of the subsequent key frame 406. According to the change trend of the transition curve 402, it can be seen that in the process of transitioning from the previous key frame to the subsequent key frame, the development of the animation progress is relatively slow in the beginning stage, the development of the animation progress is relatively rapid in the middle stage, and the development of the animation progress is relatively slow in the end stage. Therefore, the third progress needs to be input into the function of the transition curve 402 to determine the transition ratio.
[0057] Sometimes, for a specific purpose, developers may need to scale the action of a certain animation to make it complete quickly or slowly. In an embodiment, the animation parameters include a scaling factor, and the computing device 110 can determine the second time length by scaling the first time length according to the scaling factor. The scaling factor is mainly used for the time dimension, that is, to adjust the speed at which the target animation is played. The original key frame sequence and animation progress are calculated based on an initial time length (first time length). Now, the computing device 110 will use the scaling factor to adjust this time length to generate a new time length (second time length). For example, if the scaling factor is greater than 1, the animation will be accelerated; if it is less than 1, the animation will be decelerated. This step allows developers to dynamically adjust the rhythm of the animation to adapt to different needs or scenarios.
[0058] In an embodiment, the computing device 110 may update the original animation data according to the second time length. After determining the new time length, the original animation data needs to be adjusted accordingly. This is because the timestamps and other time-related attributes in the animation data need to be recalculated according to the new time length to ensure that the target animation is still smooth and coherent within the new time frame.
[0059] In an embodiment, the computing device 110 can generate animation data by encapsulating the updated original animation data according to the animation object of the target animation framework. Through the encapsulation operation, the animation data can be parsed by the corresponding animation framework and act on the animation object set in the animation framework to achieve the animation effect. In this embodiment, by introducing a scaling factor, not only can the playback speed be adjusted while maintaining the original animation design intent, but also it can be ensured that the animation can be presented in the best form in various environments. This is particularly useful for cross-platform development because it allows the animation content to be created once and then easily adjusted according to the requirements of the specific platform.
[0060] Figure 5A-Figure 5B A communication schematic diagram for generating animation data according to an embodiment of the present disclosure is shown. For the sake of clarity, the complete communication process is divided into two diagrams for display. Figure 5A The content shown is related to determining the target animation progress according to the vertical synchronization signal. In this embodiment, multiple function modules in the third library (i.e., base classes containing function functions) can be instantiated to complete the method for generating animation data. Figure 5A In the example, the state recording module 502 is provided with a state indicator to record whether the method for generating animation data for the target animation is triggered. If the method is triggered at 512 (for example, a trigger instruction or a drive instruction is received), the state indicator in the state recording module 502 is marked as a play state at 514. If the execution of the method is terminated, the state indicator therein is marked as an end state. In this way, the developer can call the state indicator in the state recording module 502 to obtain the state indication at any time. After the process is triggered, the vertical synchronization signal can be obtained by the vertical synchronization signal callback module (not shown). The state recording module 502 can receive and record the vertical synchronization signal as a log. Based on this, the developer can infer which time the animation data currently being generated corresponds to.
[0061] If the target animation for the animation object is triggered, the acquired vertical synchronization signal is the first vertical synchronization signal, and the target time carried therein can be determined as the start time of the target animation at 518, and the first time length corresponding to the vertical synchronization signal is the starting value (e.g., zero). These operations can be implemented by the frame modeling module 506. If it is not the first vertical synchronization signal, it means that it is in the middle process or the process after the end of the target animation. At 520, the target time in the signal is sent to the frame modeling module 506. At 522, the frame modeling module 506 can calculate the first time length according to the start time and the target time. At 524, the frame modeling module 506 returns the calculated first time length to the state recording module 502. The state recording module 502 can receive the total time length in the animation parameters, and then compare the first time length with the total time length. If the first time length is greater than the total time length, it means that the target animation has been played to the end, and there is no need to perform subsequent steps, and the state indicator is updated to the end state.
[0062] If the state recording module 502 compares and obtains that the first time length is less than the total time length, it means that the target animation should continue to play at the vertical synchronization signal. At 526, the key frame sequence 526 is provided to the frame modeling module 526 by the effect module 504. Next, the frame modeling module 506 guides the generation of animation data. At 528, the frame modeling module 506 can send the target time to the curve module 508. The curve module 508 can record information related to the curve, such as a progress curve, a transition curve, etc. At 530, the curve module 508 determines the first time length of the completed part of the target animation according to the target time, and determines the progress corresponding to the target time as the target animation progress according to the first time length and the progress curve. At 532, the curve module 508 returns the target animation progress to the frame modeling module 506.
[0063] Figure 5B The content shown relates to generating animation data according to a target animation progress. Figure 5BIn the embodiment of the present invention, at 534, the frame modeling module 506 requests the curve module 508 to determine the key frame interval. In this regard, at 536, the curve module 508 can send the progress curve for the target animation to the frame module 510. At 538, the frame module 510 selects the previous key frame and the next key frame from the key frame sequence according to the target animation progress to obtain the key frame interval. At 540, the frame module 510 sends the key frame interval to the frame modeling module 506. In the case where the animation parameters include a scaling factor, the scaling factor can also be used to adjust the animation progress. At 542, the scaling factor is sent to the curve module 508. At 544, the curve module 508 determines the second time length by scaling the first time length according to the scaling factor. At 546, the curve module 508 sends the second time length to the frame modeling module 506. At 548, the frame modeling module 506 requests the frame module 510 for the original animation data. At 550, the frame module 510 generates the original animation data according to the key frame interval and the transition ratio, but because of the existence of the scaling factor, the second time length needs to be marked in the original animation data. If there is no scaling system, the first time length can be marked in the original animation data. At 552, the frame module 510 returns the original animation data to the effect module 504. At 554, the effect module 504 can encapsulate the animation data according to the type of animation frame where the animation object is located, thereby obtaining the animation effect 156. At this point, the animation data for the vertical synchronization signal has been generated, and the generation of subsequent animation data can be started. Subsequently, the vertical synchronization signal callback module is used to obtain the vertical synchronization signal again, and the above process is repeated.
[0064] Figure 6 The schematic diagram of the module architecture according to the embodiment of the present disclosure is shown. In this embodiment, the operations involved in the above-mentioned embodiment can be written as base classes using programming languages, and these base classes can constitute a third-party code library that can be referenced. As shown in the figure, the code library 610 includes an animation module 612, an effect module 614, a parameter adjustment module 616, an animation effect module 618, an attribute value module 620, a curve definition module 622, a frame modeling module 624, a curve module 626, an animation event module 628, a frame module 630 and a signal callback module 632.
[0065] Animation module 612 corresponds to Figure 5AThe state recording module 502 in is used to record the state of the target animation. The effect module 614 can store the key frame sequence input by the user and provide it to the frame modeling module 624. In addition, the effect module 614 can also save the identification of the animation object, and after obtaining the animation data, notify the animation object of the animation data. The parameter adjustment model 616 is used to store some animation parameters input by the developer, such as the animation name, etc. The parameter adjustment model 616 can also provide an interface for adding, deleting, modifying and checking animation parameters, so that the developer can adjust the animation parameters in real time. The animation effect module 618 can store the effect parameters of each key frame in the key frame sequence, and is responsible for the connection between the frame modeling module 624 and other modules.
[0066] The attribute value module 620 is used to store the generated animation data. The curve definition module 622 is used to provide various curves, such as the determination of the progress curve and the determination of the transition curve. The developer can pass parameters to the curve definition module 622 to select a specific curve. The frame modeling module 624 corresponds to Figure 5A The frame modeling module 506 in the example is used to set the start time, receive the target time, receive the key frame sequence, calculate the first time length, send the target time, request the key frame interval, provide the scaling factor, request the original animation data, etc. The curve module 626 corresponds to Figure 5A The curve module 508 in the animation event module 628 is mainly used to provide a progress curve. The animation event module 628 is used to sense the current processing flow. The signal callback module 632 can call back the vertical synchronization signal as a unit for generating animation data. The frame module 630 is used to obtain the original animation data by performing interpolation calculation in the key frame interval in combination with the transition curve, corresponding to Figure 5A Frame module 510 in.
[0067] Figure 6 Also shown is a first animation framework 602 and a second animation framework 604, which may correspond to different operating systems. When referencing the code library 610, the first animation framework 602 may set a first instance 606 to inherit the base class of each module in the code library 610. In addition, the first animation framework 602 may also set an animation object according to the characteristics of the framework, and the animation object needs to receive animation data to achieve animation effects. For example, the animation object may be a Text View base class. Similarly, when referencing the code library 610, the second animation framework 604 may set a second instance 608 to inherit the base class of each module in the code library 610.
[0068] In this embodiment, the animation object can be not only a rendering node, but also a node other than a rendering node. For example, if at least part of the animation clips of the target animation are not a series of action combinations, but a series of data, then the animation data generated for a certain vertical synchronization signal can be one or more data in this series. In this case, the animation object can be an object that needs the one or more data, rather than an object that displays animation actions, so the boundaries of the animation object can be expanded.
[0069] Figure 7 1 shows a schematic block diagram of an example device 700 according to some embodiments of the present disclosure. The device 700 may be implemented in software, hardware, or a combination of both. Figure 7 As shown, the apparatus 700 includes an acquisition module 710 , a progress determination module 720 and a generation module 730 .
[0070] In some embodiments, the acquisition module 710 can be configured to acquire animation parameters and a key frame sequence for a target animation. The progress determination module 720 can be configured to determine the target animation progress corresponding to a vertical synchronization signal according to the animation parameters, and the vertical synchronization signal indicates a target time. The generation module 730 can be configured to generate animation data of an animation object at a target time according to the target animation progress and the key frame sequence.
[0071] In some embodiments, the animation parameters include a progress curve, and the progress determination module 720 includes a first determination module configured to determine a first time length of a completed portion of the target animation according to the target time. The progress determination module 720 also includes a second determination module configured to determine a progress corresponding to the target time as the target animation progress according to the first time length and the progress curve, wherein the progress curve indicates the change process of the progress of the target animation over time.
[0072] In some embodiments, the first determination module includes a third determination module configured to determine the target time as the start time of the target animation in response to the vertical synchronization signal being the first vertical synchronization signal for the target animation. The first determination module also includes a fourth determination module configured to determine the first time length as the starting value.
[0073] In some embodiments, the apparatus 700 further includes a fifth determining module configured to determine the first time length according to the target time and the start time in response to the vertical synchronization signal not being the first vertical synchronization signal for the target animation.
[0074] In some embodiments, the animation parameters include the total time length of the target animation, the progress curve is a linear curve, and the second determination module includes a sixth determination module configured to determine the first time ratio based on the first time length and the total time length of the target animation. The second determination module also includes a seventh determination module configured to determine the progress corresponding to the first time ratio in the progress curve as the target animation progress.
[0075] In some embodiments, the device 700 further includes a first state determination module configured to set the state indicator to a play state in response to the target animation for the animation object being triggered. The device 700 further includes a second state determination module configured to set the state indicator to an end state in response to the first time length being greater than the total time length.
[0076] In some embodiments, each key frame has a corresponding animation progress, and the generation module 730 includes a selection module configured to select a first key frame and a second key frame from the key frame sequence according to the target animation progress, wherein the first key frame is the key frame that occurs before the target time and is closest to the target animation progress, and the second key frame is the key frame that occurs after the target time and is closest to the target animation progress. The generation module 730 also includes an interpolation module configured to perform an interpolation operation based on the first key frame and the second key frame to generate original animation data. The generation module 730 also includes an encapsulation module configured to encapsulate the original animation data according to the animation object to generate animation data.
[0077] In some embodiments, the animation parameter includes a transition curve, and the interpolation module includes a progress interval determination module configured to determine the progress interval according to the first animation progress corresponding to the first key frame and the second animation progress corresponding to the second key frame. The interpolation module also includes a sixth determination module configured to determine the third progress according to the target animation progress and the progress interval. The interpolation module also includes a seventh determination module configured to determine the transition ratio according to the third progress and the transition curve. The interpolation module also includes a second generation module configured to generate animation data through an interpolation operation according to the transition ratio, the first key frame and the second key frame.
[0078] In some embodiments, the animation parameter includes a scaling factor, and the encapsulation module includes an eighth determination module configured to determine the second time length by scaling the first time length according to the scaling factor. The encapsulation module also includes an update module configured to update the original animation data according to the second time length. The encapsulation module also includes a third generation module configured to generate animation data by encapsulating the updated original animation data according to the animation object of the target animation framework.
[0079] The division of modules or units in the embodiments of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in the disclosed embodiments may be integrated into one unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0080] Figure 8 8 is a block diagram of an example device 800 that can be used to implement embodiments of the present disclosure. It should be understood that Figure 8 The device 800 shown is merely an example and should not be construed as limiting the functionality and scope of the implementations described herein. Figure 1 The computing device 110 described above can be used to perform the above-described Figures 1 to 6 process.
[0081] like Figure 8 As shown, the device 800 is in the form of a general-purpose computing device. The components of the computing device 800 may include, but are not limited to, one or more processors or processing units 810, a memory 820, a storage device 830, one or more communication units 840, one or more input devices 850, and one or more output devices 860. The processing unit 810 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 820. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to increase the parallel processing capabilities of the computing device 800.
[0082] The computing device 800 typically includes a plurality of computer storage media. Such media may be any available media accessible to the computing device 800, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 820 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 830 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data (e.g., training data for training) and may be accessed within the computing device 800.
[0083] The computing device 800 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 8 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 820 may include a computer program product 825 having one or more program modules that are configured to perform various methods or actions of various implementations of the present disclosure.
[0084] The communication unit 840 implements communication with other computing devices through a communication medium. Additionally, the functions of the components of the computing device 800 can be implemented in a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the computing device 800 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0085] The input device 850 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 860 may be one or more output devices, such as a display, a speaker, a printer, etc. The computing device 800 may also communicate with one or more external devices (not shown) through the communication unit 840 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the computing device 800, or communicate with any device that allows the computing device 800 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0086] According to an example implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an example implementation of the present disclosure, a computer program product is also provided, the computer program product is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above. According to an example implementation of the present disclosure, a computer program product is provided, on which a computer program is stored, and when the program is executed by a processor, the method described above is implemented.
[0087] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0088] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0089] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0090] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0091] The above descriptions of various implementations of the present disclosure are illustrative, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the marketplace, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.
Claims
1. A method for generating animation data, comprising: Get animation parameters and key frame sequence for target animation; determining, according to the animation parameters, a target animation progress corresponding to a vertical synchronization signal, the vertical synchronization signal indicating a target time; as well as According to the target animation progress and the key frame sequence, animation data of the animation object at the target time is generated.
2. The method according to claim 1, wherein the animation parameters include a progress curve, and determining the target animation progress corresponding to the vertical synchronization signal according to the animation parameters comprises: Determine a first time length of a completed portion of the target animation according to the target time; as well as According to the first time length and the progress curve, a progress corresponding to the target time is determined as the target animation progress, wherein the progress curve indicates a change process of the progress of the target animation over time.
3. The method according to claim 2, wherein determining the first time length of the completed part of the target animation according to the target time comprises: In response to the vertical synchronization signal being a first vertical synchronization signal for the target animation, determining the target time as a start time of the target animation; as well as The first time length is determined as a starting value.
4. The method according to claim 3, further comprising: In response to the vertical synchronization signal not being a first vertical synchronization signal for the target animation, the first time length is determined according to the target time and the start time.
5. The method according to claim 2, wherein the animation parameters include the total time length of the target animation, the progress curve is a linear curve, and according to the first time length and the progress curve, determining the progress corresponding to the target time as the target animation progress comprises: determining a first time ratio based on the first time length and the total time length of the target animation; as well as The progress corresponding to the first time ratio in the progress curve is determined as the target animation progress.
6. The method according to claim 5, further comprising: In response to a target animation for the animation object being triggered, setting a state indicator to a playing state; as well as In response to the first time length being greater than the total time length, the state indicator is set to an end state.
7. The method according to claim 1, wherein each key frame has a corresponding animation progress, and generating animation data of the animation object at the target time according to the target animation progress and the key frame sequence comprises: Selecting a first key frame and a second key frame from the key frame sequence according to the target animation progress, wherein the first key frame is a key frame that occurs before the target time and is closest to the target animation progress, and the second key frame is a key frame that occurs after the target time and is closest to the target animation progress; Performing an interpolation operation according to the first key frame and the second key frame to generate original animation data; as well as According to the animation object, the original animation data is encapsulated to generate the animation data.
8. The method according to claim 7, wherein the animation parameter comprises a transition curve, and performing an interpolation operation according to the first key frame and the second key frame comprises: Determining a progress interval according to a first animation progress corresponding to the first key frame and a second animation progress corresponding to the second key frame; Determining a third progress according to the target animation progress and the progress interval; Determining a transition ratio according to the third progress and the transition curve; and The animation data is generated through the interpolation operation according to the transition ratio, the first key frame and the second key frame.
9. The method according to claim 7, wherein the animation parameter comprises a scaling factor, and according to the animation object, encapsulating the original animation data to generate the animation data comprises: determining a second time length by scaling the first time length according to the scaling factor; Update the original animation data according to the second time length; as well as The animation data is generated by encapsulating the updated original animation data according to the animation object of the target animation framework.
10. A device for generating animation data, comprising: An acquisition module configured to acquire animation parameters and a key frame sequence for a target animation; a progress determination module configured to determine a target animation progress corresponding to a vertical synchronization signal according to the animation parameters, the vertical synchronization signal indicating a target time; as well as A generating module is configured to generate animation data of the animation object at the target time according to the target animation progress and the key frame sequence.
11. An electronic device, comprising: at least one processing unit; At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform the method according to any one of claims 1 to 9.
12. A computer program product having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 9.