A Natural Language Animation Generation Method and System Based on a Large Language Model

By using a natural language animation generation method based on a large language model, combined with multi-turn dialogue interaction and semantic-driven motion rules, the problem of high creation threshold, unstable results and rigid performance in animation generation is solved, achieving efficient and interpretable animation generation that is suitable for a variety of application scenarios.

CN122492899APending Publication Date: 2026-07-31HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUNAN UNIV
Filing Date
2026-06-05
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies for animation generation suffer from problems such as high creative threshold, unstable generation results, insufficient support for multi-round interaction, single action mode, stiff animation performance, and lack of physical rationality, making it difficult to achieve efficient conversion and interpretable control from natural language instructions to structured animation.

Method used

We employ a natural language animation generation method based on a large language model, combining multi-turn dialogue interaction design, incremental state memory mechanism and semantically driven motion rules. We generate structured animation descriptions through semantic parsing, support multi-turn interaction and incremental modification, and accurately map adverb descriptions in natural language into speed and acceleration change curves of animated characters.

Benefits of technology

It improves the stability and interpretability of animation generation, supports multi-round continuous communication and local incremental modifications, and makes animation movements more in line with real-world logic, making it suitable for scenarios such as education, science popularization, and leisure and entertainment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492899A_ABST
    Figure CN122492899A_ABST
Patent Text Reader

Abstract

This invention belongs to the fields of artificial intelligence and animation generation technology, specifically relating to a method and system for generating natural language animations based on a large language model. It constructs a complete chain from natural language parsing, a constraint-based knowledge base, structured DSL description, data structure state deduction, two-layer state consistency verification, to executable animation output. Through the constraint-based knowledge base, the system avoids pointer errors, state errors, and missing key teaching steps that occur when directly generating animations using a large language model; the correspondence verification between the data structure state diagram and the animation trajectory diagram ensures that the animation performance is consistent with the semantics of the data structure; through constraint-aware incremental patching, the system ensures that multiple rounds of natural language modifications will not disrupt existing animation logic; and by combining a self-healing mechanism and semantically driven motion rules, the stability, interpretability, and interactive experience of natural language data structure animation generation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence and animation generation technology, specifically relating to a method and system for generating natural language animations based on a large language model. Background Technology

[0002] Traditional animation production typically relies on keyframes, scripting languages, or specialized animation software. For those without animation experience, these tools are very difficult to learn, and the entire production process is tedious. Every object's attributes, timeline, motion trajectory, and even visual effects must be precisely controlled, and any modifications are very costly.

[0003] In recent years, with the development of natural language processing and deep learning technologies, some people have tried to generate animations using text descriptions, hoping to lower the creative threshold. However, most existing text-to-animation systems rely on templates or fixed rules, have limited semantic understanding capabilities, are prone to errors when generating complex or continuous actions, and lack flexibility in supporting multi-turn interactions.

[0004] Some deep learning methods, such as Transformer or Diffusion models, can generate character actions and motion trajectories, but they also have problems: the generated results are unstable, they are prone to losing context during multi-turn interactions, and the action patterns are relatively simple. At the same time, these methods lack interpretable intermediate representations, making the generation process like a black box, which is difficult to debug and optimize.

[0005] In animation motion control, traditional methods often use linear interpolation or fixed easing functions, resulting in stiff, unnatural, and physically unsound movements. This is especially problematic when dealing with complex scenes or multiple objects moving simultaneously, making it difficult to achieve smooth acceleration / deceleration control and semantically driven motion adjustments.

[0006] Therefore, we urgently need a new method that can convert natural language instructions into structured animation representations, support multi-turn interactions and incremental modifications, and combine semantically driven motion rules to make animation generation more natural, controllable, and interpretable. Summary of the Invention

[0007] To address the aforementioned technical challenges, this invention proposes a natural language animation generation method and system based on a large language model. The method utilizes a large language model to semantically parse the natural language input by the user, outputting structured animation descriptions. These descriptions are then transformed into a sequence of directly executable animation instructions via a compilation module and a motion rule processing module, automatically completing the entire process of animation scene construction, character action design, and motion trajectory generation. Furthermore, this invention incorporates a multi-turn dialogue interaction design, coupled with an incremental state memory mechanism, enabling the maintenance of overall semantic coherence during continuous multi-turn communication and supporting local incremental modifications and version rollbacks of generated animations. Additionally, the system employs a semantically driven segmented motion rule design, accurately mapping adverbs in everyday language to the velocity and acceleration curves of animated characters, making the generated animation movements more realistic and significantly improving smoothness and visual expressiveness.

[0008] The technical solution adopted by this invention is, in a first aspect, to provide a natural language animation generation method based on a large language model, comprising: Receive natural language descriptions from user input; The large language model is invoked, and combined with a pre-built knowledge base containing corresponding data structure constraints, the natural language description is semantically parsed to generate a structured animation intermediate description language (DSL). Based on the operation sequence of the intermediate description language DSL and the state transition rules in the constraint knowledge base, a data structure state diagram is generated deterministically; and based on the intermediate description language DSL and the animation action template, a corresponding animation trajectory diagram is generated. Construct the correspondence between the data structure state diagram and the animation trajectory diagram, and perform consistency verification. The verification includes: whether the DSL structure is complete, whether the object referenced by the action exists, whether the data structure operation conforms to the rules, whether the data structure state diagram and the animation trajectory diagram are consistent, whether the timeline arrangement is conflicting, whether the nodes and labels exceed the canvas or are occluded, and whether the action semantics in natural language match the actual motion parameters. The final DSL, which has passed verification or been confirmed after repair, is compiled into executable animation instructions and then rendered.

[0009] Furthermore, it also includes a multi-turn dialogue-driven algorithmic animation semantic correction step: Obtain user feedback in natural language regarding the generated animation; Identify the feedback type. If it is algorithmic semantic feedback, convert the user's natural language into an executable constraint patch. The constraint patch includes the feedback object, constraint type, applicable data structure state, preconditions, postconditions, and scope of influence. Based on the constraint patch, inconsistencies in the data structure state diagram or animation trajectory diagram are locally corrected and recompiled. The validated constraint patch will be deposited as a temporary constraint rule within the current session and applied to the animation generation or correction process of subsequent similar data structures.

[0010] Furthermore, it also includes multiple rounds of natural language editing steps: Obtain the user's natural language modification instructions for the generated animation; For each round of modifications, a constraint-aware incremental patch is generated. The patch records the content of the modification, the object of modification, the type of modification, the scope of application, the preconditions, the postconditions, the dependent objects, and the set of constraints that must be satisfied. Before merging the incremental patch into the current animation state, verify that it satisfies data structure invariants and two-level state consistency. Only after the verification passes will the incremental patches be merged, and the affected animation clips will be locally recalculated and rendered.

[0011] Furthermore, it also includes semantic intensity-driven segmented motion rules: decomposing the semantic description of actions in natural language into a starting segment, a main motion segment, and a convergence segment, and configuring different motion durations, velocity curves, and acceleration parameters for different segments.

[0012] Furthermore, it also includes a self-healing step: when an error is detected during consistency verification, the system does not perform a full regeneration, but instead performs local correction of the erroneous part based on the invariants and rules in the constrained knowledge base, and records the repair log.

[0013] Furthermore, the constrained knowledge base stores at least the following for each data structure: algorithmic invariants for judging logical correctness, state transition rules for generating deterministic execution trajectories, animation action templates for mapping state changes to animation clips, and teaching emphasis strategies for determining the visual emphasis methods of key steps.

[0014] Furthermore, the data structure state diagram is used to record the logical state before and after each operation, the animation trajectory diagram is used to record the display changes of the animation object on the timeline, and the consistency check includes checking whether the pointer pointing and element state in the animation trajectory diagram are consistent with the data structure state diagram.

[0015] A second aspect of the present invention also provides a natural language animation generation system based on a large language model, comprising: Interaction layer: Responsible for receiving user input and displaying animation results; A constrained knowledge base is used to store algorithm invariants, state transition rules, animation templates, and teaching emphasis strategies. Intelligent parsing layer: responsible for understanding natural language and generating a preliminary DSL; Data structure logic layer: responsible for deducing the state based on the rules of queues, stacks, linked lists, trees, graphs, etc. Two-layer state verification layer: responsible for checking whether the data structure state diagram and the animation trajectory diagram are consistent; Constraints and Memory Layer: Responsible for managing self-healing and constraint-aware incremental patches; Execution layer: Responsible for compiling the final DSL into executable animation instructions for Canvas or SVG.

[0016] The beneficial effects of this invention are: (1) This invention incorporates a multi-turn dialogue interaction design, coupled with an incremental state memory mechanism, which can maintain overall semantic coherence in multi-turn continuous communication and support operations such as local incremental modification and version rollback of the generated animation. In addition, the system adopts a semantically driven segmented motion rule design, which accurately maps the adverb descriptions in everyday language to the speed and acceleration change curves of the animated characters, making the generated animation actions more in line with real-world logic, and greatly improving the smoothness and visual expressiveness.

[0017] (2) This invention combines multiple technologies such as natural language understanding, deep learning animation generation, program compilation and visualization interaction, effectively solving the needs of ordinary users to quickly and cost-effectively produce animations. It can be widely adapted to various scenarios such as education, popular science, and leisure and entertainment, and provides a practical and reliable automated animation generation technology solution.

[0018] (3) This invention does not simply turn text directly into animation, but constructs a complete link from natural language to structured DSL, and then to executable animation instructions. Through DSL self-repair, multi-round incremental memory and semantically driven motion rules, the system can improve the stability, interpretability and interactive experience of natural language animation generation, and is suitable for scenarios such as data structure teaching, popular science demonstration and lightweight animation creation. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art 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 effort.

[0020] Figure 1 The overall flowchart of the method of this invention. Detailed Implementation

[0021] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to embodiments and accompanying drawings. The content mentioned in the embodiments is not intended to limit the present invention.

[0022] like Figure 1 As shown, this invention provides a natural language animation generation method based on a large language model, comprising: Receive natural language descriptions from user input; The large language model is invoked, and combined with a pre-built knowledge base containing corresponding data structure constraints, the natural language description is semantically parsed to generate a structured animation intermediate description language (DSL). It needs further explanation that the system calls a large language model to perform semantic parsing on the user's input natural language, identifying the data structure type, initial state, operation steps, animation objects, pointer annotations, movement methods, and style requirements. To avoid pointer errors, state errors, and missing key teaching steps that occur when the large language model directly generates animations, a constraint-based knowledge base for generating data structure algorithm animations is constructed. This knowledge base differs from ordinary text knowledge bases; it does not merely store data structure concept descriptions but includes a knowledge base containing corresponding data structure constraints, storing algorithm invariants, state transition rules, animation action templates, action dependencies, and teaching emphasis strategies. After parsing the user's natural language, the system calls the corresponding rules from the knowledge base based on the data structure type. The state transition rules generate the algorithm execution trajectory, the algorithm invariants verify the trajectory's correctness, the animation action templates generate visual actions, and the teaching emphasis strategies determine the positions of highlighted, paused, slow-motion display, and explanatory text.

[0023] The knowledge base is built around the scenario of generating animations for data structure algorithms and is organized according to data structure type, algorithm operation type, and teaching demonstration objectives. The knowledge base includes at least three categories of content: algorithm semantic knowledge, animation expression knowledge, and teaching strategy knowledge.

[0024] Algorithmic semantics is used to describe the operation rules, state transition relationships, and invariants of different data structures. For example, queue knowledge records that enqueueing occurs at the rear of the queue, dequeueing occurs at the front of the queue, `front` points to the front of the queue, and `rear` points to the rear of the queue; linked list knowledge records the predecessor node, successor node, and pointer reconnection relationships in insertion and deletion operations; graph traversal knowledge records the access order rules of BFS and DFS.

[0025] Animated representations are used to describe the animation templates and action dependencies corresponding to algorithm state changes. For example, the queue enqueue operation corresponds to node creation, node movement to the tail of the queue, and rear pointer update; the queue dequeue operation corresponds to highlighting the head of the queue, node removal, node fading out, remaining nodes moving forward, and front pointer update; the linked list deletion operation corresponds to highlighting the node to be deleted, highlighting the predecessor pointer, pointer reconnection, and node fading out.

[0026] The teaching strategy knowledge is used to describe the key display methods in different algorithm operations. For example, for the linked list deletion operation, the system sets the pointer reconnection process as the key step; for the queue dequeue operation, the system sets the removal of the head element and updating the front pointer as key steps; for the sorting operation, the system sets the comparison, swap, and reordering as key steps. The system can automatically add highlights, pauses, slow playback, and text descriptions according to this teaching strategy.

[0027] During animation generation, the system retrieves corresponding algorithm rules and animation templates from the knowledge base based on the data structure type and operation sequence parsed from user input. Subsequently, the system uses algorithmic semantic knowledge to generate the algorithm execution trajectory and then uses animation representation knowledge to convert the trajectory into a group of animated actions. After generation, the system again calls upon the algorithm invariants and action dependencies in the knowledge base to verify the consistency between the algorithm trajectory and the animation trajectory. If inconsistencies are found, the system performs local repairs according to the repair strategies in the knowledge base.

[0028] In this way, the knowledge base is not only used to assist large language models in understanding natural language, but also directly participates in the process of algorithm trajectory generation, animation motion arrangement, error detection and automatic repair, thereby improving the correctness and stability of the animation generation results.

[0029] In one embodiment of the present invention, algorithm invariants are used to determine whether the logic is correct.

[0030] For example: Queue invariants: front points to the front of the queue, rear points to the rear of the queue.

[0031] Stack invariants: top points to the top of the stack.

[0032] Linked list invariant: The next pointer of a node must be connected to a valid successor node.

[0033] Binary tree invariants: The parent-child hierarchy must be maintained.

[0034] Graph traversal invariants: BFS visits in queue order, DFS visits in stack or recursive order.

[0035] State transition rules are used to generate algorithm trajectories from operations.

[0036] For example: enqueue(x): Adds x to the rear of the queue and updates rear.

[0037] dequeue(): Removes the head element of the queue and updates front.

[0038] push(x): Add x to the top of the stack and update top.

[0039] delete(node): Sets the predecessor node to the successor node of the deleted node.

[0040] Animation motion templates are used to turn algorithm state changes into animations.

[0041] For example: Enqueue action template: Node appears → Move to the end of the queue → rear update.

[0042] Departure animation template: Highlight head of the queue → Move out → Fade out → Move remaining nodes forward → Update front.

[0043] Linked list deletion template: Highlight predecessor → Highlight node to be deleted → Reconnect pointers → Fade out node.

[0044] The teaching emphasizes strategies for deciding where to slow down, where to highlight, and where to add text descriptions.

[0045] For example: When de-queueing, the principle of "first in, first out" is emphasized.

[0046] When deleting from a linked list, it is emphasized that "the predecessor node reconnects to the successor node".

[0047] In graph BFS, the emphasis is on "enqueue, dequeue, and access markers".

[0048] When sorting, the emphasis is on "comparison, swapping, and returning to their original positions".

[0049] Based on the operation sequence of the intermediate description language DSL and the state transition rules in the constraint knowledge base, a data structure state diagram is generated deterministically; and based on the intermediate description language DSL and the animation action template, a corresponding animation trajectory diagram is generated. It should be further explained that, to avoid the generated animation being playable on screen but with incorrect actual data structure logic, this invention further introduces a two-layer state representation of a data structure state diagram and an animation trajectory diagram. The data structure state diagram is used to record the logical state before and after each operation, such as node sets, element order, pointer pointing, edge relationships, or hierarchical relationships; the animation trajectory diagram is used to record the display changes of the animated object on the timeline, such as object creation, movement, fade-out, pointer update, label display, and color change.

[0050] Construct the correspondence between the data structure state diagram and the animation trajectory diagram, and perform consistency verification. The verification includes: whether the DSL structure is complete, whether the object referenced by the action exists, whether the data structure operation conforms to the rules, whether the data structure state diagram and the animation trajectory diagram are consistent, whether the timeline arrangement is conflicting, whether the nodes and labels exceed the canvas or are occluded, and whether the action semantics in natural language match the actual motion parameters. It's important to further explain that the system establishes a correspondence between the two types of state diagrams, ensuring that every data structure state change is reflected in the animation, and that every key animation action can be traced back to its corresponding data structure operation. After generating the initial DSL and the two-layer state diagram, the system performs consistency checks and constraint checks to deduce the motion trajectory. These checks include: whether the DSL structure is complete, whether the objects referenced by the actions exist, whether the data structure operations conform to the rules, whether the data structure state diagram and the animation trajectory diagram are consistent, whether the timeline arrangement conflicts, whether nodes and labels exceed the canvas or are occluded, and whether the action semantics in natural language match the actual motion parameters. For example, in a queue animation, the `rear` pointer should always point to the rear element, and the `front` pointer should always point to the front element; in a linked list deletion animation, it's not enough to simply show the node disappearing; the process of the predecessor node reconnecting to the successor node should also be shown. Through this verification method, the system can detect semantic errors that are difficult to find with ordinary syntax checks.

[0051] The final DSL, which has passed verification or been confirmed after repair, is compiled into executable animation instructions and then rendered.

[0052] This invention also includes multi-turn dialogue-driven algorithmic animation semantic correction, specifically: After generating the initial animation, the system allows users to provide feedback and corrections using natural language. Unlike ordinary partial animation editing, this method first identifies the type of user feedback, categorizing it into visual style feedback, motion performance feedback, teaching emphasis feedback, and algorithm semantic feedback.

[0053] Among them, visual style feedback is used to adjust display attributes such as color, font, line thickness, and node size; motion performance feedback is used to adjust animation parameters such as movement speed, easing mode, and pause time; teaching emphasis feedback is used to add highlights, pauses, explanatory text, or key annotations; and algorithm semantic feedback is used to correct data structure state, pointer relationships, access order, or operation logic.

[0054] For algorithmic semantic feedback, the system converts the user's natural language into an executable constraint patch. This constraint patch includes at least the feedback object, constraint type, applicable data structure state, preconditions, postconditions, and scope of influence. For example, when a user states "rear should point to the number 7," the system converts this feedback into the constraint "in the current queue state, the rear pointer should point to the tail element," and checks if the current tail element in the algorithmic semantic trajectory is the number 7. If the check matches, the system corrects the position of the rear pointer in the animation trajectory accordingly; if the check doesn't match, it further checks for errors in the original operation sequence or state deduction.

[0055] After a constraint patch is generated, the system analyzes its impact. If the patch only affects the current time slice, only the current animation segment is recompiled. If the patch affects subsequent states, such as pointer update timing or node lifecycles, the system performs partial recompilation of related subsequent segments. After recompilation, the system re-executes the consistency check between the algorithm's semantic trajectory and the animation trajectory. Only after the check passes will the correction result be merged into the current normalized animation state.

[0056] Furthermore, for algorithmic semantic feedback that passes verification, the system can consolidate it into temporary constraint rules within the current session and apply it to subsequent similar animation steps. For example, in a queue animation, after the user corrects the `rear` pointer, the system will automatically check whether `rear` points to the tail of the queue in all subsequent enqueue operations; in a linked list deletion animation, after the user points out the need to show pointer reconnection, the system will automatically supplement the animation process of the predecessor node connecting to the successor node in subsequent linked list deletion steps.

[0057] Through the above mechanism, the system can continuously correct the animation results in multiple rounds of dialogue, so that user feedback is no longer just a one-time screen modification, but is transformed into verifiable and reusable algorithmic animation constraints, thereby improving the correctness of data structure animation generation and interaction efficiency.

[0058] In one embodiment of the present invention, after the system generates a queue animation, the user finds that the rear pointer is displayed incorrectly, so he / she enters: "This rear arrow is wrong, the number 7 should point to 7 after being enqueued." Upon receiving the feedback, the system first determines that it is not a simple style modification, but rather an algorithmic semantic correction. The system extracts the correction object as a `rear` pointer from the feedback, with the constraint that `rear` should point to the number 7 after it has been enqueued. Subsequently, the system queries the current algorithmic semantic trajectory and confirms that the queue state after the number 7 has been enqueued is 3, 5, 7, with the number 7 at the tail. Therefore, the system determines that the feedback is consistent with the queue invariant and converts it into a constraint patch.

[0059] Next, the system checks the movement of the rear pointer in the animation trajectory diagram. If the rear pointer is still stuck at number 3 or number 5, the system determines that the animation trajectory is inconsistent with the algorithm's semantic trajectory. The system automatically corrects the rear pointer animation based on the constraint patch, so that it moves to the position of number 7 after the enqueue of number 7 is completed. If this correction affects the timeline of subsequent dequeue animations, the system will adjust the relevant time slices accordingly.

[0060] After the correction is completed, the system re-executes a consistency check to confirm that the rear pointer position after the number 7 is enqueued, the subsequent dequeue action, and the final queue state all conform to the first-in-first-out (FIFO) rule. Once the check passes, the system merges the correction into the current animation state and records the constraint rules corresponding to this user feedback. During subsequent queue animation generation or modification in the current session, the system will automatically check whether the rear pointer always points to the tail element to prevent similar errors from recurring.

[0061] This invention also includes multi-round natural language editing. Specifically, after the user generates the first version of the animation, they can continue to input modification commands such as "move the number 7 slower," "change the queue box to blue," "undo the previous modification," and "make the dequeue process more obvious." For this scenario, the system does not regenerate the complete animation every time, but maintains a currently valid, standardized animation state and generates incremental patches for each round of modifications. Unlike ordinary field difference records, the incremental patches in this invention are constraint-aware incremental patches. Each patch, in addition to recording the modification content of this round, also records the modification object, modification type, scope, preconditions, postconditions, dependent objects, and the set of constraints that must be satisfied.

[0062] In one embodiment of the invention, when a user inputs "slow down the movement speed of number 7," the system determines that the modification only applies to the enqueue action of number 7 and should not change the enqueue process of numbers 3 and 5, nor should it change the final state of the queue. The incremental patch generated by the system not only records the changes in the movement duration and speed curve of number 7, but also records the start time of subsequent dequeue actions that the modification may affect. Before merging the patch into the current animation state, the system checks whether number 7 has still moved to the tail position, whether the rear pointer still points to number 7 after enqueue completion, and whether subsequent dequeue actions are still executed in the correct order. Only through data structure invariant verification and two-level state checks can this be achieved. Figure 1 Only patches for consistency checks, timeline conflict detection, and layout checks can be merged into the current normalized animation state.

[0063] By employing a constraint-aware incremental patching mechanism, the system can avoid the problem of local modifications disrupting the overall animation logic during multiple rounds of natural language editing. For example, if a user only changes the color of a node, the system only changes the style of that node, without affecting the data structure state or timeline; if a user only slows down the enqueue speed of a node, the system only readjusts that action and its subsequent affected time slices, without regenerating the entire animation. This ensures the continuity of multi-round editing while avoiding semantic drift and loss of historical content caused by repeated regeneration of the large language model.

[0064] This invention also includes semantic intensity-driven segmented motion rules. Specifically, the system converts descriptions in natural language such as "slowly," "smoothly," "suddenly," and "gently" into corresponding motion parameters. A complete motion can be divided into a starting segment, a main motion segment, and a closing segment. The starting segment controls the process of the object moving from a standstill to the start of movement, the main motion segment completes the main displacement, and the closing segment brings the object to a stable stop at the target position. For example, "slowly entering" corresponds to a longer motion duration and smoother speed changes; "suddenly appearing" corresponds to a faster starting speed; and "smoothly moving out" reduces sudden speed changes, making the object leave the screen more naturally. In this way, the generated animation accurately expresses the data structure process without appearing stiff.

[0065] This invention also includes a self-healing process, specifically: this process does not completely regenerate the animation, but rather, while preserving the original semantics and existing animation structure as much as possible, it locally corrects the erroneous parts. The self-healing is based not only on syntax rules and parameter boundaries, but also on data structure invariants and two-level states. Figure 1 Consistency rules are implemented. For example, if the system detects that the `rear` pointer in a queue animation is incorrectly bound to the head element, it will automatically correct it to the tail element based on the current queue state; if a linked list deletion animation lacks a reconnection action where the predecessor node points to the successor node, the system will automatically complete the pointer change process; if two actions overlap on the timeline, the time slices will be readjusted according to the order of operations; if a node position exceeds the canvas, the layout will be recalculated or the node spacing will be reduced; if a "smooth move out" is configured as an abrupt jump action, the motion curve will be readjusted to better match the user's description. After each repair, the system will also generate a repair record, recording the error type, the content before repair, the content after repair, and the reason for repair, facilitating subsequent inspection and debugging.

[0066] Example 1: Generation, Verification, and Semantic Correction of Queue Animations User input: Please generate a queue animation: First, display an empty queue, then the numbers 3, 5, and 7 slowly enter the rear of the queue from the right side in sequence, followed by the number 3 smoothly moving out from the front of the queue, with arrows indicating front and rear.

[0067] System Response Flow: Upon receiving the instruction, the system first performs semantic parsing on the text content. The system identifies the data structure corresponding to the animation as a queue, initially in an empty queue. It requires sequentially enqueuing the numbers 3, 5, and 7, followed by a dequeue operation. Simultaneously, the system identifies the enqueue direction as from the right, the enqueue action semantics as "slow," and the dequeue action semantics as "smooth." Furthermore, the animation needs to display two pointers, `front` and `rear`.

[0068] After semantic parsing is complete, the system generates an animation DSL draft. This draft is not directly written as low-level animation code, but rather records the content that the animation needs to include in a structured way, such as the canvas scene, queue container, number nodes, front pointer, rear pointer, enqueue operation, dequeue operation, action sequence, and basic styles. The advantage of this approach is that the system can subsequently perform state deduction, verification, and repair based on this structured description, rather than dealing with a piece of uncontrollable animation code.

[0069] Subsequently, the system hands over the operation sequence to the queue state simulation module for execution. Initially, the queue is empty, and neither `front` nor `rear` points to a specific element. When the number 3 is enqueued, the queue contains only one element, making 3 both the head and tail of the queue; both `front` and `rear` point to 3. When the number 5 is enqueued, it is appended to the tail, and the queue order becomes 3, 5. At this point, `front` still points to 3, and `rear` points to 5. When the number 7 is enqueued, the queue order becomes 3, 5, 7. Again, `front` still points to 3, and `rear` points to 7. Finally, during the dequeue operation, the system, based on the first-in, first-out (FIFO) principle, determines that the element removed must be the head element, number 3. After dequeueing, the queue contains only the numbers 5 and 7. `front` is then updated to point to 5, and `rear` still points to 7.

[0070] During the aforementioned state simulation, the system synchronously constructs a data structure state diagram. This state diagram describes the logical state of the queue before and after each operation, and includes at least the node set, queue order, front pointer position, rear pointer position, and operation type. In this embodiment, the data structure state diagram records the empty queue state, the state after number 3 is enqueued, the state after number 5 is enqueued, the state after number 7 is enqueued, and the state after number 3 is dequeued. Through this state diagram, the system can clearly understand the logical impact of each operation on the queue structure.

[0071] After completing the state simulation, the system calculates the node positions according to the horizontal layout rules of the queue. The left side of the queue represents the head, and the right side represents the tail. Number 3 is placed in the first position after being enqueued; number 5 is placed to the right of number 3; and number 7 is placed to the right of number 5. When number 3 is dequeued, the system moves it out of the queue from the head direction and adjusts the remaining numbers 5 and 7 to the left, making number 5 the new head. The positions of the front and rear pointers are automatically updated as the queue state changes, thus preventing labeling errors caused by arbitrary pointer assignment by the model.

[0072] After the layout is determined, the system further generates a corresponding animation trajectory diagram. The animation trajectory diagram describes the visual changes of the animated object on the timeline, including at least object creation, object movement, object disappearance, pointer updates, label display, and style changes. In this embodiment, the animation trajectory diagram records the following: the display of an empty queue container; numbers 3, 5, and 7 entering from the right and moving to the rear of the queue; the front and rear pointers pointing to different nodes at different stages; number 3 being highlighted, moved to the left, and faded out when dequeued; numbers 5 and 7 moving to the left as a whole after number 3 is dequeued; and the front pointer eventually moving to the position of number 5.

[0073] Next, the system establishes a binding relationship between the data structure state diagram and the animation trajectory diagram. Specifically, each queue operation must find a corresponding visual segment in the animation trajectory diagram. For example, enqueuing the number 3 corresponds to the continuous animation process of "creating the number 3 node—the node moves from the right to the rear of the queue—updating the front and rear pointers"; dequeuing the number 3 corresponds to the continuous animation process of "highlighting the head node—the node moves out—the node fades out—the remaining nodes move to the left—updating the front pointer". Through this binding relationship, the system ensures that every key action in the animation can be traced back to the change in the data structure state, and at the same time, every key change in the data structure state can be reflected in the animation.

[0074] After the animation is generated, the system performs a two-layer state consistency check. This check not only verifies the existence of objects and actions but also verifies whether the animation trajectory graph is consistent with the data structure state graph. Specifically, the system checks the following: First, after each enqueue, does the rear pointer point to the current tail element in the animation? Second, does the node removed during dequeueing actually become the head element in the data structure state graph? Third, after dequeueing, does the front pointer move to the new head element? Fourth, do nodes that have been dequeued and faded out still appear in subsequent queue states or subsequent animations? Fifth, does the node movement order conform to the first-in, first-out (FIFO) logic of the queue?

[0075] For example, the x process is repeated, and errors are automatically corrected based on queue invariants.

[0076] While performing consistency checks, the system also performs routine constraint checks. The system checks whether all nodes and pointers exist, whether all objects referenced by actions are valid, whether enqueueing and dequeueing conform to queue rules, whether there are timeline conflicts, whether nodes exceed the canvas, and whether text and arrows obscure key content. If it finds that the enqueueing action for number 5 has not yet been completed while number 7 has already started enqueuing, causing screen overlap, the system will automatically adjust the start and end times of the two actions. If it finds that the movement speed of a node is inconsistent with the description of "slow entry," the system will extend the action duration and adjust the speed curve. If it finds that the head element has been dequeued but the front pointer has not been updated, the system will supplement or correct the corresponding pointer movement action.

[0077] After verification and repair, the system generates segmented motion rules based on the semantics of "slow entry" and "smooth exit." For the enqueue action, the system sets a longer movement duration and a smoother start and end process, allowing users to clearly see elements entering the queue. For the dequeue action, the system reduces the abruptness of the motion and connects actions such as highlighting, moving, fading out, and shifting the remaining elements to the left, making the dequeue process more intuitive. Therefore, the animation is not only logically correct but also more suitable for teaching demonstration scenarios in terms of presentation.

[0078] Finally, the system hands over the repaired target DSL to the animation compilation module. The compilation module expands each data structure operation into front-end executable animation instructions, and the timeline scheduler arranges the appearance, movement, pointer updates, and style changes of each object. The rendering layer draws the animation using Canvas or SVG, and the user ultimately sees a complete queue tutorial animation: an empty queue appears, numbers 3, 5, and 7 enter the rear of the queue from the right in sequence, the front and rear pointers update as the queue state changes, then number 3 smoothly moves out of the front of the queue, the remaining elements are rearranged, front points to number 5, and rear points to number 7.

[0079] Example 2: Multi-turn Natural Language Editing After viewing the animation and generating it, the user can continue to input: "Slow down the movement speed of the number 7 and change the queue box to blue." The system will determine that this is a partial modification to the existing animation, rather than regenerating the entire animation.

[0080] In response to this modification, the system first identifies two editing intentions: one is to modify the motion parameters of the enqueue action corresponding to the number 7; the other is to modify the color style of the queue container. Subsequently, instead of directly regenerating the entire animation, the system generates constraint-aware incremental patches for this round of modifications. Unlike ordinary incremental records, these constraint-aware incremental patches not only record the modified content but also the modified object, modification type, scope, preconditions, postconditions, dependencies, and the set of constraints that must be satisfied.

[0081] For the modification "slow down the movement speed of the number 7," the system-generated incremental patch will record: the modification targets the enqueue action of the number 7, the modification content is to extend the movement duration and reduce the movement speed, the scope is limited to the enqueue segment of the number 7 and its subsequent affected timeline segments, the prerequisite is that the number 7 node must have been created, the postcondition is that the number 7 still needs to reach the tail position, and the rear pointer must still point to the number 7 after the action is completed. At the same time, the patch will also record its dependencies, that is, after the end time of the enqueue action of the number 7 changes, the start time of the subsequent dequeue action may need to be postponed.

[0082] For the modification "change the queue box to blue", the incremental patch generated by the system will record: the modified object is the queue container, the modified content is to update the container color style, the scope of effect is limited to the container display attributes, it does not affect the data structure state diagram, and does not change the queue order, node position and pointer logic.

[0083] After generating an incremental patch, the system first performs validation on the patch before deciding whether to merge it into the current normalized animation state. For the speed modification patch for the number 7, the system checks whether the number 7 is still enqueued in the correct order after speed adjustment, whether it still ends at the end of the queue, whether the rear pointer is still updated at the correct time, and whether subsequent dequeue actions are consistent with the new timeline. For the queue box color modification patch, the system checks whether the new color will make the container boundary invisible and whether it will affect the readability of nodes and pointers. If all the above constraints are met, the system merges the patch into the current animation state and only recalculates the affected animation segments, without regenerating the entire animation.

[0084] If the user subsequently enters "undo the previous color change," the system, based on the aforementioned constraint-aware incremental patch record, will only roll back the patch corresponding to "container color change," without affecting the patch corresponding to "number 7 speed adjustment." Thus, this invention enables selective rollback and continuous editing, ensuring consistency in animation state, data structure logic, and timeline relationships across multiple dialogue rounds.

[0085] In summary, the method of this invention does not simply convert text directly into animation, but rather constructs a complete chain from natural language parsing, structured DSL description, data structure state deduction, two-layer state consistency verification, to executable animation output. Through the correspondence verification between the data structure state diagram and the animation trajectory diagram, the system can ensure that the animation performance is consistent with the semantics of the data structure; through constraint-aware incremental patching, the system can ensure that multiple rounds of natural language modifications will not disrupt the existing animation logic; and combined with a self-healing mechanism and semantically driven motion rules, it can improve the stability, interpretability, and interactive experience of natural language data structure animation generation, making it suitable for scenarios such as data structure teaching, algorithm demonstration, popular science explanation, and lightweight animation creation.

[0086] The above embodiments are preferred implementations of the present invention. In addition, the present invention can be implemented in other ways. Any obvious substitutions without departing from the concept of the present technical solution are within the protection scope of the present invention.

[0087] To facilitate understanding by those skilled in the art of the improvements of this invention over the prior art, some of the accompanying drawings and descriptions have been simplified, and for clarity, some other elements have been omitted from this application. Those skilled in the art should realize that these omitted elements may also constitute the content of this invention.

Claims

1. A natural language animation generation method based on a large language model, characterized by, include: Receive natural language descriptions from user input; The large language model is invoked, and combined with a pre-built knowledge base containing corresponding data structure constraints, the natural language description is semantically parsed to generate a structured animation intermediate description language (DSL). Based on the operation sequence of the intermediate description language DSL and the state transition rules in the constraint knowledge base, a data structure state diagram is generated deterministically; and based on the intermediate description language DSL and the animation action template, a corresponding animation trajectory diagram is generated. Construct the correspondence between the data structure state diagram and the animation trajectory diagram, and perform consistency verification. The verification includes: whether the DSL structure is complete, whether the object referenced by the action exists, whether the data structure operation conforms to the rules, whether the data structure state diagram and the animation trajectory diagram are consistent, whether the timeline arrangement is conflicting, whether the nodes and labels exceed the canvas or are occluded, and whether the action semantics in natural language match the actual motion parameters. The final DSL, which has passed verification or been confirmed after repair, is compiled into executable animation instructions and then rendered.

2. The natural language animation generation method based on a large language model as described in claim 1, characterized in that, It also includes a multi-turn dialogue-driven algorithmic animation semantic correction step: Obtain user feedback in natural language regarding the generated animation; Identify the feedback type. If it is algorithmic semantic feedback, convert the user's natural language into an executable constraint patch. The constraint patch includes the feedback object, constraint type, applicable data structure state, preconditions, postconditions, and scope of influence. Based on the constraint patch, inconsistencies in the data structure state diagram or animation trajectory diagram are locally corrected and recompiled. The validated constraint patch will be retained as a temporary constraint rule for the current session and applied to the animation generation or correction process of subsequent similar data structures.

3. The natural language animation generation method based on a large language model as described in claim 1, characterized in that, It also includes multiple rounds of natural language editing steps: Obtain the user's natural language modification instructions for the generated animation; For each round of modifications, a constraint-aware incremental patch is generated. The patch records the content of the modification, the object of modification, the type of modification, the scope of application, the preconditions, the postconditions, the dependent objects, and the set of constraints that must be satisfied. Before merging the incremental patch into the current animation state, verify that it satisfies data structure invariants and two-level state consistency. Only after the verification passes will the incremental patches be merged, and the affected animation clips will be locally recalculated and rendered.

4. The natural language animation generation method based on a large language model as described in claim 1, characterized in that, It also includes semantic intensity-driven segmented motion rules: decomposing the semantic description of actions in natural language into a starting segment, a main motion segment, and a convergence segment, and configuring different motion durations, velocity curves, and acceleration parameters for different segments.

5. The natural language animation generation method based on a large language model as described in claim 1, characterized in that, It also includes a self-healing step: when an error is detected during consistency verification, the system does not perform a full regeneration, but instead performs local correction of the erroneous part based on the invariants and rules in the constrained knowledge base and records the repair log.

6. The natural language animation generation method based on a large language model as described in any one of claims 1-5, characterized in that, The constrained knowledge base stores at least the following for each data structure: algorithmic invariants for judging logical correctness, state transition rules for generating deterministic execution trajectories, animation action templates for mapping state changes to animation clips, and teaching emphasis strategies for determining the visual emphasis methods of key steps.

7. A natural language animation generation method based on a large language model as described in any one of claims 1-5, characterized in that, The data structure state diagram is used to record the logical state before and after each operation, the animation trajectory diagram is used to record the display changes of the animation object on the timeline, and the consistency check includes checking whether the pointer pointing and element state in the animation trajectory diagram are consistent with the data structure state diagram.

8. A natural language animation generation system based on a large language model, used to implement the method as described in any one of claims 1-7, characterized in that, include: Interaction layer: Responsible for receiving user input and displaying animation results; A constrained knowledge base is used to store algorithm invariants, state transition rules, animation templates, and teaching emphasis strategies; Intelligent parsing layer: responsible for understanding natural language and generating a preliminary DSL; Data structure logic layer: responsible for deducing the state based on the rules of queues, stacks, linked lists, trees, graphs, etc. Two-layer state verification layer: responsible for checking whether the data structure state diagram and the animation trajectory diagram are consistent; Constraints and Memory Layer: Responsible for managing self-healing and constraint-aware incremental patches; Execution layer: Responsible for compiling the final DSL into executable animation instructions for Canvas or SVG.