GraffitiSuite Docs
Docs
Graffitianimatorcontrol
Loading document parsing libraries...
# GraffitiAnimatorControl Class Inherits GraffitiAnimatorObject ## Compatibility ### Framework API Version | 1.0 | 2.0 | | :---: | :---: | | True | True | ### Android | 32-Bit | 64-Bit | | :---: | :---: | | False | True | ### Console | 32-Bit | 64-Bit | | :---: | :---: | | True | True | ### Desktop | 32-Bit | 64-Bit | | :---: | :---: | | True | True | ### iOS | 32-Bit | 64-Bit | | :---: | :---: | | False | True | ### Web | 32-Bit | 64-Bit | | :---: | :---: | | True | True | ## Delegates | Name | Parameters | Return Type | Description | | --- | :---: | :---: | --- | | AnimationComplete | animControl as GraffitiAnimatorControl | (None) | Delegate function for completion reporting. | | AnimationProgress | animControl as GraffitiAnimatorControl <br> animOp as GraffitiAnimatorOperation <br> newValue as Double | (None) | Delegate function for progress reporting. | | AtKeyframe | currentKeyframe as GraffitiAnimatorKeyframe | (None) | Delegate function for keyframe reporting. | ## Methods | Name | Parameters | Return Type | Description | | --- | :---: | :---: | --- | | AddKeyframe | newKeyframe as GraffitiAnimatorKeyframe | GraffitiAnimatorControl | Adds a new keyframe. | | AddKeyframe | waitTime as Integer = 0 | GraffitiAnimatorControl | Adds a new keyframe. | | AddKeyframe | Name as String <br> waitTime as Integer = 0 | GraffitiAnimatorControl | Adds a new keyframe. | | AddOperation | animOp as GraffitiAnimatorOperation | GraffitiAnimatorControl | Adds a new animation operation to the stack. | | Constructor | Target as MobileUIControl <br> constraintLeft as iOSLayoutConstraint <br> constraintTop as iOSLayoutConstraint <br> constraintWidth as iOSLayoutConstraint <br> constraintHeight as iOSLayoutConstraint | (None) | Instantiates a new instance of the class. | | Destructor | (None) | (None) | (None) | | Move | newLeft as Double <br> newTop as Double <br> animationLength as Integer <br> easing as GraffitiAnimator.Easings | GraffitiAnimatorControl | Moves the control to the specified position. | | OnComplete | finishFunction as AnimationComplete | GraffitiAnimatorControl | Invokes the provided delegate when all animation has completed. | | OnKeyframe | keyframeFunction as AtKeyframe | GraffitiAnimatorControl | Invokes the provided delegate when the animation encounters a keyframe. | | OnProgress | changeFunction as AnimationProgress | GraffitiAnimatorControl | Invokes the provided delegate as animation operations progress. | | Play | DestroyWhenComplete as Boolean = True | GraffitiAnimatorControl | Plays the provided animation stack, optionally destructs itself when complete. | | Resize | newWidth as Double <br> newHeight as Double <br> animationLength as Integer <br> easing as GraffitiAnimator.Easings | GraffitiAnimatorControl | Resizes the RectControl using the specified values. | | Shake | numberOfShakes as Integer = 5 <br> deltaX as Integer = 5 <br> deltaY as Integer = 0 <br> animationLength as Integer = 800 | GraffitiAnimatorControl | Causes the RectControl to shake violently along the X-axis. | | Stop | (None) | GraffitiAnimatorControl | Cancels all running animations and immediately applies the requested end values for those operations. | ## Properties | Name | Type | Default Value | Description | | --- | :---: | :---: | --- | | constraintHeight | iOSLayoutConstraint | (None) | AutoLayout constraint to use when animating control's height. | | constraintLeft | iOSLayoutConstraint | (None) | AutoLayout constraint to use when animating control's width. | | constraintTop | iOSLayoutConstraint | (None) | AutoLayout constraint to use when animating control's top. | | constraintWidth | iOSLayoutConstraint | (None) | AutoLayout constraint to use when animating control's width. | | State | GraffitiAnimator.States | (None) | The current running state of the animator. | | Target | MobileUIControl | (None) | The UI element to be animated. | ## Examples ### Chaining This class was developed to make animation chaining simple for enthralling UI animations. Below is an example directly from the demo project that demonstrates how this is done. `Me` is a PushButton: ```wp-block-preformatted if animControl = nil then '// Setup constraints. var x as new iOSLayoutConstraint( me, iOSLayoutConstraint.AttributeTypes.Left, _ iOSLayoutConstraint.RelationTypes.Equal, _ self, iOSLayoutConstraint.AttributeTypes.Left, 1, me.Left, 1000 ) x.Active = True var y as new iOSLayoutConstraint( me, iOSLayoutConstraint.AttributeTypes.Top, _ iOSLayoutConstraint.RelationTypes.Equal, _ self, iOSLayoutConstraint.AttributeTypes.Top, 1, 70, 1000 ) y.Active = True var w as new iOSLayoutConstraint( me, iOSLayoutConstraint.AttributeTypes.Width, _ iOSLayoutConstraint.RelationTypes.Equal, _ nil, iOSLayoutConstraint.AttributeTypes.None, 1, me.Width, 1000 ) w.Active = True var h as new iOSLayoutConstraint( me, iOSLayoutConstraint.AttributeTypes.Height, _ iOSLayoutConstraint.RelationTypes.Equal, _ nil, iOSLayoutConstraint.AttributeTypes.None, 1, me.Height, 1000 ) h.Active = True self.AddConstraint( x ) self.AddConstraint( y ) self.AddConstraint( w ) self.AddConstraint( h ) animControl = new GraffitiAnimatorControl( me, x, y, w, h ) call animControl.OnProgress( GraffitiAnimatorControl.AnimationProgress( WeakAddressOf bounceProgress ) )._ OnKeyframe( GraffitiAnimatorControl.AtKeyframe( WeakAddressOf bounceKeyframe ) )._ OnComplete( GraffitiAnimatorControl.AnimationComplete( WeakAddressOf bounceFinished ) ) end if if animControl.State = GraffitiAnimator.States.Running then Return animControl.constraintTop.Offset = 70 Call animControl._ AddOperation( new GraffitiAnimatorOperation( "textsize", me.FontSize, me.FontSize * 2, 1000, GraffitiAnimator.Easings.BounceOut ) )._ Move( me.Left, me.Top + 50, 1000, GraffitiAnimator.Easings.BounceOut )._ Resize( me.Width * 2, me.Height, 1000, GraffitiAnimator.Easings.ElasticOut )._ AddKeyframe( "MidPoint", 1000 ) call animControl.Play( True ) ```