A method, device and computer-readable storage medium for realizing motion effects

By generating and rendering the configuration information of the animation vector, the problems of fewer dynamic efficiency types, high development costs and low performance in the existing technology are solved, and the rapid, simple and efficient generation of dynamic efficiency is achieved.

CN112750182BActive Publication Date: 2025-03-11TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911035923.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-10-29
Publication Date
2025-03-11
Estimated Expiration
2040-03-20

AI Technical Summary

Technical Problem

Among the existing particle dynamic effect implementation methods, there are fewer types of dynamic effect, high secondary development costs, and when using three-dimensional scene creation library to achieve dynamic effect, only a small number of functions are used, resulting in inconvenient maintenance and low performance, slow and complex methods of dynamic effect implementation.

Method used

By obtaining the set of image frames to be generated, determining the type and description information of the motion effect, generating the dynamic effect carrier configuration information of the image frame, including the dynamic effect carrier attribute information and rendering information, based on the dynamic effect carrier attribute information of the current image frame, the generated historical dynamic effect carrier in the historical image frame is updated to obtain the target dynamic effect carrier, and the target dynamic effect carrier is rendered in the historical image frame based on the dynamic effect rendering information, and the rendered image frame is obtained.

Benefits of technology

It realizes simple and fast generation of animation effects, provides multiple animation effects types, directly generates dynamic effect carrier configuration information and renders it, avoiding secondary development and improving reusability and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112750182B_ABST
    Figure CN112750182B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device and computer-readable storage medium for realizing motion effects. After acquiring an image frame set for generating a motion effect, the image frame set includes at least one image frame, the motion effect type for generating the motion effect and description information corresponding to the motion effect type are determined. Then, according to the motion effect type and the motion effect description information, motion effect carrier configuration information of the image frame is generated. The motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information. Then, based on the motion effect carrier attribute information of the current image frame, the historical motion effect carriers generated in the historical image frames are updated to obtain a target motion effect carrier corresponding to the current image frame. According to the motion effect rendering information, the target motion effect carrier is rendered in the historical image frame to obtain a rendered image frame. The current image frame is updated to the rendered image frame to obtain an image frame set with motion effects. The motion effect can be realized simply and quickly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular to a method and device for implementing a motion effect, and a computer-readable storage medium. Background Art

[0002] With the development of computer graphics technology, realistic game animations that are difficult to achieve with traditional rendering technology can be simulated using particle animations, such as common fire, explosion, water flow, etc. Existing particle animation implementation methods mainly use particle animation plug-ins (Particle.js) and 3D scene creation libraries (ThreeJS).

[0003] In the process of research and practice on the prior art, the inventors of the present invention found that for the particle animation implementation method, the types of particle animations implemented by the particle animation plug-in are relatively small, and the cost of secondary development is high. If a three-dimensional scene creation library is used to implement it, the particle animation implementation only uses a small part of the functions of the three-dimensional scene creation library, and secondary development is required, which makes maintenance inconvenient and performance is also affected. Therefore, the animation implementation speed is slow and the implementation method is complicated. Summary of the invention

[0004] The embodiments of the present invention provide a method, device and computer-readable storage medium for realizing a motion effect, which can realize the motion effect simply and quickly.

[0005] A method for realizing a dynamic effect, comprising:

[0006] Acquire an image frame set to generate a motion effect, wherein the image frame set includes at least one image frame;

[0007] Determine the type of the generated animation and the description information corresponding to the animation type;

[0008] Generate motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, wherein the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information;

[0009] Based on the attribute information of the motion effect carrier of the current image frame, the historical motion effect carrier generated in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame;

[0010] Rendering the target motion effect carrier in the historical image frame according to the motion effect rendering information to obtain a rendered image frame;

[0011] The current image frame is updated to the rendered image frame to obtain an image frame set with motion effects.

[0012] Accordingly, an embodiment of the present invention provides a text label generating device, comprising:

[0013] An acquisition unit, used to acquire an image frame set to generate a motion effect, wherein the image frame set includes at least one image frame;

[0014] A determination unit, used to determine the type of motion effect to be generated and description information corresponding to the motion effect type;

[0015] A generating unit, configured to generate motion effect carrier configuration information of an image frame according to the motion effect type and the motion effect description information, wherein the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information;

[0016] An updating unit, configured to update the historical motion effect carrier generated in the historical image frame based on the motion effect carrier attribute information of the current image frame, and obtain a target motion effect carrier corresponding to the current image frame;

[0017] A rendering unit, configured to render the target motion effect carrier in the historical image frame according to the motion effect rendering information to obtain a rendered image frame;

[0018] The obtaining unit is used to update the current image frame to the rendered image frame to obtain an image frame set with motion effects.

[0019] Optionally, in some embodiments, the updating unit can be specifically used to obtain historical motion effect carriers generated in the historical image frame, remove the expired first historical motion effect carriers from the historical motion effect carriers, obtain the non-expired second historical motion effect carriers, and update the second historical motion effect carriers in the historical image frame based on the motion effect carrier attribute information of the current image frame to obtain the target motion effect carrier corresponding to the current image frame.

[0020] Optionally, in some embodiments, the updating unit can be specifically used to extract a set of target motion effect carriers to be generated from the motion effect carrier configuration information of the current image frame, screen out a third motion effect carrier other than the second historical motion effect carrier from the set of target motion effect carriers to be generated, generate the third motion effect carrier, and merge the third motion effect carrier with the second historical motion effect carrier to obtain the target motion effect carrier corresponding to the current image frame.

[0021] Optionally, in some embodiments, the rendering unit can be specifically used to extract motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information, generate position information of the target motion effect carrier in the current image frame according to the motion parameter information, and render the target motion effect carrier in the historical image frame according to the position information and the rendering parameter information to obtain a rendered image frame.

[0022] Optionally, in some embodiments, the rendering unit can be specifically used to obtain a motion area of ​​the target motion effect carrier in the current image frame based on the rendering parameter information, and calculate the position information of the target motion effect carrier in the current image frame in the motion area according to the speed, acceleration and motion time of the target motion effect carrier.

[0023] Optionally, in some embodiments, the rendering unit can be specifically used to clear the content of the historical image frame, use the historical image frame after the content is cleared as a canvas, add the target motion effect carrier on the canvas to obtain a canvas to be rendered, and render the target motion effect carrier on the canvas to be rendered according to the position information and the rendering parameter information to obtain a rendered image frame.

[0024] Optionally, in some embodiments, the rendering unit can be specifically used to move the target motion effect carrier to a corresponding position on the canvas to be rendered according to the position information; based on the rendering parameter information, render the moved target motion effect carrier on the canvas to be rendered to obtain a rendered image frame.

[0025] Optionally, in some embodiments, the generating unit can be specifically used to filter basic motion effect information corresponding to the motion effect type in preset basic motion effect information, generate initial motion effect configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information, and divide the initial motion effect configuration information according to the number of frames of the image frame set to obtain the motion effect carrier configuration information corresponding to each image frame.

[0026] In addition, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the motion effect implementation method provided by the embodiment of the present invention.

[0027] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps in any one of the motion effect implementation methods provided in the embodiment of the present invention.

[0028] An embodiment of the present invention obtains an image frame set for generating a motion effect, the image frame set includes at least one image frame, determines the motion effect type for generating the motion effect and the description information corresponding to the motion effect type, and then generates the motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, the motion effect carrier configuration information includes the motion effect carrier attribute information and the motion effect rendering information, and then, based on the motion effect carrier attribute information of the current image frame, updates the historical motion effect carrier generated in the historical image frame to obtain the target motion effect carrier corresponding to the current image frame, renders the target motion effect carrier in the historical image frame according to the motion effect rendering information to obtain the rendered image frame, updates the current image frame to the rendered image frame, and obtains the image frame set with the motion effect; since the scheme can provide a variety of motion effect types, the motion effect carrier configuration information is directly generated according to the motion effect type and the description information, and the motion effect can be realized by rendering the image frame according to the motion effect carrier configuration information, which is simple, fast, and highly reusable, and does not require secondary development, so the motion effect can be realized simply and quickly. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0030] Figure 1 Schematic diagram of a scene of a method for realizing a dynamic effect provided by an embodiment of the present invention;

[0031] Figure 2 It is a flowchart of a method for realizing a dynamic effect provided by an embodiment of the present invention;

[0032] Figure 3 is a schematic diagram of a dynamic effect implementation page provided by an embodiment of the present invention;

[0033] Figure 4 is a static schematic diagram of an image frame for generating a motion effect provided by an embodiment of the present invention;

[0034] Figure 5 is another flowchart of the method for realizing the dynamic effect provided by an embodiment of the present invention;

[0035] Figure 6 is a structural schematic diagram of a device for realizing a dynamic effect provided by an embodiment of the present invention;

[0036] Figure 7 is a structural schematic diagram of a generation unit of a motion effect realization device provided by an embodiment of the present invention;

[0037] Figure 8It is a structural schematic diagram of an updating unit of a motion effect realization device provided by an embodiment of the present invention;

[0038] Fig. 9 It is a structural schematic diagram of a rendering unit of a motion effect realization device provided by an embodiment of the present invention;

[0039] Fig.10 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0041] The embodiment of the present invention provides a method, device and computer-readable storage medium for realizing a dynamic effect, wherein the dynamic effect realizing device can be integrated in an electronic device, and the electronic device can be a server, a terminal or other device.

[0042] The so-called motion effect, as the name implies, can be a dynamic effect, for example, a flickering flame in the picture. Usually, the motion effect needs to be realized through a carrier, and the motion effect is realized by the continuous change of the motion effect carrier in the picture. Therefore, the motion effect is common in videos or dynamic pictures. The motion effect realization method provided in the embodiment of the present application can realize the motion effect required by the user in a video or dynamic picture composed of multiple image frames provided by the user.

[0043] For example, see Figure 1 Taking the integration of a motion effect realization device in an electronic device as an example, an image frame set to generate a motion effect is obtained, the image frame set includes at least one image frame, the motion effect type of the generated motion effect and the description information corresponding to the motion effect type are determined, and according to the motion effect type and the motion effect description information, the motion effect carrier configuration information of the image frame is generated, the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information, based on the motion effect carrier attribute information of the current image frame, the historical motion effect carrier generated in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame, according to the motion effect rendering information, the target motion effect carrier is rendered in the historical image frame to obtain the rendered image frame, the current image frame is updated to the rendered image frame, and the image frame set with the motion effect is obtained.

[0044] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0045] This embodiment will be described from the perspective of a motion effect implementation device, which can be specifically integrated into an electronic device, which can be a server or a terminal. Among them, the terminal can include a tablet computer, a laptop computer, and a personal computer (PC) and other devices.

[0046] A method for realizing a motion effect comprises: obtaining an image frame set for generating a motion effect, the image frame set comprising at least one image frame, determining a motion effect type for generating a motion effect and description information corresponding to the motion effect type, generating motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, the motion effect carrier configuration information comprising motion effect carrier attribute information and motion effect rendering information, updating historical motion effect carriers generated in historical image frames based on the motion effect carrier attribute information of a current image frame to obtain a target motion effect carrier corresponding to the current image frame, rendering the target motion effect carrier in the historical image frame according to the motion effect rendering information to obtain a rendered image frame, updating the current image frame to the rendered image frame to obtain an image frame set with the motion effect.

[0047] like Figure 2 As shown, the specific process of the dynamic effect implementation method is as follows:

[0048] 101. Obtain an image frame set for generating a motion effect, where the image frame set includes at least one image frame.

[0049] Among them, the image frame set can be a set of image frames that constitute a video or a dynamic picture, and the image frame set includes at least one image frame. The image frame set can be an image frame directly uploaded by a user, or it can be an image or video uploaded by a user divided into one or more image frames.

[0050] For example, there are many ways to obtain the image frame set to be generated for the motion effect. For example, you can directly obtain one or more image frames uploaded or sent by the user, and combine the uploaded or sent image frames into an image frame set. You can also divide the video uploaded or sent by the user into multiple image frames at a certain time interval, and combine the image frames into an image frame set. You can also make the images uploaded or sent by the user into one or more image frames at a certain time interval. For example, the user uploads a background image and needs to realize motion effects on the background image. You can generate one or more image frames with the background image as the base, and the backgrounds of these image frames are all the background image, and these image frames are combined into an image frame set.

[0051] 102. Determine the type of the generated animation and the description information corresponding to the animation type.

[0052] Among them, the animation types can include abstract visual animations such as fire, explosion, smoke, water flow, sparks, fallen leaves, clouds, fog, snow, dust, meteor trails, gravity, etc., and two or more animations can be combined to form a new animation based on user needs.

[0053] The description information may include the starting position, speed, life cycle and direction of movement of the animation. For example, taking fire as an example, the description information may include the generation of a flame at a specific position in the image frame, the speed and direction of the flame's swinging up and down and left and right, and the time the flame exists in the image frame or dynamic picture.

[0054] For example, the type of animation to be generated and the description information corresponding to the animation type can be determined based on the animation type selected by the user on the animation implementation page and the description information corresponding to the animation type. Figure 3 As shown, the description information of the desired dynamic effect can also be input in the description information of the dynamic effect realization page, and the dynamic effect type and corresponding description information input or selected by the user through the dynamic effect realization page are received. The dynamic effect type of the dynamic effect instance input by the user can also be identified. For example, the user can upload an image or video containing dynamic effects obtained from the Internet or database to the dynamic effect realization device, and the image or video instance uploaded by the user containing unknown or known dynamic effect types is identified. The type of dynamic effect contained in the image or video instance and the description information corresponding to the dynamic effect type are identified. If the user replaces the description information in the image or video instance, the user can also enter new description information through the dynamic effect realization page. When the dynamic effect type of the image or video example uploaded by the user cannot be identified, a prompt message can also be generated to prompt the user to re-upload other image or video examples. When the dynamic effect type of the image or video example is identified, if there is no corresponding dynamic effect type in the dynamic effect realization device, a dynamic effect type similar to it can be recommended for the user to re-select.

[0055] 103. Generate motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information. The motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information.

[0056] Among them, the motion effect carrier configuration information can be the attribute information and motion effect rendering information of the motion effect carrier in the image frame. For example, taking the motion effect carrier as particles, the motion effect carrier configuration information can be the attribute information such as the number, type, and life cycle of the particles in the image. It can also be the relevant information that needs to be rendered for the particles in the image frame. For example, when the motion effect is smoke, the information that needs to be rendered may be information such as the degree of brightness change, the degree of blur change, and the density of particle existence.

[0057] The so-called dynamic effect carrier can be a carrier that displays dynamic effects in images or videos, for example, it can be a particle, and the shape of the particle can be square, round or flame-shaped, or it can be a custom image uploaded by the user, for example, the user can draw an image in the shape of a house and use the image as a particle. The dynamic effect in the image or video can be achieved through the change of particles.

[0058] For example, the motion effect information corresponding to the motion effect type is filtered out from the preset basic motion effect information, and the initial motion effect carrier configuration information corresponding to the image frame set is generated according to the basic motion effect information and the motion effect description information. For example, the corresponding basic motion effect information is selected according to the motion effect type. The basic motion effect information may be the basic parameter information corresponding to the motion effect type, for example, it may be basic information such as the type range and quantity range of the motion effect carriers corresponding to the motion effect type. According to the motion effect description information such as the motion effect starting point and speed, the initial motion effect carrier configuration information corresponding to the image frame set is selected within a range, for example, the number and type of motion effect carriers required for the entire image frame set, as well as the overall rendering parameters. The initial motion effect configuration information is segmented to obtain the motion effect carrier configuration information corresponding to each image frame. For example, there are three image frames in the image frame set. The initial motion effect carrier information is segmented into the motion effect carrier configuration information of the three image frames. The segmented motion effect carrier configuration information is matched with each image frame in the image frame set to obtain the motion effect carrier configuration information corresponding to each image frame. For example, it is possible to match multiple types of motion effect carriers required for each frame, the number of each type of motion effect carrier required, and the speed and life cycle of each motion effect carrier.

[0059] 104. Based on the attribute information of the motion effect carrier of the current image frame, the historical motion effect carrier generated in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame.

[0060] The attribute information of the animation carrier may include information such as the number, type and life cycle of the animation carrier.

[0061] Among them, the historical animation carrier can be an animation carrier generated in the historical image frame, that is, an animation carrier generated in the rendered image frame. For example, the current image frame is the second frame, and the historical image frame can be the first frame. The first frame is rendered to obtain the rendered first frame. At this time, the rendered first frame contains the generated animation carrier, and the second frame is updated based on the rendered first frame.

[0062] For example, you can use the function requestAnimationFrame provided by the browser to call the callback function (call back) after each frame is rendered through JavaScript (a translated language) to parse the animation carrier configuration information in the historical image frame to obtain the historical animation carrier generated in the historical image frame. You can also call the rendering information to render the animation carrier in the current image frame terminal. The specific method is as follows:

[0063]

[0064] (1) Obtaining the historical motion effect carrier generated in the historical image frame

[0065] For example, the animation carrier configuration information of the historical image frame can be read by calling the callback function, and the historical animation carrier attribute information can be extracted from the animation carrier configuration information of the historical image frame to obtain the historical animation carrier that has been generated in the historical image frame. The generated historical animation carrier can also be directly identified from the historical image frame.

[0066] (2) Remove the expired first historical animation carrier from the historical animation carriers to obtain the unexpired second historical animation carrier

[0067] For example, the life cycle of the generated historical animation carrier is detected, and the detected expired first historical animation carrier is removed from the generated historical animation carrier to obtain the unexpired second historical animation carrier. For example, the pre-set life cycle of each historical animation carrier is obtained from the attribute information of the historical animation carrier. For example, the historical image frame is the first image frame, and the pre-set life cycle of the historical animation carrier A in the first image frame is 2 frames. Assuming that the current image frame is the second frame, the historical animation carrier A is not expired at this time. Assuming that the current image frame is the third frame, the historical animation carrier A is expired at this time. If the pre-set life cycle of the historical animation carrier A in the first image frame is 4 seconds, and the preset time interval of each frame is 2 seconds, assuming that the current image frame is the second frame, the historical animation carrier A is not expired at this time. Assuming that the current image frame is the third frame, the historical animation carrier A is expired at this time. With reference to the above detection method, the life cycle of all historical motion effect carriers in the historical picture frame is detected, and the detected expired first historical motion effect carrier is removed from the generated historical motion effect carrier to obtain the non-expired second historical motion effect carrier.

[0068] (3) Based on the attribute information of the motion effect carrier of the current image frame, the second historical motion effect carrier in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame

[0069] Among them, the target motion effect carrier can be the motion effect carrier required for rendering the current image frame. For example, if motion effect carriers A, B and C are required for rendering the current image frame, then motion effect carriers A, B and C are the target motion effect carriers.

[0070] For example, a target animation carrier set to be generated is extracted from the animation carrier attribute information of the current image frame, and a third animation carrier other than the second historical animation carrier is selected from the target animation carrier set to be generated. For example, the target animation carrier set to be generated includes 10 A-type animation carriers, 5 B-type animation carriers, and 6 C-type animation carriers, while the second historical animation carrier includes 7 A-type animation carriers and 5 B-type animation carriers. At this time, the ungenerated animation carriers required for rendering the current image frame can be 3 A-type animation carriers and 6 C-type animation carriers. These 3 A-type animation carriers and 6 C-type animation carriers are used as the third generated animation carrier. The third animation carrier is generated, and the generated third animation carrier is merged with the second historical animation carrier. There are many ways to merge. The two animation carriers can be combined, or the animation carriers can be formed into a set. Finally, the combined animation carrier is used as the target animation carrier corresponding to the current image frame.

[0071] Among them, it should be emphasized here that the target animation carrier set to be generated can be understood as a virtual list stored in the animation carrier configuration information of the current image frame. The list is the type and quantity of animation carriers that need to exist or be generated in the current image frame. For example, the current image frame requires 3 type A animation carriers and 5 type B animation carriers. At this time, the 3 type A animation carriers and 5 type B animation carriers can be regarded as a set, and the third animation carrier that needs to be generated in the current image frame can be judged according to the set (list).

[0072] It should also be emphasized that the target motion effect carrier corresponding to the current image frame has been generated and stored in the local database. When the current image frame needs to be rendered, the generated target motion effect carrier will be called out and rendered according to the corresponding rendering parameters.

[0073] 105. Render the target motion effect carrier in the historical image frame according to the motion effect rendering information to obtain a rendered image frame.

[0074] The rendered image frames may be image frames required for generating motion effects. The rendered image frames already contain rendered motion effect carriers. The motion effects can be generated after all images in the image frame set are rendered.

[0075] (1) Extracting the motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information

[0076] The motion parameter information may include information such as the speed variation range, position random range, acceleration random range, randomly generated position, randomly generated acceleration, life cycle, and address of the custom motion effect carrier.

[0077] The rendering parameter information may be information on converting the transparency transformation, scaling transformation, friction and / or gravity of the motion effect carrier into specific numerical configurations, such as the range or value of brightness and blur in the transparency transformation.

[0078] For example, the motion parameter information and rendering parameter information of the target animation carrier in the current frame can be extracted from the animation rendering information by calling the callback function through requestAnimationFrame, which can be specifically as follows:

[0079]

[0080]

[0081] (2) Generate the position information of the target motion effect carrier in the current image frame based on the motion parameter information

[0082] The position information may be the initial position of the target motion effect carrier in the current image frame, or the final position, or a fixed position or a random position range.

[0083] For example, based on the rendering parameter information, the motion area of ​​the target motion effect carrier in the current image frame is obtained, and the position information of the target motion effect carrier in the current image frame is calculated in the motion area according to the speed, acceleration and motion time of the target carrier in the motion parameter information. For example, taking the lower right vertex of the current image frame as the coordinate origin, the motion area is the upper right coordinate range of 100mm×100mm. After obtaining the initial motion position, the position information of the target motion effect carrier in this range can be calculated according to the speed, acceleration and motion time.

[0084] Optionally, in the process of calculating the position information of the target animation carrier, some C++ (a computer programming language) calculation modules can be built into the browser, and WASM can be used for expansion to calculate the position information, which can improve the calculation performance and realize complex animation.

[0085] (3) Render the target motion effect carrier in the historical image frame according to the position information and rendering parameter information to obtain the rendered image frame

[0086] For example, the content of the historical picture frame is cleared, the historical motion effect carriers generated in the historical picture frame are removed, and the historical picture frame after the content is cleared is used as a canvas, and the target motion effect carrier is added to the canvas to obtain a canvas to be rendered. For example, the pre-generated target motion effect carrier is added to the area of ​​the canvas, but the target motion effect carrier has not been rendered on the canvas at this time. When adding, the target motion effect carrier is only stored in the area of ​​the canvas, and the target motion effect carrier is not drawn at the position corresponding to the target motion effect carrier on the canvas. According to the position information, the target motion effect carrier is moved to the corresponding position on the canvas to be rendered. For example, the position information can include a fixed point position and a range position. Taking a fixed point position as an example, it is mainly moved from a fixed position to another fixed position. It can also be understood as launching the motion effect carrier from one fixed position to another fixed position, and it can also be launched from a fixed position to a range. As for the moving process, it can be understood that the fixed-position animation carrier can set the initial position of the generated target animation carrier to a fixed position in the configuration information, and the range-position animation carrier can set the initial position of the generated target animation carrier to a value within a random range in the configuration information.

[0087] Based on the rendering parameter information, the moved target animation carrier is rendered on the canvas to be rendered to obtain the rendered image frame. For example, the attribute information of the target animation carrier provides the initial state for the animation carrier itself, such as the initial velocity value, acceleration value, initial position and / or initial brightness. The rendering parameter information mainly provides continuous changes in the life cycle of the target animation carrier. The rendering process can also be understood as calling a function to draw the target animation carrier and its continuous changes in its life cycle in the canvas to be rendered. Taking the abstract class animation as an example, the apply function is used to treat the rendering information of the animation carrier as the input parameter to directly modify the attributes of the target animation carrier in the current frame. The specific details are as follows:

[0088]

[0089] Take the gravity effect as an example, as follows:

[0090]

[0091] According to the rendering parameter information and the modified properties of the target motion effect carrier, the target motion effect carrier in the current image frame is rendered. The rendering method can be to draw each target motion effect carrier in the current image frame by calling the drawing function (draw) corresponding to the target motion effect carrier. For example, when realizing the rain effect, after drawing the raindrops composed of one or more target motion effect carriers, the blur and brightness of the raindrops can be drawn. The drawing process can also be understood as the rendering process. The rendering method can also render the target motion effect carrier through the 3D drawing protocol (Web Graphics Library, WebGL). Using WebGL can achieve cooler motion effects and higher performance.

[0092] 106. Update the current image frame to the rendered image frame to obtain an image frame set with dynamic effects.

[0093] For example, the current image frame in the image frame set is updated to a rendered image frame. After the update is completed, the update of the next image frame begins. For example, if the image frame set contains three image frames, and the current image frame is the second image frame in the image frame set, then after the second image frame is updated to the rendered image frame, the third image frame continues to be updated. The update process is the same as the update process of the second image frame. Based on the attribute information of the motion effect carrier of the third image frame, the historical motion effect carrier produced in the second image frame is updated to obtain the target motion effect carrier corresponding to the third image frame. Then, according to the motion effect rendering information of the third image frame, the target motion effect carrier is rendered in the second image frame to obtain the rendered image frame. The third image frame is updated to the rendered image frame. At this time, the update of all image frames in the image frame set is completed, and an image frame set with motion effects is obtained. When there are more than three image frames in the image frame set, the image frames after the third image frame are updated in accordance with the update method of the second and third image frames until all image frames in the image frame set are updated to obtain an image frame set with motion effects. By using a web page to play all the image frames in the image frame set, the dynamic effect can be displayed in the image frame set, such as Figure 4 shown.

[0094] It should be noted here that when there is only one image frame in the image frame set or the current image frame is the first image frame, the target motion effect carrier is directly generated on the canvas generated by Canvas according to the target motion effect carrier attribute information and motion effect rendering information in the motion effect configuration information corresponding to the image frame, and the target motion effect carrier is rendered according to the rendering parameter information to obtain the image frame with generated motion effect.

[0095] From the above, it can be seen that after the embodiment of the present invention obtains the image frame set for generating the motion effect, the image frame set includes at least one image frame, determines the motion effect type of the generated motion effect and the description information corresponding to the motion effect type, and then generates the motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, the motion effect carrier configuration information includes the motion effect carrier attribute information and the motion effect rendering information, and then, based on the motion effect carrier attribute information of the current image frame, the historical motion effect carrier generated in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame, and according to the motion effect rendering information, the target motion effect carrier is rendered in the historical image frame to obtain the rendered image frame, and the current image frame is updated to the rendered image frame to obtain the image frame set with the motion effect; since the scheme can provide a variety of motion effect types, the motion effect carrier configuration information is directly generated according to the motion effect type and the description information, and the motion effect can be realized by rendering the image frame according to the motion effect carrier configuration information, which is simple, fast, and highly reusable, and does not require secondary development, so the motion effect can be realized simply and quickly.

[0096] According to the method described in the above embodiment, the following is further described in detail with examples.

[0097] In this embodiment, the device for realizing the motion effect is specifically integrated into an electronic device, and the motion effect carrier is a particle.

[0098] like Figure 5 As shown in the figure, a method for realizing dynamic effects is shown in the figure. The specific process is as follows:

[0099] 201. An electronic device obtains an image frame set for generating a motion effect, where the image frame set includes at least one image frame.

[0100] For example, the electronic device can directly obtain one or more image frames uploaded or sent by the user, and combine the uploaded or sent image frames into an image frame set. It can also divide the video uploaded or sent by the user into multiple image frames at a certain time interval, and combine the image frames into an image frame set. It can also make the images uploaded or sent by the user into one or more image frames at a certain time interval. For example, the user uploads a background image and needs to implement animation on the background image. One or more image frames can be generated with the background image as the base, and the backgrounds of these image frames are all the background image, and these image frames are combined into an image frame set.

[0101] 202. The electronic device determines a motion effect type and description information corresponding to the motion effect type to generate the motion effect.

[0102] For example, the electronic device can determine the type of animation to be generated and the description information corresponding to the animation type based on the animation type selected by the user on the animation implementation page and the description information corresponding to the animation type. Figure 3 As shown, the description information of the desired dynamic effect can also be input in the description information of the dynamic effect realization page, and the dynamic effect type and corresponding description information input or selected by the user through the dynamic effect realization page are received. The dynamic effect type of the dynamic effect instance input by the user can also be identified. For example, the user can upload an image or video containing dynamic effects obtained from the Internet or database to the dynamic effect realization device, and the image or video instance uploaded by the user containing unknown or known dynamic effect types is identified. The type of dynamic effect contained in the image or video instance and the description information corresponding to the dynamic effect type are identified. If the user replaces the description information in the image or video instance, the user can also enter new description information through the dynamic effect realization page. When the dynamic effect type of the image or video example uploaded by the user cannot be identified, a prompt message can also be generated to prompt the user to re-upload other image or video examples. When the dynamic effect type of the image or video example is identified, if there is no corresponding dynamic effect type in the dynamic effect realization device, a dynamic effect type similar to it can be recommended for the user to re-select.

[0103] 203. The electronic device generates particle configuration information of the image frame according to the motion effect type and the motion effect description information, where the particle configuration information includes particle attribute information and motion effect rendering information.

[0104] For example, the electronic device selects the motion effect information corresponding to the motion effect type in the preset basic motion effect information, and generates the initial particle configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information. For example, the corresponding basic motion effect information is selected according to the motion effect type. The basic motion effect information can be the basic parameter information corresponding to the motion effect type, for example, the basic information such as the type range and quantity range of particles corresponding to the motion effect type. According to the motion effect description information such as the motion effect starting point and speed, the initial particle configuration information corresponding to the image frame set is selected within a range, for example, the number and type of particles required for the entire image frame set, and the overall rendering parameters. The initial motion effect configuration information is segmented to obtain the particle configuration information corresponding to each image frame. For example, there are three image frames in the image frame set, and the initial particle information is segmented into the particle configuration information of the three image frames. The segmented particle configuration information is matched with each image frame in the image frame set to obtain the particle configuration information corresponding to each image frame. For example, each frame needs multiple types of particles, the number of particles of each type, and the speed and life cycle of each particle.

[0105] 204. The electronic device obtains the historical particles generated in the historical image frame.

[0106] For example, the function requestAnimationFrame provided by the browser can be used to call the callback function (call back) through JavaScript (a translated language) after each frame is rendered to parse the particle configuration information in the historical image frame to obtain the historical particles generated in the historical image frame. The specific method is as follows:

[0107]

[0108] The particle configuration information of the historical image frame is read by calling the callback function, and the historical particle attribute information is extracted from the particle configuration information of the historical image frame, so as to obtain the historical particles generated in the historical image frame, and the historical particles that have been generated can also be directly identified from the historical image frame.

[0109] 205. The electronic device removes the expired first historical particles from the historical particles to obtain the unexpired second historical particles.

[0110] For example, the electronic device obtains the preset life cycle of each historical particle from the historical particle attribute information. For example, the historical image frame is the first image frame, and the preset life cycle of the historical particle A in the first image frame is 2 frames. If the current image frame is the second frame, then the historical particle A has not expired at this time. If the current image frame is the third frame, then the historical particle A has expired at this time. If the preset life cycle of the historical particle A in the first image frame is 4 seconds, and the preset time interval of each frame is 2 seconds, if the current image frame is the second frame, then the historical particle A has not expired at this time. If the current image frame is the third frame, then the historical particle A has expired at this time. Referring to the above detection method, the life cycle of all historical particles in the historical picture frame is detected, and the detected expired first historical particles are removed from the generated historical particles to obtain the unexpired second historical particles.

[0111] 206. The electronic device updates the second historical particles in the historical image frame based on the particle attribute information of the current image frame to obtain the target particles corresponding to the current image frame.

[0112] For example, the electronic device extracts the target particle set to be generated from the particle attribute information of the current image frame, and selects the third particle other than the second historical particle from the target particle set to be generated. For example, the target particle set to be generated includes 10 type A particles, 5 type B particles, and 6 type C particles, and the second historical particles include 7 type A particles and 5 type B particles. At this time, the ungenerated particles required for rendering the current image frame can be 3 type A particles and 6 type C particles, and these 3 type A particles and 6 type C particles are used as the third generated particles. Generate the third particle, and fuse the generated third particle with the second historical particle. There are many ways to fuse. The two particles can be combined, or the dynamic particles can be formed into a set. Finally, the combined particles are used as the target particles corresponding to the current image frame.

[0113] 207. The electronic device renders the target particles in the historical image frame according to the motion rendering information to obtain a rendered image frame.

[0114] (1) The electronic device extracts the motion parameter information and rendering parameter information of the target particles from the dynamic rendering information

[0115] For example, the electronic device can extract the motion parameter information and rendering parameter information of the target particles in the current frame from the animation rendering information by calling the callback function through requestAnimationFrame, which can be specifically as follows:

[0116]

[0117]

[0118] (2) The electronic device generates the position information of the target particle in the current image frame based on the motion parameter information

[0119] For example, based on the rendering parameter information, the electronic device obtains the motion area of ​​the target motion effect carrier in the current image frame, and calculates the position information of the target motion effect carrier in the motion area according to the speed, acceleration and motion time of the target carrier in the motion parameter information. For example, taking the lower right vertex of the current image frame as the coordinate origin, the motion area is the upper right coordinate range of 100mm×100mm. After obtaining the initial motion position, the position information of the target motion effect carrier in this range can be calculated according to the speed, acceleration and motion time.

[0120] Optionally, in the process of calculating the position information of the target animation carrier, some C++ (a computer programming language) calculation modules can be built into the browser, and WASM can be used for expansion to calculate the position information, which can improve the computing performance and realize complex animations.

[0121] (3) The electronic device renders the target particles in the historical image frame according to the position information and rendering parameter information to obtain the rendered image frame.

[0122] For example, the electronic device clears the content of the historical picture frame, removes the historical particles generated in the historical picture frame, uses the historical picture frame after the content is cleared as a canvas, adds the target particles to the canvas, and obtains the canvas to be rendered. For example, the pre-generated target particles are added to the area of ​​the canvas, but the target particles are not rendered on the canvas at this time. When adding, the target particles are only stored in the area of ​​the canvas, and the target particles are not drawn at the position corresponding to the target particles on the canvas. According to the position information, the target particles are moved to the corresponding position on the canvas to be rendered. For example, the position information can include a fixed point position and a range position. Taking the fixed point position as an example, it is mainly moved from a fixed position to another fixed position. It can also be understood as emitting particles from one fixed position to another fixed position, and it can also be emitted from a fixed position to a certain range. As for the moving process, it can be understood that the particles at the fixed position can set the initial position of the generated moving target particles as a fixed position in the configuration information, and the particles at the range position can set the initial position of the generated target particles as a value within a random range in the configuration information.

[0123] Based on the rendering parameter information, the moved target particles are rendered on the canvas to be rendered to obtain the rendered image frame. For example, the initial state of the particle itself is provided in the attribute information of the target particle, such as the initial velocity value, acceleration value, initial position and / or initial brightness. The rendering parameter information mainly provides continuous changes in the life cycle of the target particle. The rendering process can also be understood as calling a function to draw the target particle and its continuous changes in its life cycle in the canvas to be rendered. Taking the abstract class of dynamic effects as an example, the apply function is used to treat the particle rendering information as the input parameter to directly modify the attributes of the target particle in the current frame. The specific details are as follows:

[0124]

[0125] Take the gravity effect as an example, as follows:

[0126]

[0127]

[0128] According to the rendering parameter information and the modified properties of the target particles, the target particles in the current image frame are rendered. The rendering method can be to draw each target particle in the current image frame by calling the drawing function (draw) corresponding to the target particle. For example, when realizing the dynamic effect of rain, after drawing the raindrops composed of one or more target particles, the blur and brightness of the raindrops can be drawn. The drawing process can also be understood as the rendering process. The rendering method can also render the target particles through the 3D drawing protocol (Web Graphics Library, WebGL). Using WebGL can achieve cooler dynamic effects and higher performance.

[0129] 208. The electronic device updates the current image frame to a rendered image frame to obtain an image frame set with motion effects.

[0130] For example, the electronic device updates the current image frame in the image frame set to a rendered image frame. After the update is completed, the next image frame is updated. For example, if the image frame set contains three image frames, and the current image frame is the second image frame in the image frame set, then after the second image frame is updated to the rendered image frame, the third image frame is continuously updated. The update process is the same as the update process of the second image frame. Based on the particle attribute information of the third image frame, the historical particles produced in the second image frame are updated to obtain the target particles corresponding to the third image frame. Then, according to the dynamic effect rendering information of the third image frame, the target particles are rendered in the second image frame to obtain the rendered image frame. The third image frame is updated to the rendered image frame. At this time, the update of all image frames in the image frame set is completed, and an image frame set with dynamic effects is obtained. When there are more than three image frames in the image frame set, the image frames after the third image frame are updated in accordance with the update method of the second and third image frames until all image frames in the image frame set are updated to obtain an image frame set with dynamic effects. By using a web page to play all the image frames in the image frame set, dynamic effects can be displayed in the image frame set, such as Figure 4 shown.

[0131] From the above, it can be seen that after the electronic device of the embodiment of the present invention obtains the image frame set for generating the motion effect, the image frame set includes at least one image frame, determines the motion effect type for generating the motion effect and the description information corresponding to the motion effect type, and then generates the particle configuration information of the image frame according to the motion effect type and the motion effect description information, the particle configuration information includes particle attribute information and motion effect rendering information, and then, based on the particle attribute information of the current image frame, the historical particles generated in the historical image frame are updated to obtain the target particles corresponding to the current image frame, and according to the motion effect rendering information, the target particles are rendered in the historical image frame to obtain the rendered image frame, and the current image frame is updated to the rendered image frame to obtain the image frame set with the motion effect; since the scheme can provide a variety of motion effect types, the particle configuration information is directly generated according to the motion effect type and the description information, and the motion effect can be realized by rendering the image frame according to the particle configuration information. It is simple, fast, and highly reusable, and does not require secondary development. Therefore, the motion effect can be realized simply and quickly.

[0132] In order to better implement the above method, an embodiment of the present invention also provides a motion effect implementation device, which can be integrated into an electronic device, such as a server or terminal, and the terminal may include a tablet computer, a laptop computer and / or a personal computer.

[0133] For example, Figure 6 As shown, the motion effect implementation device may include an acquisition unit 301, a determination unit 302, a generation unit 303, an update unit 304, a rendering unit 305 and a obtaining unit 306, as follows:

[0134] (1) Acquisition unit 301;

[0135] The acquisition unit 301 is used to acquire an image frame set for generating a motion effect, where the image frame set includes at least one image frame.

[0136] For example, the acquisition unit 301 can be specifically used to directly acquire one or more image frames uploaded or sent by a user, and combine the uploaded or sent image frames into an image frame set. It can also divide the video uploaded or sent by the user into multiple image frames at a certain time interval, and combine the image frames into an image frame set. It can also make the images uploaded or sent by the user into one or more image frames at a certain time interval, and combine the image frames into an image frame set.

[0137] (2) determining unit 302;

[0138] The determination unit 302 is used to determine the type of the generated animation and the description information corresponding to the animation type.

[0139] For example, the determination unit 302 may be specifically configured to determine the type of the animation to be generated and the description information corresponding to the animation type according to the animation type and the description information corresponding to the animation type selected by the user on the animation realization page.

[0140] (3) generating unit 303;

[0141] The generating unit 303 is specifically configured to generate motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, wherein the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information.

[0142] The generating unit 303 may further include a screening subunit 3031, a first generating subunit 3032 and a segmenting unit 3033. Figure 7 As shown, the details are as follows:

[0143] The screening subunit 3031 is used to screen the basic motion effect information corresponding to the motion effect type in the preset basic motion effect information;

[0144] The first generating subunit 3032 is used to generate initial motion effect configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information;

[0145] The segmentation unit 3033 is used to segment the initial motion effect configuration information according to the number of frames in the image frame set to obtain the motion effect carrier configuration information corresponding to each image frame.

[0146] For example, the screening sub-unit 3031 screens basic motion effect information corresponding to the motion effect type in the preset basic motion effect information, the first generating sub-unit 3032 generates initial motion effect configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information, and the segmentation sub-unit 3033 segments the initial motion effect configuration information according to the number of frames in the image frame set to obtain the motion effect carrier configuration information corresponding to each image frame.

[0147] (4) Update unit 304;

[0148] The updating unit 304 is used to update the historical motion effect carrier generated in the historical image frame based on the motion effect carrier attribute information of the current image frame to obtain the target motion effect carrier corresponding to the current image frame.

[0149] The updating unit 304 may further include an acquiring subunit 3041, a removing subunit 3042 and an updating subunit 3043. Figure 8 As shown, the details are as follows:

[0150] The acquisition subunit 3041 is used to acquire the historical motion effect carrier generated in the historical image frame;

[0151] The removal subunit 3042 is used to remove the expired first historical animation carrier from the historical animation carriers to obtain the non-expired second historical animation carrier;

[0152] The updating subunit 3043 is used to update the second historical motion effect carrier in the historical image frame based on the motion effect carrier attribute information of the current image frame to obtain the target motion effect carrier corresponding to the current image frame.

[0153] For example, the acquisition subunit 3041 acquires the historical motion effect carriers generated in the historical image frame, the removal subunit 3042 removes the expired first historical motion effect carriers in the historical motion effect carriers to obtain the non-expired second historical motion effect carriers, and the update subunit 3043 updates the second historical motion effect carrier in the historical image frame based on the motion effect carrier attribute information of the current image frame to obtain the target motion effect carrier corresponding to the current image frame.

[0154] (5) rendering unit 305;

[0155] The rendering unit 305 is used to render the target motion effect carrier in the historical image frame according to the motion effect rendering information to obtain a rendered image frame.

[0156] The rendering unit 305 may further include an extraction subunit 3051, a second generation subunit 3052 and a rendering subunit 3053. Fig. 9 As shown, the details are as follows:

[0157] The extraction subunit 3051 is used to extract the motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information;

[0158] The second generating subunit 3052 is used to generate the position information of the target motion effect carrier in the current image frame according to the motion parameter information;

[0159] The rendering sub-unit 3053 is used to render the target motion effect carrier in the historical image frame according to the position information and the rendering parameter information to obtain a rendered image frame.

[0160] For example, the extraction subunit 3051 extracts the motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information, the second generation subunit 3052 generates the position information of the target motion effect carrier in the current image frame according to the motion parameter information, and the rendering subunit 3053 renders the target motion effect carrier in the historical image frame according to the position information and the rendering parameter information to obtain the rendered image frame.

[0161] (6) Obtain unit 306;

[0162] The obtaining unit 306 is used to update the current image frame to a rendered image frame to obtain an image frame set with a motion effect.

[0163] For example, the current image frame in the image frame set is updated to the rendered image frame, and after the update is completed, the next image frame is updated, until all the image frames in the image frame set are updated, and the image frame set with dynamic effects is obtained. The dynamic effects can be displayed in the image frame set by playing all the image frames in the image frame set on a web page.

[0164] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.

[0165] As can be seen from the above, in this embodiment, after the acquisition unit 301 acquires the image frame set to be generated with the motion effect, the image frame set includes at least one image frame, the determination unit 302 determines the motion effect type and the description information corresponding to the motion effect type to be generated, and then the generation unit 303 generates the motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, and the motion effect carrier configuration information includes the motion effect carrier attribute information and the motion effect rendering information, and then the update unit 304 updates the historical motion effect carrier generated in the historical image frame based on the motion effect carrier attribute information of the current image frame. , obtain the target motion effect carrier corresponding to the current image frame, the rendering unit 305 renders the target motion effect carrier in the historical image frame according to the motion effect rendering information, and obtains the rendered image frame, and the obtaining unit 306 updates the current image frame to the rendered image frame to obtain an image frame set with motion effect; since the scheme can provide a variety of motion effect types, the motion effect carrier configuration information is directly generated according to the motion effect type and description information, and the image frame can be rendered according to the motion effect carrier configuration information to realize the motion effect, which is simple, fast, and highly reusable, and does not require secondary development. Therefore, the motion effect can be realized simply and quickly.

[0166] The embodiment of the present invention further provides an electronic device, such as Fig.10 As shown, it shows a schematic diagram of the structure of an electronic device involved in an embodiment of the present invention, specifically:

[0167] The electronic device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Fig.10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0168] The processor 401 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the electronic device and processes data, thereby performing overall detection of the electronic device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.

[0169] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0170] The electronic device also includes a power supply 403 for supplying power to each component. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 403 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.

[0171] The electronic device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0172] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:

[0173] An image frame set for generating a motion effect is obtained, the image frame set includes at least one image frame, a motion effect type for generating a motion effect and description information corresponding to the motion effect type are determined, motion effect carrier configuration information of the image frame is generated according to the motion effect type and the motion effect description information, the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information, based on the motion effect carrier attribute information of the current image frame, historical motion effect carriers generated in historical image frames are updated to obtain a target motion effect carrier corresponding to the current image frame, according to the motion effect rendering information, the target motion effect carrier is rendered in the historical image frame to obtain a rendered image frame, the current image frame is updated to the rendered image frame, and an image frame set with motion effects is obtained.

[0174] For example, directly obtain one or more image frames uploaded or sent by the user, and form the uploaded or sent image frames into an image frame set. The video uploaded or sent by the user can also be divided into multiple image frames at a certain time interval, and the image frames can be formed into an image frame set. The image uploaded or sent by the user can also be made into one or more image frames at a certain time interval, and these image frames can be formed into an image frame set. According to the type of motion effect selected by the user on the motion effect realization page and the description information corresponding to the motion effect type, determine the type of motion effect to be generated and the description information corresponding to the motion effect type, select the basic motion effect information corresponding to the motion effect type in the preset basic motion effect information, generate the initial motion effect carrier configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information, and divide the initial motion effect configuration information according to the number of frames in the image frame set to obtain the motion effect carrier configuration information corresponding to each image frame. Obtain the historical motion effect carrier generated in the historical image frame, remove the expired first historical motion effect carrier from the historical motion effect carrier, and obtain the unexpired second historical motion effect carrier. Based on the property information of the motion effect carrier of the current image frame, update the second historical motion effect carrier in the historical image frame to obtain the target motion effect carrier corresponding to the current image frame. Extract the motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information, generate the position information of the target motion effect carrier in the current image frame based on the motion parameter information, render the target motion effect carrier in the historical image frame based on the position information and rendering parameter information, and obtain the rendered image frame. Update the current image frame in the image frame set to the rendered image frame, and after the update is completed, start updating the next image frame until all the image frames in the image frame set are updated to obtain an image frame set with motion effects. Use a web page to play all the image frames in the image frame set to display the motion effects in the image frame set.

[0175] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.

[0176] From the above, it can be seen that after the embodiment of the present invention obtains the image frame set for generating the motion effect, the image frame set includes at least one image frame, determines the motion effect type of the generated motion effect and the description information corresponding to the motion effect type, and then generates the motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, the motion effect carrier configuration information includes the motion effect carrier attribute information and the motion effect rendering information, and then, based on the motion effect carrier attribute information of the current image frame, the historical motion effect carrier generated in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame, and according to the motion effect rendering information, the target motion effect carrier is rendered in the historical image frame to obtain the rendered image frame, and the current image frame is updated to the rendered image frame to obtain the image frame set with the motion effect; since the scheme can provide a variety of motion effect types, the motion effect carrier configuration information is directly generated according to the motion effect type and the description information, and the motion effect can be realized by rendering the image frame according to the motion effect carrier configuration information, which is simple, fast, and highly reusable, and does not require secondary development, so the motion effect can be realized simply and quickly.

[0177] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0178] To this end, an embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the motion effect implementation methods provided in the embodiment of the present invention. For example, the instructions can execute the following steps:

[0179] An image frame set for generating a motion effect is obtained, the image frame set includes at least one image frame, a motion effect type for generating a motion effect and description information corresponding to the motion effect type are determined, motion effect carrier configuration information of the image frame is generated according to the motion effect type and the motion effect description information, the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information, based on the motion effect carrier attribute information of the current image frame, historical motion effect carriers generated in historical image frames are updated to obtain a target motion effect carrier corresponding to the current image frame, according to the motion effect rendering information, the target motion effect carrier is rendered in the historical image frame to obtain a rendered image frame, the current image frame is updated to the rendered image frame, and an image frame set with motion effects is obtained.

[0180] For example, directly obtain one or more image frames uploaded or sent by the user, and form the uploaded or sent image frames into an image frame set. The video uploaded or sent by the user can also be divided into multiple image frames at a certain time interval, and the image frames can be formed into an image frame set. The image uploaded or sent by the user can also be made into one or more image frames at a certain time interval, and these image frames can be formed into an image frame set. According to the type of motion effect selected by the user on the motion effect realization page and the description information corresponding to the motion effect type, determine the type of motion effect to be generated and the description information corresponding to the motion effect type, select the basic motion effect information corresponding to the motion effect type in the preset basic motion effect information, generate the initial motion effect carrier configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information, and divide the initial motion effect configuration information according to the number of frames in the image frame set to obtain the motion effect carrier configuration information corresponding to each image frame. Obtain the historical motion effect carrier generated in the historical image frame, remove the expired first historical motion effect carrier from the historical motion effect carrier, and obtain the unexpired second historical motion effect carrier. Based on the property information of the motion effect carrier of the current image frame, update the second historical motion effect carrier in the historical image frame to obtain the target motion effect carrier corresponding to the current image frame. Extract the motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information, generate the position information of the target motion effect carrier in the current image frame based on the motion parameter information, render the target motion effect carrier in the historical image frame based on the position information and rendering parameter information, and obtain the rendered image frame. Update the current image frame in the image frame set to the rendered image frame, and after the update is completed, start updating the next image frame until all the image frames in the image frame set are updated to obtain an image frame set with motion effects. Use a web page to play all the image frames in the image frame set to display the motion effects in the image frame set.

[0181] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0182] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0183] Since the instructions stored in the computer-readable storage medium can execute the steps in any one of the motion effect implementation methods provided in the embodiments of the present invention, the beneficial effects that can be achieved by any one of the motion effect implementation methods provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0184] The above is a detailed introduction to a method, device and computer-readable storage medium for realizing dynamic effects provided by an embodiment of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for realizing a dynamic effect, characterized in that: include: Acquire an image frame set to generate a motion effect, wherein the image frame set includes at least one image frame; Determine the type of motion effect to be generated and the description information corresponding to the motion effect type according to the motion effect type selected by the user on the motion effect realization page; Generate motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information, wherein the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information; Based on the attribute information of the motion effect carrier of the current image frame, the historical motion effect carrier generated in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame; Extracting motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information, wherein the motion parameter information includes speed, acceleration and motion time of the target motion effect carrier; Generating the position information of the target motion effect carrier in the current image frame according to the motion parameter information, including: obtaining the motion region of the target motion effect carrier in the current image frame based on the rendering parameter information, and calculating the position information of the target motion effect carrier in the current image frame in the motion region according to the speed, acceleration and motion time of the target motion effect carrier; Rendering the target motion effect carrier in the historical image frame according to the position information and the rendering parameter information to obtain a rendered image frame; The current image frame is updated to the rendered image frame to obtain an image frame set with motion effects.

2. The method for realizing the dynamic effect according to claim 1, characterized in that: The updating of the historical motion effect carrier generated in the historical image frame based on the motion effect carrier attribute information of the current image frame to obtain the target motion effect carrier corresponding to the current image frame includes: Obtaining the historical motion effect carrier generated in the historical image frame; Removing the expired first historical animation carrier from the historical animation carriers to obtain a non-expired second historical animation carrier; Based on the attribute information of the motion effect carrier of the current image frame, the second historical motion effect carrier in the historical image frame is updated to obtain the target motion effect carrier corresponding to the current image frame.

3. The method for realizing dynamic effects according to claim 2, characterized in that: The updating of the second historical motion effect carrier in the historical image frame based on the motion effect carrier attribute information of the current image frame to obtain the target motion effect carrier corresponding to the current image frame includes: Extracting a target animation carrier set to be generated from the animation carrier configuration information of the current image frame; Filtering out a third animation carrier other than the second historical animation carrier from the target animation carrier set to be generated; The third motion effect carrier is generated, and the third motion effect carrier is merged with the second historical motion effect carrier to obtain a target motion effect carrier corresponding to the current image frame.

4. The method for realizing the dynamic effect according to claim 1, characterized in that: The step of rendering the target motion effect carrier in the historical image frame according to the position information and the rendering parameter information to obtain a rendered image frame includes: Clearing the content of the historical image frame, and using the historical image frame after the content is cleared as a canvas; Adding the target motion effect carrier to the canvas to obtain a canvas to be rendered; The target motion effect carrier is rendered on the canvas to be rendered according to the position information and the rendering parameter information to obtain a rendered image frame.

5. The method for realizing the dynamic effect according to claim 4, characterized in that: The step of rendering the target motion effect carrier on the canvas to be rendered according to the position information and the rendering parameter information to obtain a rendered image frame includes: According to the position information, the target animation carrier is moved to a corresponding position on the canvas to be rendered; Based on the rendering parameter information, the moved target motion effect carrier is rendered on the canvas to be rendered to obtain a rendered image frame.

6. The method for realizing dynamic effects according to claim 1, characterized in that: The step of generating the motion effect carrier configuration information of the image frame according to the motion effect type and the motion effect description information includes: Filtering basic motion effect information corresponding to the motion effect type from the preset basic motion effect information; Generating initial motion effect configuration information corresponding to the image frame set according to the basic motion effect information and the motion effect description information; The initial motion effect configuration information is segmented according to the number of frames in the image frame set to obtain motion effect carrier configuration information corresponding to each image frame.

7. A device for realizing a dynamic effect, characterized in that: include: An acquisition unit, used to acquire an image frame set to generate a motion effect, wherein the image frame set includes at least one image frame; A determination unit, configured to determine the type of motion effect to be generated and the description information corresponding to the motion effect type according to the motion effect type and the description information corresponding to the motion effect type selected by the user on the motion effect realization page; A generating unit, configured to generate motion effect carrier configuration information of an image frame according to the motion effect type and the motion effect description information, wherein the motion effect carrier configuration information includes motion effect carrier attribute information and motion effect rendering information; An updating unit, configured to update the historical motion effect carrier generated in the historical image frame based on the motion effect carrier attribute information of the current image frame, and obtain a target motion effect carrier corresponding to the current image frame; A rendering unit, used to extract motion parameter information and rendering parameter information of the target motion effect carrier from the motion effect rendering information, wherein the motion parameters include speed, acceleration and motion time of the target motion effect carrier, and generate position information of the target motion effect carrier in the current image frame according to the motion parameter information, including: obtaining a motion region of the target motion effect carrier in the current image frame based on the rendering parameter information, calculating the position information of the target motion effect carrier in the current image frame in the motion region according to the speed, acceleration and motion time of the target motion effect carrier, and rendering the target motion effect carrier in the historical image frame according to the position information and the rendering parameter information to obtain a rendered image frame; The obtaining unit is used to update the current image frame to the rendered image frame to obtain an image frame set with motion effects.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the motion effect implementation method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Video processing method and video processing device

    CN106385591A

  • Particle system processing method and device

    CN107392835A