Method and terminal for automatically generating handwriting Chinese character animation
By analyzing and calculating Chinese character stroke data, handwritten Chinese character animations are automatically generated, solving the problems of high human resource consumption and low resource utilization in existing technologies, and achieving a user interactive experience that efficiently generates and simulates the real writing process.
Patent Information
- Application Number
- CN202411020807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-07-29
AI Technical Summary
Existing technologies, when generating handwritten Chinese character animations, especially when faced with a large number of Chinese characters, consume a lot of human resources, have low resource utilization, and have high update and maintenance costs. They also cannot automatically generate new Chinese character animations, which affects the user's interactive experience.
By analyzing the strokes, stroke types, and center point data of the target Chinese character, the system calculates the connection data required to draw the strokes, generates handwritten stroke animations, and integrates them into handwritten Chinese character animations according to the stroke order. The system then uses the memory and processor in the terminal to execute the corresponding computer program to achieve automated generation.
It enables the automatic generation of handwritten Chinese character animations, simulating the real writing process, enhancing the user's interactive experience while saving manpower and resources, and adapting to different generation scenarios.
Smart Images

Figure CN119091006B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of dynamic generation, in particular to a method for automatically generating handwriting Chinese character animation and a terminal. BACKGROUND
[0002] In some existing application scenarios of Chinese character learning, game interaction, signature confirmation, etc., handwriting Chinese character animation is often needed to enhance the interactive effect and improve the user experience. The existing method generally relies on animators to manually create the stroke order and stroke style of each Chinese character, or uses a fixed stroke animation template to show the writing process of the Chinese character.
[0003] However, especially in the scenario where a large number of different Chinese characters need to show the writing process, the manual creation method of animators consumes a lot of human resources. The stroke animation template method has low resource utilization, high update and maintenance cost, and cannot automatically generate new Chinese character animation, which affects the user's interactive experience in the corresponding scenario. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a method for automatically generating handwriting Chinese character animation and a terminal, which can automatically generate handwriting Chinese character animation of the required Chinese character, save manpower and material resources while improving the user's interactive experience.
[0005] To solve the above technical problems, the technical scheme adopted by the present application is:
[0006] A method for automatically generating handwriting Chinese character animation, comprising the following steps:
[0007] S1, obtaining a target Chinese character for which handwriting Chinese character animation needs to be generated, analyzing each stroke of the target Chinese character, and the stroke type and center point data corresponding to each stroke;
[0008] S2, determining the corresponding vertex data according to the stroke type of the stroke;
[0009] S3, calculating the connection data required for drawing the stroke according to the center point data and the vertex data corresponding to the stroke;
[0010] S4, generating handwriting stroke animation corresponding to the stroke according to the connection data, integrating the handwriting stroke animation corresponding to each stroke according to the stroke order of the target Chinese character, and obtaining handwriting Chinese character animation of the target Chinese character.
[0011] To solve the above technical problems, another technical scheme adopted by the present application is:
[0012] A terminal for automatically generating handwriting Chinese character animation, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0013] S1, obtaining a target Chinese character for which handwriting Chinese character animation is to be generated, parsing each stroke of the target Chinese character, and the stroke type and center point data corresponding to each stroke;
[0014] S2, determining the corresponding center point data and vertex data according to the stroke type of the stroke;
[0015] S3, calculating the connection line data required for drawing the stroke according to the center point data and the vertex data corresponding to the stroke;
[0016] S4, generating handwriting stroke animation corresponding to the stroke according to the connection line data, integrating the handwriting stroke animation corresponding to each stroke according to the stroke order of the target Chinese character, and obtaining handwriting Chinese character animation of the target Chinese character.
[0017] The present application has the beneficial effect that a method and terminal for automatically generating handwriting Chinese character animation are provided, by parsing the strokes, stroke types and center point data of a target Chinese character for which handwriting Chinese character animation is to be generated, determining the vertex data corresponding to each stroke of the target Chinese character, thereby determining handwriting stroke animation when each stroke is completed, and finally integrating all handwriting stroke animations according to the stroke order to obtain handwriting Chinese character animation of the entire target Chinese character. In this way, handwriting Chinese character animation can be automatically generated according to the user's needs, and the real writing process can be simulated when generating, thereby improving the user's interactive experience while saving manpower and resources. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 A step schematic diagram of a method for automatically generating handwriting Chinese character animation according to the present application;
[0019] Figure 2 An AI module flowchart for a method for automatically generating handwriting Chinese character animation according to the present application, which disassembles the target Chinese character one by one;
[0020] Figure 3 A flowchart for a method for automatically generating handwriting Chinese character animation according to the present application, which matches vertex data in a database;
[0021] Figure 4 A flowchart for a method for automatically generating handwriting Chinese character animation according to the present application, which calculates the start vertex and end vertex;
[0022] Figure 5 A flowchart for a method for automatically generating handwriting Chinese character animation according to the present application, which performs line segment fitting to determine the connection method;
[0023] Figure 6 A flowchart of generating handwritten Chinese character animation for a method of automatically generating handwritten Chinese character animation of the present application;
[0024] Figure 7 A system block diagram of a terminal for automatically generating handwritten Chinese character animation of the present application.
[0025] Label explanation:
[0026] 1. A terminal for automatically generating handwritten Chinese character animation; 2. Memory; 3. Processor. DETAILED DESCRIPTION
[0027] To explain the technical content, purposes and effects of the present application in detail, the following will be described in conjunction with the embodiments and the accompanying drawings.
[0028] The specific application scenarios of the present application include but are not limited to the following aspects:
[0029] I. Education software and application programs
[0030] Chinese character learning tool: Provide dynamic stroke order display to help learners correctly master the writing method of Chinese characters.
[0031] Language teaching platform: Enhance the understanding of Chinese character structure and writing rules for non-native learners.
[0032] Online classroom and educational games: Increase interactivity through animation, improve learning interest and effect.
[0033] II. Design and document processing software
[0034] Font design software: Automatically generate handwritten Chinese character animation to assist designers in font creation.
[0035] Document editing tool: Embed handwritten Chinese character animation in documents to enrich the display effect.
[0036] III. Media and entertainment industry
[0037] Film and television post-production: Add handwritten Chinese character special effects in film and television works.
[0038] Advertising design: Use handwritten Chinese character animation to attract audience attention and improve advertising communication effect.
[0039] Game development:
[0040] Character interaction design: Characters show real handwriting when writing letters or performing other writing behaviors in the game.
[0041] User Interface (UI) Design: Enhance the aesthetics and user experience of game interfaces using handwritten Chinese character animations.
[0042] Four, Virtual Reality (VR) and Augmented Reality (AR)
[0043] VR / AR Education Application: Simulate the writing process in a virtual environment, providing an immersive learning experience.
[0044] Cultural Display and Transmission: Introduce Chinese calligraphy art in museums or exhibitions using handwritten Chinese character animations.
[0045] Five, Human-Computer Interaction System
[0046] Smart Assistant and Chatbot: Respond to user input by generating handwritten strokes, providing a more natural interaction experience.
[0047] Signature Verification System: Simulate the real signature process for identity verification or intent confirmation.
[0048] Please refer to Figures 1 to 6 A method for automatically generating handwritten Chinese character animations, comprising the following steps:
[0049] S1, obtaining the target Chinese character that needs to generate handwritten Chinese character animation, analyzing each stroke of the target Chinese character, and the stroke type and center point data corresponding to each stroke;
[0050] S2, determining the corresponding vertex data according to the stroke type of the stroke;
[0051] S3, calculating the connection data required to draw the stroke according to the center point data and the vertex data corresponding to the stroke;
[0052] S4, generating handwritten stroke animation corresponding to the stroke according to the connection data, integrating each handwritten stroke animation corresponding to the stroke according to the stroke order of the target Chinese character, and obtaining the handwritten Chinese character animation of the target Chinese character.
[0053] From the above description, the beneficial effects of the present application are as follows: by analyzing the strokes and stroke types of the target Chinese character that needs to generate handwritten Chinese character animation, determining the center point data and vertex data corresponding to each stroke of the target Chinese character, and determining the handwritten stroke animation when each stroke is completed, finally integrating all handwritten stroke animations according to the stroke order to obtain the entire target Chinese character handwritten Chinese character animation. In this way, handwritten Chinese character animations can be automatically generated according to user needs, and the real writing process can be simulated during generation, improving user interaction experience while saving manpower and resources.
[0054] Further, the step S1 before including:
[0055] S0, store the vertex data corresponding to different stroke types in a database;
[0056] The step S2 specifically comprises:
[0057] According to the stroke type of the stroke, data matching is performed in the database to obtain the corresponding vertex data.
[0058] From the above description, it can be seen that when determining the vertex data according to the stroke type of the stroke, the determination is performed by data matching in the database, thereby improving the efficiency and accuracy of determining the vertex data, and gradually generating the applicable range of the handwritten Chinese character animation as the data in the database is supplemented and improved, and flexibly meeting the user demand.
[0059] Further, the step S3 specifically comprises:
[0060] S31, calculating the start vertex and the end vertex of the stroke for forming the graph boundary according to the center point data and the vertex data corresponding to the stroke;
[0061] Based on the center point data of the stroke, the standard graph formed by the vertex data of the stroke is changed in graph, so that the center point of the changed standard graph corresponds to the center of the drawing position of the stroke, and the vertex data of the changed standard graph is taken as the drawing point data of the stroke;
[0062] S32, obtaining the connection line data according to the drawing point data.
[0063] From the above description, it can be seen that when determining the drawing point data, the standard graph corresponding to the original center point data and the vertex data of the stroke is changed, so that the center position of the graph is closer to the center of the drawing position, so as to confirm the final effect obtained by drawing, and then the drawing point data after the change is obtained according to the vertex data before the change, and finally the accurate connection line data is obtained.
[0064] Further, the step S32 comprises:
[0065] S321, dividing the drawing point data into two parts of drawing point sets from the start vertex to the end vertex according to two paths surrounding the graph boundary;
[0066] S322, selecting a preset number of continuous drawing points from the drawing point set in the connection line order, and selecting the corresponding connection line mode from a straight line, a Bezier curve, a quadratic curve or a Bezier cubic curve according to the selected drawing points;
[0067] S323, integrating the connection line modes of the two drawing point sets to obtain the connection line data.
[0068] From the above description, based on the idea that a figure boundary is enclosed by two line segments between two points, the entire drawing point data is divided into two parts from the starting vertex to the ending vertex, and then the connection mode of the selected preset number of points is analyzed for each part of data, and the connection line forming the entire figure boundary is distributed and refined to ensure that the final generated connection line result is more accurate and reliable.
[0069] Further, the step S322 specifically includes:
[0070] Selecting one of a straight line, a Bezier quadratic curve or a Bezier cubic curve as a target line segment, fitting the selected drawing point with the target line segment, and determining whether the average or variance of the distances of all the drawing points to the target line segment is greater than or equal to a corresponding threshold value, if yes, determining the target line segment as the connection mode, otherwise, reselecting the target line segment and determining.
[0071] From the above description, after several drawing points are determined, based on the positions of the drawing points, a suitable connection mode is determined through line segment fitting, and the average difference and other calculation methods are introduced when analyzing the fitting result, which effectively improves the fitting accuracy, and the point selection fitting method itself is flexible and variable, which is suitable for different types of strokes, so that the confirmation of the connection mode is fast and accurate.
[0072] Please refer to Figure 7 A terminal 1 for automatically generating a handwritten Chinese character animation, comprising a memory 2, a processor 3, and a computer program stored on the memory 2 and executable on the processor 3, and the processor 3 implements the following steps when executing the computer program:
[0073] S1, obtaining a target Chinese character for which a handwritten Chinese character animation needs to be generated, analyzing each stroke of the target Chinese character, and the stroke type and center point data corresponding to each stroke;
[0074] S2, determining the corresponding vertex data according to the stroke type of the stroke;
[0075] S3, calculating the connection data required for drawing the stroke according to the center point data and the vertex data corresponding to the stroke;
[0076] S4, generating a handwritten stroke animation corresponding to the stroke according to the connection data, integrating the handwritten stroke animation corresponding to each stroke according to the stroke order of the target Chinese character, and obtaining a handwritten Chinese character animation of the target Chinese character.
[0077] From the above description, the beneficial effects of the present application are that: by analyzing strokes and stroke types of a target Chinese character for which a handwriting Chinese character animation needs to be generated, center point data and vertex data corresponding to each stroke of the target Chinese character are determined, handwriting stroke animations when each stroke is completed are determined, and finally all handwriting stroke animations are integrated according to stroke order to obtain a handwriting Chinese character animation of the entire target Chinese character. In this way, the handwriting Chinese character animation can be flexibly generated according to user needs, a real writing process is simulated during generation, user interactive experience is improved, and manpower and resources are saved.
[0078] Further, the step S1 further includes:
[0079] S0, storing vertex data corresponding to different stroke types in a database;
[0080] The step S2 specifically includes:
[0081] According to the stroke type of the stroke, data matching is performed in the database to obtain corresponding vertex data.
[0082] From the above description, when the vertex data is determined according to the stroke type of the stroke, the vertex data is determined by data matching in the database, thereby improving the efficiency and accuracy of determining the vertex data, and gradually expanding the application range of automatically generating handwriting Chinese character animations as the data in the database is supplemented and improved, and flexibly meeting user needs.
[0083] Further, the step S3 specifically includes:
[0084] S31, calculating start vertex and end vertex of the stroke for forming a graph boundary according to the center point data and the vertex data corresponding to the stroke;
[0085] Based on the center point data of the stroke, a standard graph formed by the vertex data of the stroke is changed in graph, so that the center point of the changed standard graph corresponds to the center of the drawing position of the stroke, and the vertex data of the changed standard graph is taken as the drawing point data of the stroke;
[0086] S32, obtaining the connection line data according to the drawing point data.
[0087] From the above description, when the drawing point data is determined, the standard graph corresponding to the original center point data and the vertex data of the stroke is changed to obtain a graph whose center position is closer to the center of the drawing position, so as to confirm the final effect that should be obtained by drawing, and then the changed drawing point data is obtained according to the vertex data before the change, and finally accurate connection line data is obtained.
[0088] Further, the step S32 comprises:
[0089] S321, dividing the drawing point data into two drawing point sets from the start vertex to the end vertex according to two paths surrounding the graphic boundary;
[0090] S322, selecting a preset number of continuous drawing points from the drawing point set according to the connection order, and selecting a corresponding connection mode from a straight line, a Bezier curve, a quadratic curve or a Bezier cubic curve according to the selected drawing points;
[0091] S323, integrating the connection modes of the two drawing point sets to obtain the connection data.
[0092] As can be seen from the above description, based on the idea that a graphic boundary is surrounded by two line segments between two points, the entire drawing point data is divided into two parts from the start vertex to the end vertex, and then the connection mode of a preset number of points is analyzed to obtain the connection mode corresponding to each part of data, and the connection process of forming the entire graphic boundary is distributed and refined to ensure that the finally generated connection result is more accurate and reliable.
[0093] Further, the step S322 specifically comprises:
[0094] selecting one as a target line segment, fitting the selected drawing points with the target line segment, and determining whether the average value or variance of the distances of all the drawing points to the target line segment is greater than or equal to a corresponding threshold value, if yes, determining the target line segment as the connection mode, otherwise, reselecting the target line segment and determining.
[0095] As can be seen from the above description, after several drawing points are determined, a suitable connection mode is determined through line segment fitting based on the positions of the drawing points, and the average difference and other calculation methods are introduced when analyzing the fitting result, which effectively improves the fitting accuracy, and the selection and fitting method is flexible and changeable enough, which is suitable for different types of strokes, so that the confirmation of the connection mode is fast and accurate.
[0096] Please refer to Figures 1 to 6 , an embodiment of the present application is:
[0097] A method for automatically generating a handwriting Chinese character animation, as shown in Figure 1 , comprising the following steps:
[0098] S0, storing center point data and vertex data corresponding to different stroke types in a database;
[0099] In this embodiment, a stroke is defined as each Chinese character can be written and drawn with one stroke or multiple strokes, and each writing and drawing of a stroke is called a stroke. The basic stroke types include, but are not limited to, horizontal (一), vertical (丨), left-falling stroke (丿), dot (丶), right-falling stroke (㇏), etc. Each stroke type has a fixed writing direction and shape characteristics.
[0100] The vertex data corresponding to the stroke type is a set of coordinate points used to define and describe the boundary of the Chinese character stroke graph. These data are usually used in computer graphics to accurately draw the shape of a specific stroke on the screen. Taking the Chinese character "一" (yī) as an example, it consists of a simple horizontal stroke. If we want to define the vertex data of this stroke, we need to regard it as a graph, draw a line from the starting vertex position on the left to the ending vertex position on the right, and draw a line from the starting vertex position on the left down to the ending vertex position on the right. The graph enclosed by the two lines is the connection data of the horizontal stroke of the Chinese character "一", and the set of key vertices in the connection data is the vertex data of the horizontal stroke of the Chinese character "一". And the center point data of the stroke type, the center point data describes the writing direction of the stroke. For example, in the horizontal stroke (一), there is a center point on the left which is the starting position of writing, and there is a center point on the right which is the ending position of writing; in the vertical stroke (丨), there is a center point on the upper side which is the starting position of writing, and there is a center point on the lower side which is the ending position of writing; in the right-falling stroke there is a center point in the upper left which is the starting position of writing, there is a center point at the middle turning position, and there is a center point in the lower right which is the ending position of writing.
[0101] S1. Obtain the target Chinese character for which a handwritten Chinese character animation needs to be generated, parse each stroke of the target Chinese character, and the stroke type and center point data corresponding to each stroke;
[0102] In this embodiment, as shown in combination with Figure 2 existing AI technologies, such as ChatGPT, ChatGLM, Doubao, Wenxin Yiyan, Tencent Hunyuan, etc., can already disassemble the stroke order, stroke type of each Chinese character and provide the center point data of the stroke.
[0103] S2. Determine the corresponding vertex data according to the stroke type of the stroke. Specifically, as shown in Figure 3 figure, perform data matching in the database according to the stroke type of the stroke to obtain the corresponding vertex data;
[0104] S3. Calculate the connection data required for drawing the stroke according to the center point data and vertex data corresponding to the stroke;
[0105] Step S3 is specifically:
[0106] S31, calculating, according to the center point data and the vertex data corresponding to the stroke, a start vertex and an end vertex of the stroke for forming a boundary of a figure;
[0107] based on the center point data of the stroke, performing a figure change on a standard figure formed by the vertex data of the stroke, so that a center point of the changed standard figure corresponds to a center of a drawing position of the stroke, and taking vertex data of the changed standard figure as drawing point data of the stroke;
[0108] S32, obtaining line data according to the drawing point data, specifically as follows:
[0109] S321, dividing the drawing point data into two parts of drawing point sets from the start vertex to the end vertex according to two paths surrounding the boundary of the figure;
[0110] In this embodiment, taking the Chinese character "one" (yī) as an example, it is composed of a simple horizontal stroke. If we want to define the vertex data of this stroke, it is regarded as a figure, from the left start vertex position to the right end vertex position, and from the left start vertex position to the right end vertex position, a total of two lines; the two lines correspond to two parts of the drawing point set from the start vertex to the end vertex.
[0111] S322, selecting a preset number of continuous drawing points from the drawing point set in the order of the lines, and selecting a corresponding line mode from a straight line, a Bezier curve, a quadratic curve or a cubic Bezier curve according to the selected drawing points;
[0112] Specifically, step S322 includes:
[0113] selecting one of the straight line, the Bezier curve, the quadratic curve or the cubic Bezier curve as a target line segment, fitting the selected drawing points with the target line segment, and determining whether the average or variance of the distances of all drawing points to the target line segment is greater than or equal to a corresponding threshold value, if yes, determining the target line segment as the line mode, otherwise, reselecting the target line segment and determining.
[0114] In this embodiment, the line segment fitting process is as follows:
[0115] First, try to fit the line points with the next two line points with a straight line, calculate the distances of the three line points to the straight line, and then calculate the average or variance of the distances. If the average or variance is less than a specified threshold value, it can be considered that the three line points can be matched with a straight line.
[0116] Secondly, if the straight line cannot be matched, then try to fit the line points and the subsequent three line points with a quadratic curve. Calculate the distance from the four line points to the fitted quadratic curve, and then calculate the average or variance of the distances. If the average or variance is less than a specified threshold, it can be considered that the group of points can be matched with a quadratic curve.
[0117] Thirdly, if neither the straight line nor the quadratic curve can be matched, then fit the line points and the subsequent three line points with a cubic curve.
[0118] Finally, for some special cases, if there is only one line point after the line point, a straight line is directly used; if the straight line cannot be matched, and there are only two line points after the line point, a quadratic curve is directly used.
[0119] It should be noted that the target line segment to be fitted includes but is not limited to a straight line, a Bezier curve, a quadratic curve or a Bezier cubic curve. After the current selected line connection mode of the drawing points is determined, a new drawing point is selected from the drawing point set with an undetermined line connection mode and line segment fitting is performed again until all the drawing points in the drawing point set participate in the line connection.
[0120] S323, integrate the line connection modes of the two drawing point sets to obtain line connection data.
[0121] S4, generate a corresponding stroke handwriting animation according to the line connection data, integrate the handwriting animation of each stroke according to the stroke order of the target Chinese character, and obtain a handwriting Chinese character animation of the target Chinese character.
[0122] In the embodiment, the line connection drawing method of the handwriting stroke animation and the handwriting Chinese character animation includes but is not limited to a method of generating a mesh model by using a mesh vertex in a game engine, a method of drawing a line by using a CSS or SVG line connection drawing method in software development, and the like; and the graphic filling method of the stroke connection surrounding area includes but is not limited to a method of drawing by a model material when a mesh model is drawn in a game engine, a method of automatically drawing a line as a graphic by using a CSS or SVG in software development, and the like.
[0123] Please refer to Figures 2 to 7 , the second embodiment of the present application is:
[0124] A terminal 1 for automatically generating a handwriting Chinese character animation includes a memory 2, a processor 3, and a computer program stored on the memory 2 and executable on the processor 3, wherein the processor 3 implements the method for quickly generating a handwriting Chinese character animation of the first real-time example when executing the computer program.
[0125] In the embodiment, a terminal 1 for automatically generating a handwriting Chinese character animation at least includes the following contents:
[0126] I. AI Module
[0127] In combination with the AI module as shown in Figure 2 , it is responsible for receiving input Chinese characters and disassembling the stroke order, stroke type, and calculating the center point position data of each stroke one by one. It uses artificial intelligence technologies such as ChatGPT, ChatGLM, Doubao, Wenxin Yiyang, Tencent Hunyuan, etc. to identify and analyze the structure of Chinese characters.
[0128] II. Database Module
[0129] In combination with the database module as shown in Figure 3 , it stores various stroke type corresponding vertex data. It matches and retrieves corresponding vertex data according to the stroke type information provided by the AI module for subsequent data processing.
[0130] III. Data Analysis Module
[0131] In combination with the data analysis module as shown in Figure 4 , it uses the vertex data obtained from the database module and the center point data provided by the AI module to calculate the specific position of each stroke on the screen or page. It determines the start and end vertices of each stroke and divides the vertex data into two sets of connected point data.
[0132] IV. Connection Matching Module
[0133] In combination with the connection matching module as shown in Figure 5 , it matches the connected points in the segmented connected point data set according to the rules (straight lines, Bezier curves, etc.) to generate the final connection data. This is an important step in forming the handwriting animation effect, as it determines the shape and smoothness of the stroke animation.
[0134] V. Stroke Drawing Module
[0135] In combination with the stroke drawing module as shown in Figure 6 , it uses the connection data generated by the connection matching module to draw each stroke one by one and combines these stroke animations according to the stroke order of the Chinese characters to finally generate a complete handwriting Chinese character animation. This module is the core part of realizing the handwriting effect display.
[0136] In summary, the application provides a method and terminal for automatically generating handwriting Chinese character animation, which analyzes strokes, stroke types and center point data of a target Chinese character for which handwriting Chinese character animation is to be generated by an AI module, determines vertex data corresponding to each stroke of the target Chinese character, thereby determining handwriting stroke animation when each stroke is completed, and finally integrates all handwriting stroke animations according to stroke order to obtain handwriting Chinese character animation of the entire target Chinese character. In this way, handwriting Chinese character animation can be automatically generated according to user requirements, and a real writing process can be simulated during generation, thereby improving user interactive experience while saving manpower and resources.
[0137] The above description is only an embodiment of the application, and does not limit the patent scope of the application. Any equivalent transformation or direct or indirect application in the related technical field based on the content of the specification and drawings is also included in the patent protection scope of the application.
Claims
1. A method for automatically generating animation of handwritten Chinese characters, characterized in that, The method comprises the following steps: S1, obtaining a target Chinese character for which a handwriting Chinese character animation is to be generated, analyzing each stroke of the target Chinese character, and a stroke type and center point data corresponding to each stroke; S2, determining corresponding vertex data according to the stroke type of the stroke; S3, calculating connection line data required for drawing the stroke according to the center point data and the vertex data corresponding to the stroke; S4, generating a handwriting stroke animation corresponding to the stroke according to the connection line data, and integrating the handwriting stroke animation corresponding to each stroke according to a stroke order of the target Chinese character to obtain a handwriting Chinese character animation of the target Chinese character; The step S3 specifically comprises: S31, calculating a start vertex and an end vertex of the stroke for forming a graph boundary according to the center point data and the vertex data corresponding to the stroke; based on the center point data of the stroke, performing graph change on a standard graph formed by the vertex data of the stroke, so that a center point of the changed standard graph corresponds to a center of a drawing position of the stroke, and taking vertex data of the changed standard graph as drawing point data of the stroke; S32, obtaining the connection line data according to the drawing point data; The step S32 comprises: S321, dividing the drawing point data into two parts of drawing point sets from the start vertex to the end vertex according to two paths surrounding the graph boundary; S322, selecting a preset number of continuous drawing points from the drawing point set according to a connection line order, and selecting a corresponding connection line mode from a straight line, a Bezier quadratic curve, or a Bezier cubic curve according to the selected drawing points; S323, integrating the connection line modes of the two parts of the drawing point set to obtain the connection line data; The vertex data is used for defining and describing a group of coordinate points of a graph boundary of a Chinese character stroke; and the center point data is used for describing a writing direction of the stroke.
2. The method for automatically generating animation of handwritten Chinese characters according to claim 1, wherein, The step S1 further comprises: S0, storing the vertex data corresponding to different stroke types in a database; The step S2 specifically comprises: performing data matching in the database according to the stroke type of the stroke to obtain the corresponding vertex data.
3. The method for automatically generating animation of handwritten Chinese characters according to claim 1, wherein, The step S322 specifically comprises: selecting one as a target line segment from a straight line, a Bezier quadratic curve, or a Bezier cubic curve, fitting the selected drawing points with the target line segment, and judging whether an average value or a variance of distances of all the drawing points to the target line segment is greater than or equal to a corresponding threshold value, if yes, determining that the target line segment is the connection line mode, and if not, reselecting the target line segment and performing the judgment.
4. A terminal for automatically generating handwritten Chinese character animations, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the following steps are implemented: S1, obtaining a target Chinese character for which a handwriting Chinese character animation is to be generated, analyzing each stroke of the target Chinese character, and a stroke type and center point data corresponding to each stroke; S2, determining corresponding vertex data according to the stroke type of the stroke; S3, calculating connection line data required for drawing the stroke according to the center point data and the vertex data corresponding to the stroke; S4, generating handwriting stroke animation corresponding to each stroke according to the connection data, integrating handwriting stroke animation corresponding to each stroke according to stroke order of the target Chinese character, and obtaining handwriting Chinese character animation of the target Chinese character; The step S3 specifically includes: S31, calculating start vertex and end vertex of the stroke for forming a graph boundary according to the center point data and the vertex data corresponding to the stroke; Based on the center point data of the stroke, performing graph change on the standard graph formed by the vertex data of the stroke, so that the center point of the changed standard graph corresponds to the center of the drawing position of the stroke, and the vertex data of the changed standard graph is taken as the drawing point data of the stroke; S32, obtaining the connection data according to the drawing point data; The step S32 includes: S321, dividing the drawing point data into two parts of drawing point sets from the start vertex to the end vertex according to two paths surrounding the graph boundary corresponding to the drawing point data; S322, selecting a preset number of continuous drawing points from the drawing point set according to connection order, and selecting a corresponding connection mode from a straight line, a Bezier curve, a quadratic curve or a cubic Bezier curve according to the selected drawing points; S323, integrating the connection modes of the two drawing point sets to obtain the connection data; The vertex data is used to define and describe a group of coordinate points of a graph boundary of a Chinese character stroke; and the center point data is used to describe a writing direction of the stroke.
5. The terminal for automatically generating animation of handwritten Chinese characters according to claim 4, wherein The step S1 includes: S0, storing the vertex data corresponding to different stroke types in a database; The step S2 specifically includes: Performing data matching in the database according to the stroke type of the stroke to obtain the corresponding vertex data.
6. The terminal for automatically generating animation of handwritten Chinese characters according to claim 4, wherein The step S322 specifically includes: Selecting one as a target line segment from a straight line, a Bezier curve, a quadratic curve or a cubic Bezier curve, fitting the selected drawing points with the target line segment, and judging whether the average value or variance of distances of all the drawing points to the target line segment is greater than or equal to a corresponding threshold value, if yes, determining that the target line segment is the connection mode, otherwise, reselecting the target line segment and performing the judgment.
Citation Information
Patent Citations
Handwriting drawing method, device and equipment and storage medium
CN111427499A
Chinese character drawing display method and device, electronic equipment and medium
CN113034649A