ToolTipsFactory

Object Model - The Animation class - Copy 

Creates an exact copy (clone) of the Animation.

[Visual Basic]
Public Function Copy() As Animation
[C#]
public Animation Copy();

Parameters

None

Return value

An identical copy of the Animation-instance. 

Description

This function is used to get an exact copy of the Animation-object on which this function is applied. This function is really helpful to implement Undo/Redo-functionality in programs that create or edit Animations because the AnimationFrames  and their corresponding FrameImages are also duplicated and not just copied by reference. 

'Create a new Animation...

Dim myAnimation As Animation = New Animation

'Compute and add some frames...

...

Rotate3DObject(myAnimation, a3DObject)

...

'Before we call our ultimate Animation-Editor, we should

'make a copy of the current Animation...

Dim myAnimationBackup As Animation

myAnimationBackup = myAnimation.Copy()

...

'Edit the Animation...

Dim res As DialogResult

res = NextGenerationMovieEditor(myAnimation)

'If the editor has been canceled,

'we should restore myAnimation to its previous state...

If res = DialogResult.Cancel Then

   myAnimation = myAnimationBackup

Else

    'the backup is not needed anymore

   myAnimationBackup = Nothing

End If

...