Background
Animations commonly used by game editors, which are relatively common in the market today, are skeleton animation, key frame animation, and sequence frame animation. The skeleton animation makes key frames for the bones connected with the joints to drive the skin to complete animation, and has the advantages of smoother and natural action of the character and convenience in changing the skin. The sequential frames are pictures continuously switched in a certain time sequence to achieve visual coherent action, and the method has the advantages of simple manufacture, but has the obvious defects of large resource occupation space and large performance consumption. The key frame animation mainly aims at the card frames of three basic properties of position, rotation and scaling to complete the action of the object. For example, currently, the popular Spine, Unity, and the like, the properties that can be used for animation in the editor are only three basic properties of position, rotation, and scaling, all the implemented effects are limited, and if more complex effects need to be implemented, for example, effects such as space tearing or character wall penetrating, etc., the code has to be manually written to implement the effects.
CocoStudio is a set of permanent free game development tool set based on the coss 2d-x major, helps developers to quickly create game resources, quickly creates most of fussy game development work by using an editor, and comprises a plurality of game editors, a UI editor, an animation editor, a scene editor and a data editor, which are core in game development and used for processing animation resources, UI interfaces, game scenes and game data in games. Therefore, the effects of high efficiency, high quality, low risk and low cost are achieved.
The animation editor is used for editing dynamic game resources such as character animation, special effect animation, scene animation and the like used in the game. The main user is a art designer, who can import the drawn picture resources into an animation editor, then edit various animation effects according to the planned design, and demonstrate the edited contents in the editor. The animation editor supports various animation editing modes such as key frame animation, sequence frame animation, skeleton animation and the like. And various resource optimization modes such as broken graph derivation, whole graph derivation and the like are supported. Meanwhile, the animation editor supports the analysis of Flash, PSD and Plist resources.
For example, chinese patent document (publication No. CN 102541567A) discloses a 2D mobile phone game engine and a method for being compatible with an operating system of a mobile phone, in which an external application program can call a driving service or an application service in the operating system, so that the application program and the operating system can be separated, the operating system can be compatible with different application programs, and two problems of too heavy platform transplantation in mobile phone game development can be solved, thereby realizing cross-platform and simplifying platform transplantation work. For another example, chinese patent document (publication No. CN 104267963A) discloses a cross-platform role-playing network game client engine, which includes a game editor and a game engine, wherein the game editor is used to dynamically edit game data by using a known method, and visually edit each module in a game, and the game engine is used to create various tool modules required for compiling a game, so as to greatly shorten the development period of web pages and mobile phone game developers developing similar games.
The animation attributes supported in the current animation editor are few, and cannot be expanded, so that the animation effect which can be realized by the editor is very limited, and animation with richer effect is difficult to produce. Therefore, in order to solve the problems in the prior art, it has become an important task to develop a method for infinitely expanding animation properties in an animation system.
Disclosure of Invention
The invention aims to provide an animation system and method capable of infinitely expanding animation attributes, and aims to make corresponding attribute animation by setting the attributes of an object and complete complex actions and transformation of the object by driving attribute changes through a time axis.
The technical scheme of the invention is as follows:
in order to solve the technical problem, the invention provides a method for infinitely extending animation attributes, which integrates an animation system capable of infinitely extending animation attributes into an editor, continuously extends different attributes according to different objects, realizes the setting of object attributes in the animation editor, synchronously generates corresponding frames according to the change of the object attributes, stores the corresponding frames in a time axis, records the attribute change of the objects through the time axis, and carries out animation by singly or randomly combining the attribute changes recorded by the time axis, thereby completing the extension of the animation attributes.
The animation attributes supported in the current animation editor are few, and are mostly limited to three basic attributes of displacement, rotation and scaling, the achievable effect is very limited, if some complex effects need to be achieved, such as effects of space tearing, wall penetrating and the like, artists and artists cannot achieve the effects through the editor, and can only be handed to developers to write codes additionally, so that the communication cost and the development difficulty are increased, if the fine animation effects are achieved through code debugging without the editor, the time and the energy consumed by code debugging are much larger than those consumed by visual editing preview, and the adjustable final effects also have differences. Compared with the prior art, different attributes are expanded according to different objects, the change of the objects is realized by changing the attributes or other object attributes, the attributes are overlapped, the attribute change is further changed in an editor, the attribute change is recorded in a time axis, for example, the effect of wall penetration can be realized by expanding mixed combination displacement, and space tearing can be realized by expanding some characteristics of beveling and lighting, so that the development efficiency is greatly improved, the difficulty is reduced, and the development and communication cost is saved.
The animation system capable of infinitely expanding the attributes of the animation comprises two core parts, namely an object capable of setting the attributes and a time axis for recording attribute changes, wherein the object can be a scene, a role, a map, a UI (user interface), special effect particles, a sprite, a light source and the like, different attributes can be expanded according to different objects, for example, the light intensity and the irradiation range of light are used for making the animation, the sprite can be used for making the animation by mixing, and the particles can be used for making the animation by directions and the like. The time axis records the attribute change of the object within a certain time difference, the recorded attribute change can be independently extracted for animation, and the recorded attribute change can be combined together for animation in a similar way, for example, the oblique cutting and displacement are combined to realize the extrusion effect, the gravity is directly expanded to be the attribute, so that the displacement rotation can be replaced to realize the more real suspension effect, and the attribute of the object is changed in the time axis, so that the continuous dynamic image is formed.
Further, the method comprises the following steps:
step 1, constructing a class with extended attributes as a base class;
step 2, constructing a frame group, storing the frame and finishing frame skipping;
step 3, constructing a base class of a frame, and completing the setting of the object attribute by using two methods of frame starting and frame action;
step 4, constructing a time axis to finish the basic function of the animation system for infinitely expanding the animation attributes;
step 5, extending the attribute of the object in the animation system according to the requirement;
and 6, finishing synchronous preview of the extended animation property in the animation editor.
Further, the step 2 specifically includes:
constructing a frame group, wherein the constructed group is used for storing a series of ordered frames which are in the same time axis, have the same object and the same attribute and are sorted according to indexes, and if the frame uses the relative attribute change of the extended attribute, the group also comprises the initial attribute value of the object; in the sequencing and traversing processes of the frames, object-oriented, polymorphic, sequencing, reflection and other methods of different programming languages need to be fully utilized to achieve the maximum simple effect, and because the attributes of the objects possibly have the effect of mutual influence, the frames need to be grouped according to the attributes during the sequencing;
adding behavior skip frames, searching a current index and a next key frame in a group of the current index by using binary in the skip frames, and directly calling a frame starting method of the frames if the key frame exists in the current index; if no key frame exists, a frame action method is invoked.
Further, the step 3 specifically includes:
constructing a base class of a frame, wherein the base class of the constructed frame comprises an animation object, an attribute change value of the object and a frame index, the attribute change value of the object is a relative attribute change value or an absolute attribute change value, and the frame index is used for expressing a position relation in a time axis;
traversing all frames according to the time sequence, and completing the setting of the object attribute by using two methods of frame starting and frame action; when the time enters the current frame, a frame starting method is called, the attribute of the object is set, and the saved attribute change value of the next frame is updated at the moment; when the time is in the time interval from the current frame to the next frame of the same group, a frame action method is called, the object attribute is calculated by using the current index, the attribute in the frame and the attribute change value of the next frame, and the attribute of the object is set;
in the animation system, the whole animation system is driven to run in time, all frames are traversed according to the time sequence, and the setting of the attributes of the objects is completed in the frames, so that the animation is formed.
Preferably, when the frame effect method is called, the calculation of the time curve can be added to the frame, and the calculation is used for taking the percentage of the attribute change when the frame is acted.
Further, the step 4 specifically includes:
constructing a time axis, wherein the constructed time axis comprises a series of groups, the sequence of the groups in the time axis is defined according to the expanded attribute, and the conversion from time to frame index is completed in the time axis;
adding behaviors, wherein the adding behaviors mainly comprise playing, stopping, frame skipping and slicing behaviors required by the animation, traversing all groups by using the converted frame index during frame skipping and playing, and skipping the frames by the groups;
traversing all groups and rendering once after completing the time conversion, thereby completing the basic function of the animation system for infinitely expanding the animation attributes; however, there are alternative functions to implement some animations, such as reverse rotation, animation blending, etc.
Further, the step 5 specifically includes:
and if the type of each attribute of the object extension does not exist, inheriting the corresponding extension of the base class of the frame, and finishing the setting of the object attribute by two methods of frame starting and frame acting again.
Further, the step 6 specifically includes:
integrating an animation system into an editor, starting an automatic recording frame in the animation editor, setting object attributes through visual operation, and modifying corresponding attributes of different objects in a rendering area or an attribute area;
in the operation process of setting the object attribute, synchronously generating corresponding groups and frames according to the relative transformation or absolute transformation information changed by the object attribute, adding the groups and the frames into a time axis, and synchronizing the rendering in the step 4 in the rendering area of the animation editor, thereby finishing the synchronous preview of the extended animation attribute;
the expanded attribute change is preferably visual, so that the processing can be embodied in the animation effect; of course, the invisible change of the attribute can also be used as an extended attribute in the animation, such as an event frame, and also can be placed at a certain point in the time axis, and when the animation runs at the point, a user-defined event is triggered; the type of each attribute of the object extension has a corresponding frame base class in the animation system, if not, the base class of the frame is inherited to correspondingly extend, and the frame base class stores the position information of the frame in a time axis and the relative change or absolute change information of the object and the object extension attribute; after the automatic recording frame is started in the editor, the corresponding attribute is modified in the rendering area or the attribute area, and the corresponding frame is generated according to the relative transformation or absolute transformation information of the attribute modification and is stored in a time axis; in an editor, a relative property change of a frame record extended property may be better than an absolute change in user experience.
Preferably, the time scaling calculation can be added in the process of completing the conversion from the time to the frame index in the time axis, and the calculation is used as the speed change processing of the animation playing.
The invention has the technical effects that:
the invention provides a method capable of infinitely extending animation attributes, which continuously extends the attributes according to the requirements by inheriting the base class of a frame, thereby reducing the development threshold; the display types of the animation effects are increased after the attributes are expanded, and the display types of the animation effects are further increased through the combination function among the attributes, so that the animation effects are increased on the whole, more effect choices are provided for developers, and the developers can conveniently make the animations with richer pictures; in addition, each attribute expanded by the method can be independently extracted for animation, so that an animation editor can support single-attribute animation, developers can conveniently check the effect of the animation, the animation can be conveniently made better, meanwhile, different animation attributes can be combined to finish some complex and special animation effects, the repeated coordination work of art, animators and development is reduced, the artists can design and realize desired results more perfectly, and the communication and development cost is reduced.
Detailed Description
The following description of the embodiments of the present invention refers to the accompanying drawings:
example 1:
as shown in FIG. 1, the present invention provides a method for extending animation properties infinitely, which integrates an animation system capable of extending animation properties infinitely into an editor, continuously extends different properties according to different objects, realizes the setting of object properties in the animation editor, synchronously generates corresponding frames according to the change of object properties, stores the corresponding frames in a time axis, records the property change of the objects through the time axis, and animates the property change recorded by the time axis individually or in any combination, thereby completing the extension of the animation properties. This embodiment implements the infinitely extended animation property in cos2 d-x.
The method for infinitely extending animation properties comprises the following steps:
step 1, constructing an extended attribute class as a base class, and using a Node as the base class for extending the animation attribute in an animation system;
step 2, constructing a frame group, storing the frame and finishing frame skipping;
setting Timeline, wherein the constructed group is used for storing a series of ordered frames which are in the same time axis, have the same object and the same attribute and are sorted according to indexes, and if the frames use the relative attribute change of the extended attribute, the group also comprises the initial attribute value of the object;
adding behavior skip frames, searching a current index and a next key frame in a group of the current index by using binary in the skip frames, and directly calling a frame starting method of the frames if the key frame exists in the current index; if no key frame exists, calling a frame action method;
step 3, constructing a base class of a frame, and completing the setting of the object attribute by using two methods of frame starting and frame action;
constructing a Frame as a Frame of a base class, wherein the base class of the constructed Frame comprises an animation object, an attribute change value of the object and a Frame index, the attribute change value of the object is a relative attribute change value or an absolute attribute change value, and the Frame index is used for expressing a position relation in a time axis;
traversing all frames according to the time sequence, and completing the setting of the object attribute by using two methods of frame starting and frame action; when the time enters the current frame, a frame starting method is called, the attribute of the object is set, and the saved attribute change value of the next frame is updated at the moment; when the time is in the time interval from the current frame to the next frame of the same group, a frame action method is called, the object attribute is calculated by using the current index, the attribute in the frame and the attribute change value of the next frame, and the attribute of the object is set; when the frame action method is called, the calculation of a time curve can be added into the frame, and the calculation is used for taking the percentage of attribute change when the frame is acted;
step 4, constructing a time axis to finish the basic function of the animation system for infinitely expanding the animation attributes;
constructing an Action Timeline as a Timeline, wherein the constructed Timeline comprises a series of groups, the sequence of the groups in the Timeline is defined according to the expanded attributes, and the conversion from time to frame index is completed in the Timeline; the time scaling calculation can be added in the process of completing the conversion from time to frame index in the time axis and is used for the variable speed processing of animation playing;
adding behaviors, wherein the adding behaviors mainly comprise playing, stopping, frame skipping, slicing and other behaviors required by the animation, the slicing divides the animation into different time segments according to time, and when the frame skipping and the playing are performed, all groups are traversed by using the converted frame indexes, and then the frame skipping is performed by using the groups; the sequencing and traversing methods of the groups need to fully utilize object-oriented, polymorphic, sequencing, reflection and other methods of different editing languages to achieve the maximum simple effect, the effects generated by the setting of partial attributes can influence each other, so the order of the groups in the time axis needs to be ensured, the sequence of the groups in the time axis is defined according to the expanded attributes, and the frames need to be grouped according to the attributes;
traversing all groups and rendering once after completing the time conversion, thereby completing the basic function of the animation system for infinitely expanding the animation attributes; the rest can be selected to realize some functions of animation, such as inversion, animation mixing and the like;
step 5, extending the attribute of the object in the animation system according to the requirement; each attribute type of the object extension has a corresponding frame base class, if not, the base class of the frame is inherited to correspondingly extend, and the setting of the object attribute is completed by two methods of frame starting and frame action, for example, the extended color mixing blend funcframe is used as the extended attribute;
step 6, completing the synchronous preview of the extended animation property in the animation editor;
integrating an animation system into an editor, starting an automatic recording frame in the animation editor in the cos studio, setting object attributes through visual operation, and modifying corresponding attributes of different objects in a rendering area or an attribute area;
in the operation process of setting the object attribute, synchronously generating corresponding groups and frames according to the relative transformation or absolute transformation information changed by the object attribute, adding the groups and the frames into a time axis, and synchronizing the rendering in the step 4 in the rendering area of the animation editor, thereby finishing the synchronous preview of the extended animation attribute.
Example 2:
as shown in FIG. 2, in the development process of extending animation properties, if the development language is different, the method of infinitely extending animation properties may also be different; for example, when a high-level language such as C #, Java, ruby, etc. is used, the method for infinitely extending animation attributes comprises the following steps:
step 1, constructing a frame group, storing frames and finishing frame skipping;
setting Timeline, wherein the constructed group is used for storing a series of ordered frames which are in the same time axis, have the same object and the same attribute and are sorted according to indexes, and if the frames use the relative attribute change of the extended attribute, the group also comprises the initial attribute value of the object;
adding behavior skip frames, searching a current index and a next key frame in a group of the current index by using binary in the skip frames, and directly calling a frame starting method of the frames if the key frame exists in the current index; if no key frame exists, calling a frame action method;
step 2, constructing a base class of a frame, and completing the setting of object attributes through two methods of frame starting and frame action;
constructing a Frame as a Frame of a base class, wherein the base class of the constructed Frame comprises an animation object, an attribute change value of the object and a Frame index, the attribute change value of the object is a relative attribute change value or an absolute attribute change value, and the Frame index is used for expressing a position relation in a time axis;
traversing all frames according to the time sequence, and completing the setting of the object attribute by using two methods of frame starting and frame action; when the time enters the current frame, a frame starting method is called, the attribute of the object is set, and the saved attribute change value of the next frame is updated at the moment; when the time is in the time interval from the current frame to the next frame of the same group, a frame action method is called, the object attribute is calculated by using the current index, the attribute in the frame and the attribute change value of the next frame, and the attribute of the object is set; when the attribute is set, the object is used as the base class of all objects and is realized through reflection, so that the whole framework of animation extension is simpler and is mainly embodied in an animation editor, the PropertyInfo of C # is directly used in the cos studio to set and store the attribute, and the attribute extension is more convenient; when the frame action method is called, the calculation of a time curve can be added into the frame, and the calculation is used for taking the percentage of attribute change when the frame is acted;
step 3, constructing a time axis to finish the basic function of the animation system for infinitely expanding the animation attributes;
constructing an Action Timeline as a Timeline, wherein the constructed Timeline comprises a series of groups, the sequence of the groups in the Timeline is defined according to the expanded attributes, and the conversion from time to frame index is completed in the Timeline; the time scaling calculation can be added in the process of completing the conversion from time to frame index in the time axis and is used for the variable speed processing of animation playing;
adding behaviors, wherein the adding behaviors mainly comprise playing, stopping, frame skipping, slicing and other behaviors required by the animation, the slicing divides the animation into different time segments according to time, and when the frame skipping and the playing are performed, all groups are traversed by using the converted frame indexes, and then the frame skipping is performed by using the groups; the sequencing and traversing methods of the groups need to fully utilize object-oriented, polymorphic, sequencing, reflection and other methods of different editing languages to achieve the maximum simple effect, the effects generated by the setting of partial attributes can influence each other, so the order of the groups in the time axis needs to be ensured, the sequence of the groups in the time axis is defined according to the expanded attributes, and the frames need to be grouped according to the attributes;
traversing all groups and rendering once after completing the time conversion, thereby completing the basic function of the animation system for infinitely expanding the animation attributes; the rest can be selected to realize some functions of animation, such as inversion, animation mixing and the like;
step 4, extending the attribute of the object in the animation system according to the requirement; each attribute type of the object extension has a corresponding frame base class, if not, the base class of the frame is inherited to correspondingly extend, and the setting of the object attribute is completed by two methods of frame starting and frame action, for example, the extended color mixing blend funcframe is used as the extended attribute;
step 5, completing the synchronous preview of the extended animation property in the animation editor;
integrating an animation system into an editor, starting an automatic recording frame in the animation editor in the cos studio, setting object attributes through visual operation, and modifying corresponding attributes of different objects in a rendering area or an attribute area;
in the operation process of setting the object attribute, synchronously generating corresponding groups and frames according to the relative transformation or absolute transformation information changed by the object attribute, adding the groups and the frames into a time axis, and synchronizing the rendering in the step 3 in the rendering area of the animation editor, thereby finishing the synchronous preview of the extended animation attribute.