Method, apparatus, electronic device and readable storage medium for generating animation curve interpolator
Curve fitting is performed by sampling points to generate an animation curve interpolation, which solves the problem of existing animation interpolations consume large CPU resources, and realizes lower resource consumption and simpler editing process.
Patent Information
- Application Number
- CN202011643842.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2040-12-30
AI Technical Summary
The existing animation interpolator consumes a lot of CPU resources during operation, which may cause lag and complex editing methods.
Curve fitting is performed by sampling points, an animation curve interpolation is generated, which reduces the work consumption of CPU resources and simplifies the editing method.
It effectively reduces the consumption of CPU resources, reduces the occurrence of lag, and simplifies the editing process of animation interpolator.
Smart Images

Figure CN112634410B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular, to a method, device, electronic device and computer-readable storage medium for generating an animation curve interpolator. Background Art
[0002] An animation interpolator is an auxiliary interface for implementing animation effects in an animation system, which can achieve the animation effects of non-linear motion and is widely used in existing UI designs.
[0003] The existing animation interpolators are mainly divided into two types. One is the interpolator default in the animation system, and the other is the custom interpolator. The interpolator default in the animation system corresponds to ordinary formulas. Even by combining their use, it still cannot meet the requirements of realistic and complex animation effects. Because too many threads are created during the operation of the custom interpolator and too many bytes are occupied under unit data, it has a relatively high requirement for the CPU, and phenomena such as lag may occur during the operation. Moreover, the editing method of the custom interpolator is relatively complex. Summary of the Invention
[0004] The present invention provides a method, device and computer-readable storage medium for generating an animation curve interpolator, and its main purpose is to reduce the working consumption of resources such as the CPU during the operation of the animation interpolator, and to simplify the editing method of the animation interpolator.
[0005] To achieve the above object, a method for generating an animation curve interpolator provided by the present invention includes:
[0006] Generating an animation curve editing coordinate system in an animation curve editor according to an animation curve generation instruction;
[0007] Determining the starting position of the animation curve in the animation curve editing coordinate system according to the starting point of the preset animation curve, generating a set of adjustment points through the starting position of the animation curve and the preset number of sampling points, and generating one or more control lines according to the set of adjustment points;
[0008] Fitting the control line to obtain a fitted curve, generating a source file according to the fitted curve, and importing the source file into a pre-edited curve dependency package;
[0009] Running the curve dependency package, judging whether there is a lag phenomenon during the operation of the fitted curve according to a preset timer. If there is a lag phenomenon during the operation of the fitted curve, adjusting the starting point and the number of sampling points of the animation curve and then regenerating the fitted curve until there is no lag phenomenon during the operation of the fitted curve, and generating an animation curve interpolator according to the curve dependency package.
[0010] Optionally, the generating one or more control lines according to the set of adjustment points includes:
[0011] Receive two or more adjustment points arbitrarily selected from the set of preset adjustment points, and generate virtual control lines between any two adjustment points.
[0012] Optionally, the fitting the control line to obtain a fitting curve includes:
[0013] Calculate the length of the fitting curve according to the dragging instruction of the user on the control line;
[0014] Calculate the curvature of the fitting curve according to the moving instructions of the two end points of the control line by the user;
[0015] Generate the fitting curve according to the length and the curvature.
[0016] Optionally, the generating the source file according to the fitting curve includes:
[0017] Compile the fitting curve into binary data;
[0018] Export the binary data to obtain the source file.
[0019] Optionally, the determining whether there is a lag phenomenon during the running of the fitting curve according to a preset timer includes:
[0020] While the fitting curve is running, use the preset timer to measure the actual running time of the fitting curve;
[0021] Within a preset time, detect whether the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer;
[0022] If the expected running time of the fitting curve is inconsistent with the actual running time of the fitting curve measured by the timer, it is determined that there is a lag phenomenon; if the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer, it is determined that there is no lag phenomenon.
[0023] Optionally, the animation curve interpolator is stored in the blockchain.
[0024] To solve the above problems, the present invention further provides an animation curve interpolator generating device, and the device includes
[0025] A coordinate system generation module, configured to generate an animation curve editing coordinate system in an animation curve editor according to an animation curve generation instruction;
[0026] A control line generation module, configured to determine the start position of an animation curve in an animation curve editing coordinate system according to a starting point of a preset animation curve, generate a set of adjustment points through the start position of the animation curve and a preset number of sampling points, and generate one or more control lines according to the set of adjustment points;
[0027] A curve fitting module, configured to fit the control line to obtain a fitted curve, generate a source file according to the fitted curve, and import the source file into a pre-edited curve dependency package;
[0028] An interpolator generation module, configured to run the curve dependency package, determine whether there is a lag phenomenon during the running of the fitted curve according to a preset timer, and if there is a lag phenomenon during the running of the fitted curve, adjust the starting point and the number of sampling points of the animation curve and then regenerate the fitted curve until there is no lag phenomenon during the running of the fitted curve, and generate an animation curve interpolator according to the curve dependency package.
[0029] Optionally, the interpolator generation module determines whether there is a lag phenomenon through the following operations:
[0030] While the fitted curve is running, use the preset timer to measure the actual running time of the fitted curve;
[0031] Within a preset time, detect whether the expected running time of the fitted curve is consistent with the actual running time of the fitted curve measured by the timer;
[0032] If the expected running time of the fitted curve is inconsistent with the actual running time of the fitted curve measured by the timer, it is determined that there is a lag phenomenon; if the expected running time of the fitted curve is consistent with the actual running time of the fitted curve measured by the timer, it is determined that there is no lag phenomenon.
[0033] To solve the above problems, the present invention further provides an electronic device, where the electronic device includes:
[0034] A memory, storing at least one instruction; and
[0035] A processor, configured to execute the instructions stored in the memory to implement the above-mentioned animation curve interpolator generation method.
[0036] To solve the above problems, the present invention further provides a computer-readable storage medium, where at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is executed by a processor in an electronic device to implement the above-mentioned animation curve interpolator generation method.
[0037] In the embodiments of the present invention, the sampling point method is adopted, and through complete curve fitting, the working consumption of resources such as the CPU is greatly reduced, and the problem of relatively complex editing methods can be solved. Description of the Drawings
[0038] Figure 1 It is a schematic flowchart of a method for generating an animation curve interpolator provided by an embodiment of the present invention;
[0039] Figure 2 It is a schematic diagram of the module of the animation curve interpolator generation program in the animation curve interpolator generation device provided by an embodiment of the present invention.
[0040] Figure 3 It is a schematic diagram of the structure of an electronic device for the method of generating an animation curve interpolator provided by an embodiment of the present invention.
[0041] The realization, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Detailed Embodiments
[0042] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0043] The execution subject of the method for generating an animation curve interpolator provided by the embodiments of the present application includes, but is not limited to, at least one of electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiments of the present application. In other words, the method for generating an animation curve interpolator can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0044] Refer to Figure 1 As shown, it is a schematic flowchart of a method for generating an animation curve interpolator provided by an embodiment of the present invention. In this embodiment, the method for generating an animation curve interpolator includes:
[0045] S1. Generate an animation curve editing coordinate system in an animation curve editor according to an animation curve generation instruction.
[0046] In the embodiments of the present invention, the animation curve generation instruction may be an indication for starting the generation of an animation curve input by a user to an electronic device.
[0047] Preferably, the generated animation curve editing coordinate system refers to a coordinate system that, after receiving an animation curve generation instruction input by a user, forms a coordinate system for the user to edit the animation curve and restricts the range where the animation curve is located. For example, when animator A starts editing the animation curve, an animation curve generation instruction is sent, and the electronic device receives this animation curve generation instruction, generates the animation curve editing coordinate system in an animation editor, and starts the animation curve generation operation.
[0048] Further, generating the animation curve editing coordinate system in the animation curve editor includes:
[0049] Analyze the animation curve generation instruction and generate a coordinate origin at a preset position in the animation curve editor, such as the lower right corner;
[0050] Determine the directions of the abscissa and ordinate according to the coordinate origin;
[0051] Receive the horizontal axis spacing and vertical axis spacing set by the user in the directions of the abscissa and ordinate;
[0052] Generate the animation curve editing coordinate system according to the origin, the horizontal axis spacing, and the vertical axis spacing.
[0053] S2. Determine the starting position of the animation curve in the animation curve editing coordinate system according to the starting point of the preset animation curve, generate a set of adjustment points through the starting position of the animation curve and the preset number of sampling points, and generate one or more control lines according to the set of adjustment points.
[0054] The starting point of the animation curve refers to the point selected by the user in the animation curve editing coordinate system to determine the position of the animation curve and at the same time used to control the generation of the animation effect.
[0055] In the embodiments of the present invention, the starting point of the animation curve can be set by the user, such as animator A. In the embodiments of the present invention, the starting position of the animation curve in the animation curve editing coordinate system is determined according to the starting point of the animation curve.
[0056] In the embodiments of the present invention, the animation curve can be a Bezier curve. The Bezier curve, also known as the Bezier curve or the Bezier curve, is a mathematical curve applied to two-dimensional graphic applications. The Bezier curve moves uniformly when the starting point and the ending point are locked. All control points and nodes on the Bezier curve can be edited. It creates and edits graphics by controlling four points on the curve (the starting point, the ending point, and two separate intermediate points).
[0057] Further, the preset number of sampling points refers to the number of samples selected by the user to complete the animation curve editing and achieve the expected animation effect. The more sampling points there are on the animation curve, the more realistic the fitted curve will be. In the embodiments of the present invention, the number of sampling points can be set by the user. For example, animator A can select more sampling points to achieve a more complex and stable animation effect.
[0058] Further, the set of adjustment points refers to the number of sampling points in the animation curve editing coordinate system. For all points within this set, the user can adjust them according to their own requirements for the animation effect and form a control line based on the points in the set of adjustment points.
[0059] Specifically, in the embodiments of the present invention, the method of forming one or more control lines according to the set of adjustment points includes:
[0060] Receive two or more adjustment points arbitrarily selected from the preset set of adjustment points, and generate virtual control lines between any two adjustment points.
[0061] S3. Fit the control line to obtain a fitted curve, generate a source file according to the fitted curve, and import the source file into a pre-edited curve dependency package.
[0062] Specifically, in the embodiments of the present invention, fitting the control line to obtain a fitted curve includes:
[0063] Calculate the length of the fitted curve according to the user's drag instruction for the control line;
[0064] Calculate the curvature of the fitted curve according to the user's movement instruction for the two end points of the control line;
[0065] Generate the fitted curve according to the length and the curvature.
[0066] Further, generating the source file according to the fitted curve includes:
[0067] Compile the fitted curve into binary data;
[0068] Export the binary data to obtain the source file.
[0069] Further, in the embodiments of the present invention, importing the source file into a pre-edited curve dependency package includes:
[0070] Accept the file selected by the user in the pre-constructed program development interface;
[0071] Call the Project option in the File;
[0072] Create a user's profile (Library) in the Project option;
[0073] Receive the Dependency option in the Library selected by the user, and copy and paste the source file into the Dependency;
[0074] Return to the Library according to the user's return command, and generate the curve dependency package in the Library.
[0075] For example, user A clicks File in the program development interface, selects the Project option under File, clicks on the Project, selects the Library under the Project, clicks to enter the Dependency under the Library, copies and pastes the source file containing the fitting curve into the Dependency, and returns to the Library. The Dependency is the generated curve dependency package.
[0076] S4. Run the curve dependency package, and determine whether there is a lag phenomenon during the running of the fitting curve according to a preset timer.
[0077] Preferably, determining whether there is a lag phenomenon during the running of the fitting curve according to a preset timer includes:
[0078] While the fitting curve is running, use the preset timer to measure the actual running time of the fitting curve;
[0079] Within a preset time, detect whether the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer;
[0080] If the expected running time of the fitting curve is inconsistent with the actual running time of the fitting curve measured by the timer, it is determined that there is a lag phenomenon; if the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer, it is determined that there is no lag phenomenon.
[0081] Further, if there is a lag phenomenon during the running of the fitting curve, return to S2 above, adjust the starting point and the number of sampling points of the animation curve, and generate a control line according to the adjusted starting point and the number of sampling points of the animation curve, and then fit to obtain the fitting curve.
[0082] If there is no lag phenomenon during the running of the fitting curve, execute S5 to generate an animation curve interpolator according to the curve dependency package.
[0083] It should be emphasized that, to further ensure the privacy and security of the above-mentioned animation curve interpolator, the above-mentioned animation curve interpolator can also be stored in a node of a blockchain. In the embodiments of the present invention, the animation curve interpolator runs the fitting curve by calling the curve dependency package.
[0084] This method adopts a sampling method, which greatly reduces the working consumption of resources such as the CPU and reduces the occurrence of jamming phenomena.
[0085] The animation curve interpolator obtained in the embodiments of the present invention adopts complete curve fitting, highly restoring the animation designed by the designer. This method is simple to implement, has low requirements for hardware, is relatively easy to implement, and the curve can also produce relevant displacement animations and be used as the path of the displacement animation. Its implementation steps are the same as those of the animation interpolator.
[0086] For example, for the animation curve interpolator set by animator A, which rotates from 0 degrees to 360 degrees in 3 seconds, then his normal animation progress is: the time ranges from 0 to 3 seconds, and the angle ranges from 0 to 360.
[0087] The embodiments of the present invention adopt the method of sampling points. Through complete curve fitting, the working consumption of resources such as the CPU is greatly reduced, and the problem of relatively complex editing methods can be solved.
[0088] As Figure 2 shown, it is a functional module diagram of the animation curve interpolator generation device of the present invention.
[0089] The animation curve interpolator generation device 100 described in the embodiments of the present invention can be installed in an electronic device. According to the functions to be realized, the animation curve interpolator generation device may include a coordinate system generation module 101, a control line generation module 102, a curve fitting module 103, and an interpolator generation module 104. The modules described in the present invention may also be referred to as units, which refer to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, and are stored in the memory of the electronic device.
[0090] In this embodiment, the functions of each module / unit are as follows:
[0091] The coordinate system generation module 101 is used to generate an animation curve editing coordinate system in the animation curve editor according to an animation curve generation instruction.
[0092] In the embodiments of the present invention, the animation curve generation instruction may be an indication for starting the generation of an animation curve input by a user to the electronic device.
[0093] Preferably, the generated animation curve editing coordinate system refers to a coordinate system that, after receiving an animation curve generation instruction input by a user, forms a coordinate system for the user to edit the animation curve and restricts the range where the animation curve is located. For example, when animator A starts editing the animation curve, an animation curve generation instruction is sent, and the electronic device receives this animation curve generation instruction, generates the animation curve editing coordinate system in an animation editor, and starts the animation curve generation operation.
[0094] Further, the coordinate system generation module 101 executes generating the animation curve editing coordinate system in an animation curve editor through the following operations:
[0095] Parse the animation curve generation instruction and generate an origin at the lower right corner of the animation curve editor;
[0096] Determine the directions of the abscissa and ordinate according to the origin;
[0097] Receive the horizontal axis spacing and vertical axis spacing set by the user in the directions of the abscissa and ordinate;
[0098] Generate the animation curve editing coordinate system according to the origin, the horizontal axis spacing, and the vertical axis spacing.
[0099] The control line generation module 102 is used to determine the start position of the animation curve in the animation curve editing coordinate system according to the start point of the preset animation curve, generate a set of adjustment points through the start position of the animation curve and the preset number of sampling points, and generate one or more control lines according to the set of adjustment points.
[0100] The start point of the animation curve refers to the point selected by the user in the animation curve editing coordinate system to determine the position of the animation curve and simultaneously control the generation of the animation effect.
[0101] In the embodiment of the present invention, the start point of the animation curve can be set by the user, such as animator A. The embodiment of the present invention determines the start position of the animation curve in the animation curve editing coordinate system according to the start point of the animation curve.
[0102] In the embodiment of the present invention, the animation curve can be a Bezier curve. The Bezier curve, also known as the Bezier curve or the Bezier curve, is a mathematical curve applied to two-dimensional graphic applications. The Bezier curve moves uniformly when the start point and the end point are locked. All control points and nodes on the Bezier curve can be edited. It creates and edits graphics by controlling four points on the curve (the start point, the end point, and two separate intermediate points).
[0103] Further, the preset number of sampling points refers to the number of samples selected by the user to complete the animation curve editing and achieve the expected animation effect. The more sampling points there are on the animation curve, the more realistic the fitted curve will be. In the embodiments of the present invention, the number of sampling points can be set by the user. For example, animator A can select more sampling points to achieve a more complex and stable animation effect.
[0104] Further, the adjustment point set refers to the number of sampling points in the animation curve editing coordinate system. For all points within this point set, the user can adjust them according to their own requirements for the animation effect and form a control line based on the points in the adjustment point set.
[0105] Specifically, the control line generation module 102 specifically performs the following operations:
[0106] Receive two or more adjustment points arbitrarily selected from the preset adjustment point set, and generate a virtual control line between any two adjustment points.
[0107] The curve fitting module 103 is used to fit the control line to obtain a fitted curve, generate a source file according to the fitted curve, and import the source file into a pre-edited curve dependency package.
[0108] Specifically, the curve fitting module 103 specifically performs the following operations:
[0109] Calculate the length of the fitted curve according to the user's drag instruction for the control line;
[0110] Calculate the curvature of the fitted curve according to the user's movement instruction for the two end points of the control line;
[0111] Generate the fitted curve according to the length and the curvature.
[0112] Further, generating the source file according to the fitted curve includes:
[0113] Compile the fitted curve into binary data;
[0114] Export the binary data to obtain the source file.
[0115] Further, in the embodiments of the present invention, importing the source file into a pre-edited curve dependency package includes:
[0116] Accept the file selected by the user in the pre-constructed program development interface;
[0117] Call the Project option in the File;
[0118] Create a user's profile (Library) in the Project option;
[0119] Receive the Dependency option in the Library selected by the user, and copy and paste the source file to the Dependency;
[0120] Return to the Library according to the user's return command, and generate the curve dependency package in the Library.
[0121] For example, user A clicks File in the program development interface, selects the Project option under File, clicks on the Project, selects the Library under the Project, clicks to enter the Dependency under the Library, copies and pastes the source file containing the fitting curve to the Dependency, and returns to the Library. The Dependency is the generated curve dependency package.
[0122] The interpolator generation module 104 is used to run the curve dependency package, and according to a preset timer, determine whether there is a lag phenomenon during the running of the fitting curve. If there is a lag phenomenon during the running of the fitting curve, adjust the starting point and the number of sampling points of the animation curve and then regenerate the fitting curve until there is no lag phenomenon during the running of the fitting curve, and then generate an animation curve interpolator according to the curve dependency package.
[0123] Preferably, the interpolator generation module 104 executes the operation of determining whether there is a lag phenomenon during the running of the fitting curve according to a preset timer as follows:
[0124] While the fitting curve is running, use the preset timer to measure the actual running time of the fitting curve;
[0125] Within a preset time, detect whether the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer;
[0126] If the expected running time of the fitting curve is inconsistent with the actual running time of the fitting curve measured by the timer, it is determined that there is a lag phenomenon; if the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer, it is determined that there is no lag phenomenon.
[0127] Furthermore, if there is a lag phenomenon during the running of the fitting curve, the control line generation module 102 adjusts the starting point and the number of sampling points of the animation curve, and generates a control line according to the adjusted starting point and the number of sampling points of the animation curve, and then fits to obtain the fitting curve.
[0128] If the fitting curve runs without jamming, the interpolator generation module 104 generates an animation curve interpolator according to the curve dependency package.
[0129] It should be emphasized that to further ensure the privacy and security of the above animation curve interpolator, the above animation curve interpolator can also be stored in a node of a blockchain.
[0130] In an embodiment of the present invention, the animation curve interpolator runs the fitting curve by calling the curve dependency package.
[0131] This method uses a sampling method, which greatly reduces the working consumption of resources such as the CPU and reduces the occurrence of jamming phenomena.
[0132] The animation curve interpolator obtained in the embodiment of the present invention uses complete curve fitting to highly restore the animation designed by the designer. This method is simple to implement, has low requirements for hardware, is relatively easy to implement, and the curve can also be used to make relevant displacement animations as the path of the displacement animation. Its implementation steps are the same as those of the animation interpolator.
[0133] For example, for the animation curve interpolator set by animator A, which rotates from 0 degrees to 360 degrees in 3 seconds, then his normal animation progress is: the time ranges from 0 to 3 seconds, and the angle ranges from 0 to 360.
[0134] As Figure 3 shown, is a schematic structural diagram of an electronic device for implementing the method for generating an animation curve interpolator of the present invention.
[0135] The electronic device 1 may include a processor 10, a memory 11, and a bus, and may further include a computer program stored in the memory 11 and executable on the processor 10, such as an animation curve interpolator generation program 12.
[0136] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disc, etc. The memory 11 can be an internal storage unit of the electronic device 1 in some embodiments, such as the mobile hard disk of the electronic device 1. The memory 11 can also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 1. Further, the memory 11 can also include both the internal storage unit and the external storage device of the electronic device 1. The memory 11 can be used not only to store application software installed in the electronic device 1 and various types of data, such as the code of the animation curve interpolator generation program 12, etc., but also to temporarily store the data that has been output or will be output.
[0137] The processor 10 can be composed of integrated circuits in some embodiments. For example, it can be composed of a single packaged integrated circuit, or can be composed of multiple integrated circuits with the same or different functions packaged, including a combination of one or more Central Processing Units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, connecting all components of the entire electronic device through various interfaces and lines, and by running or executing programs or modules stored in the memory 11 (such as executing the animation curve interpolator generation program, etc.), and calling the data stored in the memory 11, to execute various functions of the electronic device 1 and process data.
[0138] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is set to realize the connection and communication between the memory 11 and at least one processor 10, etc.
[0139] Figure 3 Only the electronic device with components is shown. Those skilled in the art can understand that, Figure 3The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have a different component arrangement.
[0140] For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so as to implement functions such as charge management, discharge management, and power consumption management through the power management device. The power source may also include any components such as one or more DC or AC power sources, a recharge device, a power failure detection circuit, a power converter or inverter, and a power status indicator. The electronic device 1 may also include a variety of sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.
[0141] Furthermore, the electronic device 1 may further include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0142] Optionally, the electronic device 1 may further include a user interface. The user interface may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visual user interface.
[0143] It should be understood that the embodiments are only for illustration purposes and are not limited by this structure in the scope of the patent application.
[0144] The animation curve interpolator generation program 12 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which can be implemented when running in the processor 10:
[0145] Generate an animation curve editing coordinate system in the animation curve editor according to the animation curve generation instruction;
[0146] Determine the start position of the animation curve in the animation curve editing coordinate system according to the start point of the preset animation curve, generate a set of adjustment points through the start position of the animation curve and the preset number of sampling points, and generate one or more control lines according to the set of adjustment points;
[0147] Fit the control line to obtain a fitted curve, generate a source file according to the fitted curve, and import the source file into a pre-edited curve dependency package;
[0148] Run the curve dependency package, and determine whether there is a lag phenomenon during the running of the fitted curve according to a preset timer. If there is a lag phenomenon during the running of the fitted curve, adjust the starting point and the number of sampling points of the animation curve and then regenerate the fitted curve until there is no lag phenomenon during the running of the fitted curve, and generate an animation curve interpolator according to the curve dependency package.
[0149] Specifically, for the specific implementation method of the above instructions by the processor 10, reference can be made to Figure 1 the description of the relevant steps in the corresponding embodiment, which will not be elaborated here.
[0150] Furthermore, if the modules / units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory).
[0151] In several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0152] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0153] In addition, in each embodiment of the present invention, the various functional modules can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware, or in the form of hardware plus software functional modules.
[0154] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms.
[0155] Therefore, in all aspects, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Accordingly, all changes that fall within the meaning and scope of the equivalent elements of the claims are intended to be embraced within the present invention. Any reference signs in the claims should not be construed as limiting the claims concerned.
[0156] The blockchain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer, etc.
[0157] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices stated in the system claims can also be implemented by one unit or device through software or hardware. Words such as "second" are used to denote names and do not denote any particular order.
[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for generating an animation curve interpolator, characterized in that, the method includes: generating an animation curve editing coordinate system in an animation curve editor according to an animation curve generation instruction; determining the start position of the animation curve in the animation curve editing coordinate system according to the start point of the preset animation curve, generating a set of adjustment points through the start position of the animation curve and the preset number of sampling points, receiving two or more adjustment points arbitrarily selected from the set of adjustment points, and generating one or more virtual control lines between any two adjustment points; calculating the length of the fitting curve according to the dragging instruction of the control line by the user, calculating the curvature of the fitting curve according to the moving instruction of the two end points of the control line by the user, generating the fitting curve according to the length and the curvature, generating a source file according to the fitting curve, and importing the source file into a pre-edited curve dependency package; running the curve dependency package, judging whether there is a lag phenomenon during the running of the fitting curve according to a preset timer, if there is a lag phenomenon during the running of the fitting curve, adjusting the start point of the animation curve and the number of sampling points and then regenerating the fitting curve until there is no lag phenomenon during the running of the fitting curve, and generating an animation curve interpolator according to the curve dependency package; the judging whether there is a lag phenomenon during the running of the fitting curve according to a preset timer includes: while the fitting curve is running, measuring the actual running time of the fitting curve by using the preset timer; within a preset time, detecting whether the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer; if the expected running time of the fitting curve is not consistent with the actual running time of the fitting curve measured by the timer, judging that there is a lag phenomenon; if the expected running time of the fitting curve is consistent with the actual running time of the fitting curve measured by the timer, judging that there is no lag phenomenon.
2. The method for generating an animation curve interpolator according to claim 1, characterized in that, the generating a source file according to the fitting curve includes: compiling the fitting curve into binary data; exporting the binary data to obtain the source file.
3. The method for generating an animation curve interpolator according to claim 1, characterized in that, the animation curve interpolator is stored in a blockchain.
4. An animation curve interpolator generating device for implementing the method for generating an animation curve interpolator according to any one of claims 1-3, characterized in that, the device includes: a coordinate system generation module for generating an animation curve editing coordinate system in an animation curve editor according to an animation curve generation instruction; a control line generation module for determining the start position of the animation curve in the animation curve editing coordinate system according to the start point of the preset animation curve, generating a set of adjustment points through the start position of the animation curve and the preset number of sampling points, and generating one or more control lines according to the set of adjustment points; A curve fitting module, configured to fit the control line to obtain a fitted curve, generate a source file according to the fitted curve, and import the source file into a pre-edited curve dependency package; An interpolator generation module, configured to run the curve dependency package, determine whether there is a lag phenomenon during the running of the fitted curve according to a preset timer, if there is a lag phenomenon during the running of the fitted curve, adjust the starting point and the number of sampling points of the animation curve and then regenerate the fitted curve until there is no lag phenomenon during the running of the fitted curve, and generate an animation curve interpolator according to the curve dependency package.
5. 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the animation curve interpolator generation method according to any one of claims 1 to 3.
6. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, it implements the animation curve interpolator generation method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Animation interpolator construction method, animation playing method, animation interpolator construction device, animation playing device and electronic equipment
CN111596918A
Bezier Curves for Low Memory Embedded Graphics Systems
US20090141038A1