It is a kind of can infinite expanding animation attributes method
Technical field
The present invention relates to computer program development field, and in particular to one kind can infinite expanding animation category in animation system
The method of property.
Background technology
The general animation of now relatively common on the market game editing machine is skeleton cartoon, key-frame animation and sequence frame
Animation.Skeleton cartoon makes key frame to drive skin to complete animation to the bone connected with joint, and advantage can be that role moves
Make more remarkable fluency, and it is convenient to change skin.Sequence frame is the continuous switching picture in certain sequential, is reached visual coherent dynamic
Make, advantage is to make simple, but distinct disadvantage is big and big compared with to performance consumption resource occupation space.Key-frame animation master
The action of object is completed for position, rotation, three card frames of base attribute of scaling.It is such as popular at present
Spine, Unity etc., the attribute that can be used to make animation in editing machine just only have position, rotation, the basic category of scaling three
Property, the effect of all realizations is limited, and if necessary to realize more complicated effect, such as space tear or role are through walls equivalent
Fruit would have to artificial write code to realize.
CocoStudio is a set of permanent free development of games tool set based on cocos2d-x specialties, helps develop
Person quickly creates game resource, and most of cumbersome development of games work is come into quick Fabrication, CocoStudio using editing machine
Contain several game editing machines of core in development of games, UI editing machines, Animation Editors, Scene Editor, data edition
Device, for processing animation resource, UI interfaces, scene of game, game data in game, is directed to different duties in development teams
Industry carries out depth design, the whole development process of specification, allows in development teams everyone respectively to hold its duty, plays the work of oneself maximum
With.So as to reach high efficiency, high-quality, low-risk, the effect of low cost.
Animation Editors therein is dynamic for editing role animation, special efficacy animation, scene animation for being used in game etc.
The game resource of state.Main user of service is artistic design teacher, and can imported into for drawn picture resource by artistic design teacher
In Animation Editors, then edit various animation effects according to Decision making, and after demonstrating editor in editing machine in
Hold.Animation Editors supports various animation edit modes such as key-frame animation, sequence frame animation, skeleton cartoon.And support broken figure
Derive, the multiple resources optimal way such as whole figure derivation.Animation Editors is supported to Flash, the solution of PSD, Plist resource simultaneously
Analysis.
For example, Chinese patent literature(Publication No.:CN102541567A)Disclose a kind of 2D mobile phone games engine and compatibility
The method of mobile phone operating system, the method external application can with the driving service or application service in call operation system,
Allow that application program and operating system are separated, operating system can solve mobile phone games with compatible different application program
The excessively heavy two large problems of platform transplantation in exploitation, it is cross-platform to realize, simplify platform transplantation work.For another example, Chinese patent
Document(Publication No.:CN104267963A)Disclose a kind of cross-platform role playing network game client engine, including game
Editing machine and game engine, game editing machine are used to edit game data come dynamic by way of both being obtained using finding, to trip
Modules carry out visual edit in play, and game engine is used to write the various tool models needed for playing for foundation, significantly
Shorten webpage, mobile phone games developer and develop the construction cycle of similar game.
The animation attributes supported in current Animation Editors seldom, and cannot be extended, so the editing machine
Attainable animation effect can be very limited, it is difficult to produce the animation of effect more horn of plenty.Therefore, in order to solve in the prior art
The problem of presence, study it is a kind of in animation system can the method for infinite expanding animation attributes have become a vital task.
The content of the invention
Present invention solves the technical problem that be to provide it is a kind of can infinite expanding animation attributes animation system and method, purpose
It is that corresponding attribute animation is made by setting the attribute of object, and answering for object is completed with the change of time shaft driving attribute
Miscellaneous action and conversion.
The technical scheme is that:
In order to solve the above-mentioned technical problem, the invention provides it is a kind of can infinite expanding animation attributes method, can infinitely expand
The animation system for opening up animation attributes is integrated into editing machine, and different attributes are extended according to different object persistences, is compiled in animation
The setting of object properties is realized in volume device, the corresponding frame of the synchronous generation of the change according to object properties is stored in time shaft,
The attribute change of object is recorded by time shaft, and the attribute change that time shaft is recorded is individually or any combination enters action
Draw, so as to complete the extension of animation attributes.
The animation attributes supported in current Animation Editors seldom, are mostly confined to displacement, rotate, scale these three bases
This attribute, it is possible to achieve effect can be very limited, realize some complicated effects if desired, for example space tear, through walls
And other effects, fine arts personnel and animation teacher cannot be realized by editing machine, can only be given developer and be write code completion in addition,
Cause to link up cost, development difficulty increase, realize these trickle animation effects by code debugging not by editing machine
If, code debugging is more much bigger than the time and efforts that visual edit preview is consumed, the final effect to be recalled
Understand gap.Compared with prior art, according to the different attribute of different object extensions, the change of object is all logical to the present invention
Cross and change its attribute or other object properties and realize, and by the superposition of these attributes, and then change attribute note in editing machine
In time shaft, such as effect through walls be able to can just be led to record attribute change by extended hybrid combination displacement, space tear
Some characteristics for crossing extension beveling and light are realized, so greatly improve development efficiency, reduce difficulty, save exploitation
With communication cost.
Can the animation system of infinite expanding animation attributes include the time of object and the record attribute change of settable attribute
Two cores of axle, object can be scene, role, map, UI, special efficacy particle, spirit, light source etc., can be according to object not
With the different attribute of extension, such as light uses up strong and weak, range of exposures and does animation, and spirit can do animation with mixing, and particle can
Animation is done with direction etc..The attribute change of time shaft record object in certain hour difference, the attribute change of record can be single
Solely put forward to carry out animation, can also similarly be combined together carries out animation, for example, will chamfer and displacement combination then can be real
The effect for now extruding, directly extension gravity does attribute can replace displacement rotating to realize more real suspension effect, by
Change the attribute of object in time shaft, so as to form continuous dynamic image.
Further, the described method comprises the following steps:
Step 1, one class of extended attribute of structure are used as base class;
Step 2, one group of frame of structure, preserve frame and simultaneously complete frame-skipping;
Step 3, one base class of frame of structure, are enabled by frame and act on the setting that the two methods complete object properties with frame;
Step 4, structure time shaft, complete the basic function of animation system infinite expanding animation attributes;
Step 5, the attribute for extending object in animation system on demand;
Step 6, in Animation Editors complete extension animation attributes synchronous preview.
Further, the step 2 is specifically included:
Build a group for frame, the group of structure is used to preserving in a series of same timeline, same to object, with attribute by rope
The orderly frame of ejectment sequence, if frame uses the relative priority of extended attribute to change, organizes the also initial category including object
Property value;The object-oriented of programming language, polymorphic, sequence, reflection in needing to make full use of difference in sequence, ergodic process in frame
It is maximized etc. method to reach easy effect, due to being possible to that interactional effect can be produced between the attribute of object, so
Need to be grouped frame by attribute when sequence;
Addition behavior frame-skipping, using next key frame in the group of binary chop to current index and current index in frame-skipping, such as
There is key frame in fruit, then the frame for directly invoking frame enables method in current index;If there is no key frame, then call frame effect
Method.
Further, the step 3 is specifically included:
Build a base class for frame, the base class of the frame of structure include animation object in itself, the attribute change value of object and frame rope
Draw, the attribute change value of the object is relative priority changing value or absolute attribute changing value, and the frame index is used to express
Position relationship in time shaft;
All of frame is traveled through sequentially in time, is enabled by frame and is acted on the setting that the two methods complete object properties with frame;
Method is enabled in call frame when the current frame when the time enters, the attribute of object is set, and update preserved next frame at this moment
Attribute change value;Present frame is in call frame action method in the time interval of same group of next frame when the time, is made
Object properties are calculated with the attribute and the attribute change value of next frame in current index, frame, and the attribute of object is set;
In animation system, the operation of whole animation system is driven with the time, all of frame is traveled through sequentially in time, in frame
Inside completes the setting of the attribute of object, so as to form animation.
Preferably, when call frame action method, the calculating of time graph can also be added in frame, when being acted on for frame
Take the percentage of attribute change.
Further, the step 4 is specifically included:
Time shaft is built, the time shaft of structure includes a series of group, the order organized in the attribute definition time shaft according to extension,
Conversion of the deadline to frame index inside time shaft;
Addition behavior, it is main broadcasting, stopping, frame-skipping, the section behavior needed including animation to add line, in frame-skipping and broadcasting
When, all of group is traveled through using the frame index after conversion, then frame-skipping is carried out with group;
The conversion of time is often completed, all of group is traveled through, rendered once, so as to complete animation system infinite expanding animation category
The basic function of property;But remainder optionally realizes the function of some animations, such as reversion, animation mixing etc..
Further, the step 5 is specifically included:
The attribute of object is extended in animation system on demand, the type of each attribute of object extension has corresponding frame
Base class, if it is not, the base class correspondence for inheriting frame extends, enables again through frame and acts on the two methods completion object with frame
The setting of attribute.
Further, the step 6 is specifically included:
Animation system is integrated into editing machine, automatic record frame is opened in Animation Editors, set by visualized operation
Object properties, are rendering area or attribute area makes the modification of the corresponding attribute of different objects;
In the operating process that object properties are set, Relative Transformation or absolute transformed the synchronizing information life changed according to object properties
It is saved in time shaft into corresponding group and frame addition, and rendering in Animation Editors renders area's synchronizing step 4, so that
Complete the synchronous preview of extension animation attributes;
The attribute change of extension is preferably visual, could be processed in the embodiment of animation effect;The change of certain attribute can not
That sees can also be used as the extended attribute in animation, such as event frame, it is also possible to place it on some point in time shaft,
When animation is operated in herein, user-defined event is triggered;The type of each attribute of object extension is all in animation system
There is the base class of corresponding frame in system, if it is not, the base class correspondence for inheriting frame extends, the base class of frame preserves frame in the time
The relative change in itself with object extension attribute of positional information, object in axle or absolute change information;Opened in editing machine
After automatic record frame, rendering area or attribute area makes the modification of correspondence attribute, will according to the Relative Transformation of attribute changes or absolutely
Corresponding frame is generated to information converting to be stored in time shaft;In editing machine, the relative priority of frame recording extended attribute becomes
Changing can be more preferable on Consumer's Experience than absolute change.
Preferably, the deadline inside time shaft is to can also add time-scaling in the transfer process of frame index
Calculating, as animation play variable-speed processing.
Technique effect of the invention is:
The invention provides it is a kind of can infinite expanding animation attributes method, by inheriting the base class of frame lasting extension category on demand
Property, reduce exploitation threshold;Binding function that the effect of animation represents between species, attribute is increased after extended attribute further
The species that represents of animation effect is increased, therefore increased animation effect on the whole, more effects are provided to developer
Selection, facilitates developer to make the abundanter animation of frame out;Additionally, each attribute of this method extension can also be single
Solely put forward to carry out animation so that Animation Editors can support single attribute animation, it is convenient can developer check the effect of animation
Really, in order to preferably make animation, while can also combine different animation attributes completes some complicated special animation effects
Really, the co-ordination repeatedly of the fine arts, animation teacher and exploitation is reduced, animation teacher is more perfectly designed and is realized what is wanted
As a result, communication, development cost are reduced.
Brief description of the drawings
Fig. 1 be the present invention can infinite expanding animation attributes method flow diagram.
Fig. 2 is method flow diagram of the present invention using high-level language infinite expanding animation attributes.
Specific embodiment
Specific embodiment of the invention is illustrated below in conjunction with the accompanying drawings:
Embodiment 1:
As shown in figure 1, the invention provides it is a kind of can infinite expanding animation attributes method, by can infinite expanding animation attributes
Animation system is integrated into editing machine, and different attributes are extended according to different object persistences, and it is right to be realized in Animation Editors
As the setting of attribute, synchronously the corresponding frame of generation is stored in time shaft the change according to object properties, is remembered by time shaft
The attribute change of object is recorded, and the attribute change that time shaft is recorded is individually or any combination carries out animation, so as to complete to move
Draw the extension of attribute.The present embodiment is that infinite expanding animation attributes are realized in cocos2d-x.
The method of the infinite expanding animation attributes is comprised the following steps:
Step 1, a class for extended attribute is built as base class, using Node as the base that animation attributes are extended in animation system
Class;
Step 2, one group of frame of structure, preserve frame and simultaneously complete frame-skipping;
Timeline is set, the group of structure is used to preserving in a series of same timeline, same to object, with attribute by index
The orderly frame of sequence, if frame uses the relative priority of extended attribute to change, organizes the also initial attribute including object
Value;
Addition behavior frame-skipping, using next key frame in the group of binary chop to current index and current index in frame-skipping, such as
There is key frame in fruit, then the frame for directly invoking frame enables method in current index;If there is no key frame, then call frame effect
Method;
Step 3, one base class of frame of structure, are enabled by frame and act on the setting that the two methods complete object properties with frame;
Frame is built as base class frame, the base class of the frame of structure include animation object in itself, the attribute change value of object and frame
Index, the attribute change value of the object is relative priority changing value or absolute attribute changing value, and the frame index is used to express
Position relationship in time shaft;
All of frame is traveled through sequentially in time, is enabled by frame and is acted on the setting that the two methods complete object properties with frame;
Method is enabled in call frame when the current frame when the time enters, the attribute of object is set, and update preserved next frame at this moment
Attribute change value;Present frame is in call frame action method in the time interval of same group of next frame when the time, is made
Object properties are calculated with the attribute and the attribute change value of next frame in current index, frame, and the attribute of object is set;When calling
During frame action method, the calculating of time graph can also be added in frame, the percentage of attribute change is taken when being acted on for frame;
Step 4, structure time shaft, complete the basic function of animation system infinite expanding animation attributes;
Action Timeline are built as time shaft, the time shaft of structure includes a series of group, and the attribute according to extension is determined
The order of group, conversion of the deadline to frame index inside time shaft in adopted time shaft;It is described when being completed inside time shaft
Between to the calculating that time-scaling can also be added in the transfer process of frame index, as the variable-speed processing that animation is played;
Addition behavior, it is the behaviors such as main broadcasting, stopping, frame-skipping, the section needed including animation to add line, and section is then will be dynamic
Picture is temporally divided into different time slices, in frame-skipping and broadcasting, using all of group of frame index traversal after conversion, then with
Group carries out frame-skipping;For organize sequence and traversal method be required for fully with different author languages object-oriented, it is polymorphic,
Method is maximized reaches easy effect for sequence, reflection etc., because the effect that the setting of part attribute is produced can influence each other, institute
With need ensure time shaft in group in order, according to expand come attribute definition time shaft in group order, it is necessary to frame by
Attribute is grouped;
The conversion of time is often completed, all of group is traveled through, rendered once, so as to complete animation system infinite expanding animation category
The basic function of property;Remainder optionally realizes the function of some animations, for example reversion, animation mixing etc.;
Step 5, the attribute for extending object in animation system on demand;The type of each attribute of object extension has correspondence
Frame base class, if it is not, the base class correspondence for inheriting frame extends, to enable that act on the two methods with frame complete again through frame
Into the setting of object properties, for example extension color mixing BlendFuncFrame etc. is used as extended attribute;
Step 6, in Animation Editors complete extension animation attributes synchronous preview;
Animation system is integrated into editing machine, automatic record frame is opened in the Animation Editors in cocos studio, led to
Cross visualized operation and object properties are set, render area or attribute area makes the modification of the corresponding attribute of different objects;
In the operating process that object properties are set, Relative Transformation or absolute transformed the synchronizing information life changed according to object properties
It is saved in time shaft into corresponding group and frame addition, and rendering in Animation Editors renders area's synchronizing step 4, so that
Complete the synchronous preview of extension animation attributes.
Embodiment 2:
As shown in Fig. 2 in the development process of extension animation attributes, if development language is different, infinite expanding animation attributes
Method also can exist difference;For example when using high-level languages such as C#, Java, ruby, the infinite expanding animation attributes
Method is comprised the following steps:
Step 1, one group of frame of structure, preserve frame and simultaneously complete frame-skipping;
Timeline is set, the group of structure is used to preserving in a series of same timeline, same to object, with attribute by rope
The orderly frame of ejectment sequence, if frame uses the relative priority of extended attribute to change, organizes the also initial category including object
Property value;
Addition behavior frame-skipping, using next key frame in the group of binary chop to current index and current index in frame-skipping, such as
There is key frame in fruit, then the frame for directly invoking frame enables method in current index;If there is no key frame, then call frame effect
Method;
Step 2, one base class of frame of structure, are enabled by frame and act on the setting that the two methods complete object properties with frame;
Frame is built as base class frame, the base class of the frame of structure include animation object in itself, the attribute change value of object and frame
Index, the attribute change value of the object is relative priority changing value or absolute attribute changing value, and the frame index is used to express
Position relationship in time shaft;
All of frame is traveled through sequentially in time, is enabled by frame and is acted on the setting that the two methods complete object properties with frame;
Method is enabled in call frame when the current frame when the time enters, the attribute of object is set, and update preserved next frame at this moment
Attribute change value;Present frame is in call frame action method in the time interval of same group of next frame when the time, is made
Object properties are calculated with the attribute and the attribute change value of next frame in current index, frame, and the attribute of object is set;Category is set
Property when with object, the base class of this all object is realized by reflecting, can so make animation extend whole framework it is simpler
It is single, it is mainly reflected in Animation Editors, directly set and protect using the PropertyInfo of C# in cocos studio
Attribute is deposited, is more facilitated in extended attribute;When call frame action method, the meter of time graph can also be added in frame
Calculate, the percentage of attribute change is taken when being acted on for frame;
Step 3, structure time shaft, complete the basic function of animation system infinite expanding animation attributes;
Action Timeline are built as time shaft, the time shaft of structure includes a series of group, and the attribute according to extension is determined
The order of group, conversion of the deadline to frame index inside time shaft in adopted time shaft;It is described when being completed inside time shaft
Between to the calculating that time-scaling can also be added in the transfer process of frame index, as the variable-speed processing that animation is played;
Addition behavior, it is the behaviors such as main broadcasting, stopping, frame-skipping, the section needed including animation to add line, and section is then will be dynamic
Picture is temporally divided into different time slices, in frame-skipping and broadcasting, using all of group of frame index traversal after conversion, then with
Group carries out frame-skipping;For organize sequence and traversal method be required for fully with different author languages object-oriented, it is polymorphic,
Method is maximized reaches easy effect for sequence, reflection etc., because the effect that the setting of part attribute is produced can influence each other, institute
With need ensure time shaft in group in order, according to expand come attribute definition time shaft in group order, it is necessary to frame by
Attribute is grouped;
The conversion of time is often completed, all of group is traveled through, rendered once, so as to complete animation system infinite expanding animation category
The basic function of property;Remainder optionally realizes the function of some animations, for example reversion, animation mixing etc.;
Step 4, the attribute for extending object in animation system on demand;The type of each attribute of object extension has correspondence
Frame base class, if it is not, the base class correspondence for inheriting frame extends, to enable that act on the two methods with frame complete again through frame
Into the setting of object properties, for example extension color mixing BlendFuncFrame etc. is used as extended attribute;
Step 5, in Animation Editors complete extension animation attributes synchronous preview;
Animation system is integrated into editing machine, automatic record frame is opened in the Animation Editors in cocos studio, led to
Cross visualized operation and object properties are set, render area or attribute area makes the modification of the corresponding attribute of different objects;
In the operating process that object properties are set, Relative Transformation or absolute transformed the synchronizing information life changed according to object properties
It is saved in time shaft into corresponding group and frame addition, and rendering in Animation Editors renders area's synchronizing step 3, so that
Complete the synchronous preview of extension animation attributes.