Methods, electronic devices and storage media for generating animation data
By supplementing virtual pixels in the start and end frame images and establishing a mapping relationship, and using an interpolation algorithm to generate intermediate frames, the problem of generating animation data on devices with limited computing resources is solved, and smooth animation data can be generated on these devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ECOFLOW INC
- Filing Date
- 2025-07-07
- Publication Date
- 2026-05-26
AI Technical Summary
Electronic devices with limited computing resources struggle to generate animation data.
By acquiring the starting and ending frame images, virtual display pixels are added to ensure a consistent number of pixels, a pixel mapping relationship is established, and an interpolation algorithm is used to generate intermediate frame images, simplifying the calculation process.
Generating smooth animation data on devices with limited computing resources reduces computational complexity and enables the generation of animation data.
Smart Images

Figure CN122089902A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of animation technology, and in particular to a method for generating animation data, an electronic device, and a storage medium. Background Technology
[0002] As users demand a higher level of product experience, more and more electronic devices are equipped with displays, which can show static or dynamic images and enhance the user's intuitive perception.
[0003] When a user wants to display an animation on an electronic device's screen, they can use a terminal device to transmit the animation content to the electronic device, which will then display the corresponding animation. In some scenarios, to reduce the amount of data transmitted, the terminal device does not transmit all image frames when transmitting animation content to the electronic device; it only transmits a subset of key frames. The electronic device then uses these key frames, along with animation generation methods such as object recognition and optical flow tracing, to fill in the missing frames and generate the animation data.
[0004] However, these existing animation generation methods are quite complex, and for some electronic devices, the limited computing resources make it difficult to implement these methods. Summary of the Invention
[0005] In view of the above, it is necessary to provide a method, electronic device and storage medium for generating animation data, which solves the problem that it is difficult to generate animation data on electronic devices with limited computing resources.
[0006] This application provides a method for generating animation data, applied to an electronic device. The method includes: acquiring a start frame image and an end frame image; when the number of initial display pixels in the start frame image and the number of initial display pixels in the end frame image are inconsistent, supplementing the start frame image or the end frame image with virtual display pixels so that the number of display pixels contained in the start frame image and the end frame image are the same; the coordinates of the virtual display pixels overlap with the coordinates of the initial display pixels in the image; determining a one-to-one mapping relationship between the display pixels in the start frame image and the display pixels in the end frame image; generating multiple intermediate frame images based on a preset interpolation algorithm and the coordinates of each corresponding set of display pixels in the start frame image and the end frame image; and generating animation data based on the start frame image, the multiple intermediate frame images, and the end frame image.
[0007] The method for generating animation data disclosed in this application can generate animation data by performing simple calculations based on the start frame image and the end frame image when the computing resources of electronic devices are limited, thus solving the problem that it is difficult to generate animation data on electronic devices with limited computing resources.
[0008] This application also provides an apparatus for generating animation data, the apparatus comprising: an acquisition module for acquiring a start frame image and an end frame image; a processing module for supplementing virtual display pixels in the start frame image or the end frame image when the number of initial display pixels in the start frame image and the number of initial display pixels in the end frame image are inconsistent, so that the number of display pixels contained in the start frame image and the end frame image are the same; the coordinates of the virtual display pixels overlap with the coordinates of the initial display pixels in the image; a determination module for determining a one-to-one mapping relationship between the display pixels in the start frame image and the display pixels in the end frame image; the processing module is further configured to generate multiple intermediate frame images based on a preset interpolation algorithm and the coordinates of each corresponding set of display pixels in the start frame image and the end frame image; the processing module is further configured to generate animation data based on the start frame image, the multiple intermediate frame images and the end frame image.
[0009] This application also provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method for generating animation data as described above.
[0010] This application also provides a computer-readable storage medium storing computer-readable instructions that are executed by a processor in an electronic device to implement a method for generating animation data. Attached Figure Description
[0011] Figure 1 This is a schematic diagram illustrating an application scenario of the data transmission method provided in an embodiment of this application.
[0012] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0013] Figure 3 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application.
[0014] Figure 4 This is a flowchart of a method for generating animation data provided in an embodiment of this application.
[0015] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0016] For ease of understanding, some concepts related to the embodiments of this application are illustrated and explained by way of example for reference.
[0017] It should be noted that the terms "first", "second", "third", "fourth", "fifth", etc. (if present) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0018] To better understand the method, electronic device, and storage medium for generating animation data provided in the embodiments of this application, the application scenarios of the method for generating animation data in this application are described below.
[0019] Figure 1 This application provides an embodiment of a method for generating animation data, illustrating an application scenario. The method is applied to an electronic device 1, which can communicate with a terminal device 2.
[0020] In this embodiment, the electronic device 1 can be a device with limited computing resources, such as a power bank, a handheld gaming device, or a smart wearable device.
[0021] In this embodiment, the terminal device 2 may be a smart screen, mobile phone, tablet computer, smart wearable device, augmented reality (AR) / virtual reality (VR) device, laptop computer, netbook, energy storage device, power distribution equipment, vehicle-mounted device, self-moving device, etc. This embodiment does not impose any restrictions on the specific type of terminal device.
[0022] To better understand the method for generating animation data provided in this application, the specific structure of the electronic device is described below. (See also...) Figure 2 The diagram shown is a structural schematic of an electronic device 1 provided in an embodiment of this application. The electronic device 1 includes, but is not limited to, such as... Figure 2 As shown, the electronic device 1 may include a display 100, a communication module 101, a memory 102, and a processor 103. The processor 103 is electrically connected to the display 100, the communication module 101, and the memory 102. The display 100 is used for playing videos, etc. The electronic device 1 can communicate with the terminal device 2 through the communication module 101.
[0023] The memory 102 may include firmware storage and extended data storage. The firmware storage stores the firmware program of the main control chip and may be integrated flash memory or electrically erasable programmable read-only memory (EEPROM). The memory 102 stores one or more computer programs. These one or more computer programs are configured to be executed by the processor 103. The one or more computer programs include multiple instructions, which, when executed by the processor 103, implement a method for generating animation data that can be executed on the electronic device 1.
[0024] Processor 103 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a baseband processor. These different processing units may be independent devices or integrated into one or more processors.
[0025] The processor 103 provides computing and control capabilities; for example, the processor 103 is used to execute computer programs stored in the memory 102 to implement the above-described method for generating animation data.
[0026] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 1. In other embodiments of this application, the electronic device 1 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0027] See Figure 3 The diagram shown is a structural schematic of a terminal device 2 provided in an embodiment of this application. The terminal device 2 includes, but is not limited to, devices such as... Figure 3 As shown, the terminal device 2 may include a communication module 201, a memory 202, a processor 203, an input / output (I / O) interface 204, and a bus 205. The processor 203 is coupled to the communication module 201, the memory 202, and the input / output interface 204 via the bus 205.
[0028] In some embodiments of this application, terminal device 2 can establish a communication connection with electronic device 1 through communication module 201.
[0029] The memory 202 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM). The RAM can be directly read and written by the processor 203, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.
[0030] Random access memory can include static random-access memory (SRAM), dynamic random-access memory (DRAM), synchronous dynamic random-access memory (SDRAM), double data rate synchronous dynamic random-access memory (DDRSDRAM), etc.
[0031] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 203. Non-volatile memory can include disk storage devices and flash memory.
[0032] Memory 202 is used to store one or more computer programs. The one or more computer programs are configured to be executed by processor 203. The one or more computer programs include multiple instructions.
[0033] In other embodiments, the terminal device 2 also includes an external memory interface for connecting to an external memory to expand the storage capacity of the terminal device 2.
[0034] Processor 203 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0035] Processor 203 provides computing and control capabilities.
[0036] I / O interface 204 is used to provide a channel for user input or output. For example, I / O interface 204 can be used to connect various input and output devices, such as mouse, keyboard, touch screen, etc., so that users can enter information or visualize information.
[0037] Bus 205 is used at least to provide a channel for communication between the communication module 201, memory 202, processor 203, and input / output interface 204 in terminal device 2.
[0038] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal device 2. In other embodiments of this application, the terminal device 2 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0039] Figure 4 This is a flowchart of a method for generating animation data according to an embodiment of this application, such as... Figure 4 As shown, the method for generating animation data is applied in electronic devices. Depending on different needs, the order of the steps in this flowchart can be changed, and some steps can be omitted.
[0040] Step S01: Obtain the start frame image and the end frame image.
[0041] In some embodiments of this application, the electronic device can acquire a start frame image and an end frame image from a terminal device. For example, a user can select an animation corresponding to a target image expression in an application on the terminal device and preview the animation in real time. When the user wants to display the animation on the screen of the electronic device, they can operate the terminal device to transmit the animation to be displayed to the electronic device, controlling the electronic device to display the corresponding animation.
[0042] In some scenarios, to reduce the amount of data transmitted, when a terminal device transmits animation content to an electronic device, it does not need to transmit all the image frames corresponding to the animation. For example, the terminal device can send the first and last frames of the animation to the electronic device; the electronic device can use the first frame as the start frame and the last frame as the end frame, and then generate the intermediate frames corresponding to the animation based on the start and end frames to obtain and display the animation.
[0043] For example, for some complex animations, the terminal device can send the first frame image, key frame image, and last frame image corresponding to the animation to the electronic device; the electronic device can use two adjacent frames in the first frame image, key frame image, and last frame image as the start frame image and end frame image, respectively, and generate intermediate frame images between adjacent frames one by one using the method provided in this application, and finally obtain and display the complete animation based on the first frame image, key frame image, last frame image, and intermediate frame images corresponding to each adjacent frame.
[0044] Step S02: Determine whether the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are inconsistent. If the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are consistent, proceed to step S04; if the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are inconsistent, proceed to step S03.
[0045] In some embodiments of this application, the start frame image and / or end frame image are displayed as pixels on an electronic device. When the electronic device plays an animation, it needs to play from the start frame image to the end frame image, which can be achieved by gradually changing the initial display pixels in the start frame image to the initial display pixels in the end frame image.
[0046] If the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are inconsistent, the process executes step S03, which can supplement virtual display pixels in the starting frame image or the ending frame image to make the number of display pixels contained in the starting frame image and the ending frame image the same.
[0047] If the number of initial display pixels in the starting frame image is the same as the number of initial display pixels in the ending frame image, the process executes step S04 to determine the one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image.
[0048] Step S03: Add virtual display pixels to the starting frame image or the ending frame image so that the number of display pixels contained in the starting frame image and the ending frame image is the same.
[0049] In this embodiment of the application, if the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are inconsistent, for the frame image with fewer initial display pixels, virtual display pixels are obtained by randomly copying pixels from the original frame image, so that the number of pixels in the starting frame image is the same as the number of pixels in the ending frame image.
[0050] In some embodiments of this application, virtual display pixels are added to the starting frame image or the ending frame image to make the number of display pixels contained in the starting frame image and the ending frame image the same. This includes: when the first number of initial display pixels in the starting frame image is less than the second number of initial display pixels in the ending frame image, determining a first difference between the second number and the first number; and adding virtual display pixels of the first difference to the starting frame image so that the sum of the number of initial display pixels and virtual display pixels in the starting frame image is equal to the second number of initial display pixels in the ending frame image.
[0051] The coordinates of the virtual display pixels overlap with the coordinates of the initial display pixels in the image. One initial display pixel can have 0, 1, or more virtual display pixels superimposed on it.
[0052] Since the coordinates of the supplementary virtual display pixels overlap with the coordinates of the initially displayed pixels in the image, they do not affect the actual display of the image.
[0053] By randomly copying the initial display pixels from the starting frame image to supplement the virtual display pixels of the first difference, the transition of the screen during animation playback can be made smoother, and the overall effect can more naturally present the change from the starting frame image to the ending frame image.
[0054] For example, the starting frame image is a circle, and the ending frame image is a square. The initial number of display pixels in the starting frame image is 80, and the second number of initial display pixels in the ending frame image is 100. Since the first number is less than the second number, the first difference between them is 20. At this point, 20 virtual display pixels can be added to the circular starting frame image, making the sum of the initial display pixels and virtual display pixels in the starting frame image equal to the second number of initial display pixels in the ending frame image. The coordinates of these 20 virtual display pixels in the starting frame image can overlap with the coordinates of the 20 initial display pixels out of the 80 initial display pixels in the starting frame image.
[0055] In some embodiments of this application, virtual display pixels are added to the starting frame image or the ending frame image to make the number of display pixels contained in the starting frame image and the ending frame image the same. The method further includes: when the first number of initial display pixels in the starting frame image is greater than the second number of initial display pixels in the ending frame image, determining a second difference between the first number and the second number; and adding virtual display pixels of the second difference to the ending frame image so that the sum of the number of initial display pixels and virtual display pixels in the ending frame image is equal to the first number of initial display pixels in the starting frame image.
[0056] For example, the starting frame image is a circle, and the ending frame image is a square. The initial number of display pixels in the starting frame image is 100, and the second number of initial display pixels in the ending frame image is 80. The first number is greater than the second number, resulting in a second difference of 20. Twenty virtual display pixels are added to the square ending frame image, such that the sum of the initial display pixels and virtual display pixels in the ending frame image equals the second number of initial display pixels in the starting frame image. The coordinates of these 20 virtual display pixels in the ending frame image can overlap with the coordinates of the 20 initial display pixels out of the 80 initial display pixels in the ending frame image.
[0057] Step S04: Determine the one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image.
[0058] In some embodiments of this application, in order to ensure a smooth transition from the starting frame image to the ending frame image during animation playback, it is necessary to determine a one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image. Specifically, a one-to-one mapping relationship is established between randomly selected display pixels in the starting frame image and the display pixels in the ending frame image.
[0059] Step S05: Based on the preset interpolation algorithm and the coordinates of each corresponding display pixel in the starting frame image and the coordinates in the ending frame image, generate multiple intermediate frame images.
[0060] In this embodiment of the application, after determining the one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image, multiple sets of corresponding display pixel coordinates in the starting frame image and coordinates in the ending frame image can be obtained. Based on a preset interpolation algorithm and the coordinates of each set of corresponding display pixels in the starting frame image and coordinates in the ending frame image, multiple intermediate frame images are generated.
[0061] Specifically, based on the interpolation algorithm and the coordinates of each group of corresponding display pixels in the starting frame image and the ending frame image, the coordinates of the display pixels in the intermediate frame are generated; and the intermediate frame image is generated based on the coordinates of the display pixels in the intermediate frame corresponding to each group of corresponding display pixels.
[0062] In some embodiments of this application, the interpolation algorithm is a linear interpolation algorithm or a nonlinear interpolation algorithm. Indicatively, the interpolation algorithm described above can be any one of the following algorithms: sine interpolation algorithm, polynomial interpolation algorithm, slow-in slow-out interpolation algorithm, cubic spline interpolation algorithm, Bézier curve interpolation algorithm, etc., and this application does not limit it in this regard.
[0063] In some embodiments of this application, assuming the starting frame image is frame1 and the ending frame image is frame15, after the electronic device acquires frame1 and frame15, it adjusts frame1 or frame15 according to the first number of initial display pixels in frame1 and the second number of initial display pixels in frame15, so that the number of display pixels contained in frame1 and frame15 is the same. Then, it determines the one-to-one mapping relationship between the display pixels in frame1 and the display pixels in frame15. Based on a preset interpolation algorithm and the coordinates of each corresponding set of display pixels in frame1 and in frame15, multiple intermediate frame images frame2 to frame14 are generated. Animation data is generated based on frame1, multiple frames2 to frame14, and frame15.
[0064] For example, based on the coordinates (x1-i, y1-i) of the corresponding display pixel in frame1 and (x15-i, y15-i) in frame15, a pre-set interpolation algorithm is used to generate the coordinates of the corresponding display pixels in 13 intermediate frame images from frame2 to frame14, such as coordinates (x2-i, y2-i), (x3-i, y3-i), ..., (x14-i, y14-i), to achieve a smooth transition effect, where i is a natural number.
[0065] Then, the corresponding intermediate frame images can be generated based on the coordinates of the display pixels corresponding to the intermediate frame images frame2 to frame14. For example, based on the coordinates of the corresponding display pixels in the i-th group, the coordinates (x2-i, y2-i) of a display pixel in the intermediate frame image frame2 can be calculated. Assuming there are 80 corresponding display pixels, the intermediate frame image frame2 can be determined based on the coordinates (x2-1, y2-1), (x2-2, y2-2), (x2-3, y2-3), ..., (x2-80, y2-80).
[0066] In this embodiment of the application, after generating multiple intermediate frame images, the start frame image, multiple intermediate frame images and the end frame image can be stored in the electronic device in a preset storage format.
[0067] Step S06: Generate animation data based on the starting frame image, multiple intermediate frame images, and the ending frame image.
[0068] In some embodiments of this application, based on the examples listed above, during the process of generating animation data from a start frame image, multiple intermediate frame images, and an end frame image, an easing-in / easing-out interpolation algorithm can be used to generate the coordinates of the display pixels in the multiple intermediate frames, controlling the speed at which the display pixels in the start frame image move to the corresponding display pixels in the end frame image, thus achieving a natural easing-in / easing-out animation rhythm. For example, a circular start frame image can be slowly transitioned to other arbitrarily shaped intermediate frame images, finally presenting a square end frame image.
[0069] In some embodiments of this application, after generating animation data based on a start frame image, multiple intermediate frame images, and an end frame image, the method for generating animation data further includes: storing the animation data; and playing the animation data when a preset trigger condition is met. The preset trigger condition includes any one of turning on the electronic device, charging the electronic device, or other conditions.
[0070] In some embodiments of this application, the method for generating animation data further includes: when a preset trigger condition is met, checking whether a preset flag field is a first identifier, where the first identifier can be represented as 1, true, or other identifiers; if the flag field is determined to be the first identifier, playing the animation data; and after playback, setting the preset flag field to a second identifier, where the second identifier can be represented as 0, false, or other identifiers to avoid repeated playback. Then, after waiting for a preset duration, resetting the flag field to the first identifier again to execute the next animation playback.
[0071] Through the above steps S01 to S06, animation data can be generated based on the start frame image and the end frame image, without needing to receive all the image frames contained in the animation data.
[0072] While some algorithms for generating intermediate frames include those that use interpolation to generate intermediate frames based on keyframes, these methods perform interpolation from the perspective of the overall image of the keyframes. This process is complex and requires significant computational resources, making them unsuitable for electronic devices with limited computing resources.
[0073] Compared to these algorithms, the method for generating animation data provided in this application starts from the dimension of pixels. By supplementing the display pixels of the start frame image and the end frame image, and establishing a one-to-one correspondence between the display pixels of the start frame image and the end frame image, the process of calculating intermediate frames is simplified from interpolation calculation between images to interpolation calculation between the coordinates of corresponding display pixels. This greatly simplifies the calculation difficulty of intermediate frames, making the method provided in this application applicable to electronic devices with limited computing resources, and solving the problem of difficulty in generating animation data on electronic devices with limited computing resources.
[0074] Figure 5 A schematic structural block diagram of the apparatus 50 for generating animation data provided in the fourth aspect of the present application is shown, as follows: Figure 5 As shown in this embodiment, the device 50 for generating animation data can be divided into multiple functional modules according to the functions it performs. These functional modules may include: an acquisition module 501, a processing module 502, and a determination module 503.
[0075] The acquisition module 501 is used to acquire the start frame image and the end frame image; The processing module 502 is used to supplement the starting frame image or the ending frame image with virtual display pixels when the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are inconsistent, so that the starting frame image and the ending frame image contain the same number of display pixels; the coordinates of the virtual display pixels overlap with the coordinates of the initial display pixels in the image. The determining module 503 is used to determine the one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image; The processing module 502 is also used to generate multiple intermediate frame images based on a preset interpolation algorithm and the coordinates of each corresponding display pixel in the starting frame image and the ending frame image. The processing module 502 is also used to generate animation data based on the starting frame image, the plurality of intermediate frame images and the ending frame image.
[0076] In some embodiments, the processing module 502 is further configured to: determine a first difference between the second number and the first number when the first number of initial display pixels in the starting frame image is less than the second number of initial display pixels in the ending frame image; and supplement the starting frame image with virtual display pixels of the first difference, such that the sum of the number of initial display pixels and the number of virtual display pixels in the starting frame image is equal to the second number of initial display pixels in the ending frame image.
[0077] In some embodiments, the processing module 502 is further configured to: determine a second difference between the first number and the second number when the first number of initial display pixels in the starting frame image is greater than the second number of initial display pixels in the ending frame image; and supplement the ending frame image with virtual display pixels of the second difference, such that the sum of the number of initial display pixels and the number of virtual display pixels in the ending frame image is equal to the first number of initial display pixels in the starting frame image.
[0078] In some embodiments, the processing module 502 is further configured to generate the coordinates of the display pixels of the intermediate frame based on the interpolation algorithm and the coordinates of each group of corresponding display pixels in the starting frame image and the ending frame image; and generate the intermediate frame image based on the coordinates of the display pixels of the intermediate frame corresponding to each group of corresponding display pixels.
[0079] In some embodiments, the processing module 502 is further configured to randomly select display pixels in the starting frame image and establish a one-to-one mapping relationship with display pixels in the ending frame image.
[0080] In some embodiments, the processing module 502 is further configured to store the animation data; and play the animation data when a preset trigger condition is met.
[0081] It should be noted that the information interaction and execution process between the above-mentioned devices / units / modules are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0082] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0083] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0084] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0085] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0086] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0087] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0088] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for generating animation data, applied to electronic devices, characterized in that, The method includes: Get the start frame image and the end frame image; When the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are inconsistent, virtual display pixels are added to the starting frame image or the ending frame image to make the number of display pixels contained in the starting frame image and the ending frame image the same; the coordinates of the virtual display pixels overlap with the coordinates of the initial display pixels in the image. Determine a one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image; Based on a preset interpolation algorithm and the coordinates of each corresponding display pixel in the starting frame image and the ending frame image, multiple intermediate frame images are generated. Animation data is generated based on the starting frame image, the plurality of intermediate frame images, and the ending frame image.
2. The method for generating animation data as described in claim 1, characterized in that, The step of supplementing the starting frame image or the ending frame image with virtual display pixels to make the number of display pixels contained in the starting frame image and the ending frame image the same includes: When the first number of initial display pixels in the starting frame image is less than the second number of initial display pixels in the ending frame image, a first difference between the second number and the first number is determined; The virtual display pixels that represent the first difference are added to the starting frame image, such that the sum of the number of the initial display pixels and the number of the virtual display pixels in the starting frame image is equal to the second number of the initial display pixels in the ending frame image.
3. The method for generating animation data as described in claim 1, characterized in that, The step of supplementing the starting frame image or the ending frame image with virtual display pixels to make the number of display pixels contained in the starting frame image and the ending frame image the same includes: When the first number of the initial display pixels in the starting frame image is greater than the second number of the initial display pixels in the ending frame image, a second difference between the first number and the second number is determined; The virtual display pixels of the second difference are added to the end frame image, such that the sum of the number of the initial display pixels and the number of the virtual display pixels in the end frame image is equal to the first number of the initial display pixels in the start frame image.
4. The method for generating animation data as described in claim 1, characterized in that, The method generates multiple intermediate frame images based on a preset interpolation algorithm and the coordinates of each corresponding display pixel in the starting frame image and the ending frame image, including: Based on the interpolation algorithm and the coordinates of each corresponding set of display pixels in the starting frame image and the ending frame image, the coordinates of the display pixels in the intermediate frame are generated. The intermediate frame image is generated based on the coordinates of the display pixels of the intermediate frame corresponding to each group of display pixels.
5. The method for generating animation data as described in claim 1, characterized in that, Determining the one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image includes: A one-to-one mapping relationship is established between the display pixels in the starting frame image and the display pixels in the ending frame image.
6. The method for generating animation data as described in claim 1, characterized in that, The interpolation algorithm is either a linear interpolation algorithm or a nonlinear interpolation algorithm.
7. The method for generating animation data as described in any one of claims 1 to 5, characterized in that, The method further includes: Store the animation data; When the preset trigger conditions are met, the animation data is played.
8. The method for generating animation data as described in claim 1, characterized in that, The method further includes: When the number of initial display pixels in the starting frame image and the number of initial display pixels in the ending frame image are the same, the step of determining the one-to-one mapping relationship between the display pixels in the starting frame image and the display pixels in the ending frame image is executed.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method for generating animation data as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions that are executed by a processor in an electronic device to implement the method for generating animation data as described in any one of claims 1 to 8.