-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0840c4e
Showing
44 changed files
with
4,561 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# AnimationKit.Coordinator | ||
|
||
This class handles all the aspects of animation. Most users will never need to think about this class at all however. The coordinator can be subclassed to customize behaviors if necessary. | ||
|
||
The Run method of [AnimationKit.Task](AnimationKit.Task.md) will use an application-global coordinator if one is not passed in. This global coordinator can be referenced using the AnimationKit.SharedCoordinator method. | ||
|
||
## Events | ||
|
||
<pre id="event.taskadded"><span style="color: #000000;"><span style="color: #0000FF;">Event</span> TaskAdded (Task <span style="color: #0000FF;">As</span> AnimationKit.Task)</span></pre> | ||
Triggered after a task has been added to the animation queue. | ||
|
||
<pre id="event.taskremoved"><span style="color: #000000;"><span style="color: #0000FF;">Event</span> TaskRemoved (Task <span style="color: #0000FF;">As</span> AnimationKit.Task)</span></pre> | ||
Triggered after a task has been removed from the animation queue. This will happen for any of the following reasons: | ||
|
||
- Animation has completed | ||
- Animation was cancelled | ||
- Target has gone out of scope | ||
|
||
## Properties | ||
|
||
<pre id="property.framespersecond"><span style="color: #000000;">FramesPerSecond <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span> = <span style="color: #336698;">60</span></span></pre> | ||
Allows the developer to customize the performance of the animations. There is a logical maximum of 100 frames per second. | ||
|
||
## Methods | ||
|
||
<pre id="method.addtask"><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> AddTask (Task <span style="color: #0000FF;">As</span> AnimationKit.Task)</span></pre> | ||
Adds a task to the coordinator and begins animating it. | ||
|
||
## See Also | ||
|
||
[AnimationKit.Task](AnimationKit.Task.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# AnimationKit.Curve | ||
|
||
This class describes a cubic bézier curve which controls the timing of animation tasks. The values are identical to css easing animations, meaning you can use an [online generator](http://matthewlein.com/ceaser/) to experiment and generate your own curves. | ||
|
||
## Constructors | ||
|
||
<pre><span style="color: #000000;">P1 <span style="color: #0000FF;">As</span> Xojo.Core.Point, P2 <span style="color: #0000FF;">As</span> Xojo.Core.Point</span></pre> | ||
Creates a new curve with points P1 and P2. P0 is always {0, 0}, and P3 is always {1, 1}. | ||
|
||
<pre><span style="color: #000000;">P1X <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Single</span>, P1Y <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Single</span>, P2X <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Single</span>, P2Y <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Single</span></span></pre> | ||
Alternate constructor which uses 4 singles instead of 2 Xojo.Core.Point objects. | ||
|
||
## Methods | ||
|
||
<pre id="method.evaluate"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> Evaluate (Time <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Double</span>, StartValue <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Double</span>, EndValue <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Double</span>) <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Double</span></span></pre> | ||
Determine the value between StartValue and EndValue given a Time between 0 and 1. | ||
|
||
<pre id="method.reverse"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> Reverse () <span style="color: #0000FF;">As</span> AnimationKit.Curve</span></pre> | ||
Returns a new curve whose with inverted control points. | ||
|
||
## Shared Methods | ||
|
||
<pre id="method.createeasein"><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateEaseIn () <span style="color: #0000FF;">As</span> AnimationKit.Curve</span></pre> | ||
Returns a new curve using the EaseIn preset. | ||
|
||
<pre id="method.createeaseinout"><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateEaseInOut () <span style="color: #0000FF;">As</span> AnimationKit.Curve</span></pre> | ||
Returns a new curve using the EaseInOut preset. | ||
|
||
<pre id="method.createeaseout"><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateEaseOut () <span style="color: #0000FF;">As</span> AnimationKit.Curve</span></pre> | ||
Returns a new curve using the EaseOut preset. | ||
|
||
<pre id="method.createfrompreset"><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateFromPreset(Preset <span style="color: #0000FF;">As</span> AnimationKit.Curve.Presets) <span style="color: #0000FF;">As</span> AnimationKit.Curve</span></pre> | ||
Returns a new curve using the provided preset. | ||
|
||
<pre id="method.createlinear"><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateLinear () <span style="color: #0000FF;">As</span> AnimationKit.Curve</span></pre> | ||
Returns a new curve using the Linear preset. | ||
|
||
## Enumerations | ||
|
||
<pre style="color: #000000;" id="enumeration.presets">Presets { | ||
Linear = 0, | ||
EaseIn, | ||
EaseInBack, | ||
EaseInCirc, | ||
EaseInCubic, | ||
EaseInExpo, | ||
EaseInQuad, | ||
EaseInQuart, | ||
EaseInQuint, | ||
EaseInSine, | ||
EaseOut, | ||
EaseOutBack, | ||
EaseOutCirc, | ||
EaseOutCubic, | ||
EaseOutExpo, | ||
EaseOutQuad, | ||
EaseOutQuart, | ||
EaseOutQuint, | ||
EaseOutSine, | ||
EaseInOut, | ||
EaseInOutBack, | ||
EaseInOutCirc, | ||
EaseInOutCubic, | ||
EaseInOutExpo, | ||
EaseInOutQuad, | ||
EaseInOutQuart, | ||
EaseInOutQuint, | ||
EaseInOutSine | ||
}</pre> | ||
|
||
## See Also | ||
|
||
[AnimationKit.MoveTask](AnimationKit.MoveTask.md), [AnimationKit.ScrollTask](AnimationKit.ScrollTask.md), [AnimationKit.ValueTask](AnimationKit.ValueTask.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# AnimationKit.Frame | ||
|
||
## Constructors | ||
|
||
<pre><span style="color: #000000;">Image <span style="color: #0000FF;">As</span> iOSImage, RetinaImage <span style="color: #0000FF;">As</span> iOSImage</span></pre> | ||
<pre><span style="color: #000000;">Image <span style="color: #0000FF;">As</span> Picture, RetinaImage <span style="color: #0000FF;">As</span> Picture</span></pre> | ||
Creates a new frame with the provided graphic. If a retina version is provided (which it should be) it must match exactly 2x the width and height as the standard graphic. | ||
|
||
## Methods | ||
|
||
<pre id="method.dimensions"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> Dimensions () <span style="color: #0000FF;">As</span> Xojo.Core.Size</span></pre> | ||
Returns the width and height of the standard graphic. | ||
|
||
## Properties | ||
|
||
<pre id="property.image"><span style="color: #000000;">Image <span style="color: #0000FF;">As</span> iOSImage <span style="color: #800000;">// Read Only</span></span></pre> | ||
<pre><span style="color: #000000;">Image <span style="color: #0000FF;">As</span> Picture <span style="color: #800000;">// Read Only</span></span></pre> | ||
The standard resolution graphic. | ||
|
||
<pre id="property.retinaimage"><span style="color: #000000;">RetinaImage <span style="color: #0000FF;">As</span> iOSImage <span style="color: #800000;">// Read Only</span></span></pre> | ||
<pre><span style="color: #000000;">RetinaImage <span style="color: #0000FF;">As</span> Picture <span style="color: #800000;">// Read Only</span></span></pre> | ||
The double resolution graphic. | ||
|
||
## See Also | ||
|
||
[AnimationKit.FrameSet](AnimationKit.FrameSet.md), [AnimationKit.FrameTarget](AnimationKit.FrameTarget.md), [AnimationKit.FrameTask](AnimationKit.FrameTask.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# AnimationKit.FrameSet | ||
|
||
Holds a set of [AnimationKit.Frame](AnimationKit.Frame.md) objects used to animate with a [AnimationKit.FrameTask](AnimationKit.FrameTask.md). | ||
|
||
This class supports multiple usage syntaxes. Developers can choose to use this as a class, like they would a [FolderItem](http://docs.xojo.com/index.php/FolderItem), or they can choose to use it as an array. Each of the following syntaxes are acceptable: | ||
|
||
<pre><span style="color: #000000;"><span style="color: #0000FF;">For</span> I <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span> = <span style="color: #336698;">0</span> <span style="color: #0000FF;">To</span> Set.Count - <span style="color: #336698;">1</span><br> <span style="color: #0000FF;">Dim</span> Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame = Set.Frame(I)<br> <span style="color: #800000;">// Do something</span><br><span style="color: #0000FF;">Next</span><br><br><span style="color: #0000FF;">For</span> I <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span> = <span style="color: #336698;">0</span> <span style="color: #0000FF;">To</span> UBound(Set)<br> <span style="color: #0000FF;">Dim</span> Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame = Set(I)<br> <span style="color: #800000;">// Do something</span><br><span style="color: #0000FF;">Next</span><br><br><span style="color: #0000FF;">For</span> <span style="color: #0000FF;">Each</span> Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame <span style="color: #0000FF;">In</span> Set<br> <span style="color: #800000;">// Do something</span><br><span style="color: #0000FF;">Next</span></span></pre> | ||
|
||
### Frame Dimensions | ||
|
||
All frames in a set must match their dimensions exactly. Only when the set is empty will the set accept an image of any size. Once the set has one or more frames, attempting to add a frame with different dimensions will trigger an UnsupportedOperationException. | ||
|
||
## Methods | ||
|
||
<pre id="method.append"><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> Append (Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame)</span></pre> | ||
Add a frame to the end the set. | ||
|
||
<pre id="method.count"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> Count () <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span></span></pre> | ||
Returns the number of items in the set. | ||
|
||
<pre id="method.firstframe"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> FirstFrame () <span style="color: #0000FF;">As</span> AnimationKit.Frame</span></pre> | ||
This is a shorthand for Frame(0). | ||
|
||
<pre id="method.frame"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> Frame (Index <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>) <span style="color: #0000FF;">As</span> AnimationKit.Frame</span></pre> | ||
Returns the frame at the given 0-based index. | ||
|
||
<pre><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> Frame (Index <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, <span style="color: #0000FF;">Assigns</span> Value <span style="color: #0000FF;">As</span> AnimationKit.Frame)</span></pre> | ||
Changes the frame at the give 0-based index. | ||
|
||
<pre id="method.indexof"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> IndexOf (Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame) <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span></span></pre> | ||
Returns the index of the given frame, or -1 if not found. | ||
|
||
<pre id="method.insert"><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> Insert (Index <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame)</span></pre> | ||
Adds a new frame at the given index, increasing the index of each frame whose index is >= the given index. | ||
|
||
<pre id="method.lastframe"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> LastFrame () <span style="color: #0000FF;">As</span> AnimationKit.Frame</span></pre> | ||
This is a shorthand for Frame(Count - 1). | ||
|
||
<pre id="method.remove"><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> Remove (Index <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>)</span></pre> | ||
Removes the frame at the given index. | ||
|
||
<pre id="method.reverse"><span style="color: #000000;"><span style="color: #0000FF;">Function</span> Reverse () <span style="color: #0000FF;">As</span> AnimationKit.FrameSet</span></pre> | ||
Returns a new frame set with the frames in reverse. | ||
|
||
## Shared Methods | ||
|
||
<pre id="method.createfromspritesheet"><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateFromSpriteSheet (Sprites <span style="color: #0000FF;">As</span> iOSImage, RetinaSprites <span style="color: #0000FF;">As</span> iOSImage, CellWidth <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, CellHeight <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, Rows <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, Columns <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>) <span style="color: #0000FF;">As</span> AnimationKit.FrameSet</span></pre> | ||
<pre><span style="color: #000000;"><span style="color: #0000FF;">Shared</span> <span style="color: #0000FF;">Function</span> CreateFromSpriteSheet (Sprites <span style="color: #0000FF;">As</span> Picture, RetinaSprites <span style="color: #0000FF;">As</span> Picture, CellWidth <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, CellHeight <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, Rows <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>, Columns <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Integer</span>) <span style="color: #0000FF;">As</span> AnimationKit.FrameSet</span></pre> | ||
These methods take a sprite grid and create a frame set. Provide the size of each cell, as well as the number of rows and columns in the grid. The input graphic will be checked to ensure dimensions match the provided cell sizes, row count, and column count. The Retina graphic is very strongly recommended, but not required. To avoid supporting retina resolutions properly, pass Nil for the second parameter. | ||
|
||
## See Also | ||
|
||
[AnimationKit.Frame](AnimationKit.Frame.md), [AnimationKit.FrameTarget](AnimationKit.FrameTarget.md), [AnimationKit.FrameTask](AnimationKit.FrameTask.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# AnimationKit.FrameTarget | ||
|
||
## Interface Methods | ||
|
||
<pre id="method.animationstep"><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> AnimationStep (Identifier <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Text</span>, Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame)</span></pre> | ||
This method is fired as often as necessary to run the animation, providing both the identifier and the new frame. | ||
|
||
## Example Class | ||
|
||
This is a very simple class that will display each frame given to it. | ||
|
||
<pre><span style="color: #000000;"><span style="color: #0000FF;">Sub</span> Paint (g <span style="color: #0000FF;">As</span> Graphics, areas() <span style="color: #0000FF;">As</span> REALbasic.Rect)<br> <span style="color: #0000FF;">If</span> Self.CurrentFrame <> <span style="color: #0000FF;">Nil</span> <span style="color: #0000FF;">Then</span><br> G.DrawPicture(Self.CurrentFrame.Image, <span style="color: #336698;">0</span>, <span style="color: #336698;">0</span>)<br> <span style="color: #0000FF;">End</span> <span style="color: #0000FF;">If</span><br><span style="color: #0000FF;">End</span> <span style="color: #0000FF;">Sub</span><br><br><span style="color: #0000FF;">Sub</span> AnimationStep (Identifier <span style="color: #0000FF;">As</span> Text, Frame <span style="color: #0000FF;">As</span> AnimationKit.Frame)<br> <span style="color: #800000;">// Part of the AnimationKit.FrameTarget interface.</span><br> <br> Self.CurrentFrame = Frame<br> Self.Invalidate(Self.EraseBackground)<br><span style="color: #0000FF;">End</span> <span style="color: #0000FF;">Sub</span><br><br><span style="color: #0000FF;">Private</span> CurrentFrame <span style="color: #0000FF;">As</span> AnimationKit.Frame<br></span></pre> | ||
|
||
## See Also | ||
|
||
[AnimationKit.Frame](AnimationKit.Frame.md), [AnimationKit.FrameSet](AnimationKit.FrameSet.md), [AnimationKit.FrameTask](AnimationKit.FrameTask.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# AnimationKit.FrameTask | ||
|
||
Inherits from [AnimationKit.Task](AnimationKit.Task.md). | ||
|
||
This task controls animations for implementors of the [AnimationKit.FrameTarget](AnimationKit.FrameTarget.md) interface. | ||
|
||
A frame task does no actual animation, instead providing a way for an implementor to animate using sprites. Frame tasks have an identifier property which is used by the implementor to determine which sprite the new frame is intended for. | ||
|
||
See the [AnimationKit.FrameTarget](AnimationKit.FrameTarget.md) interface for an example implementation and usage. | ||
|
||
## Constructors | ||
|
||
<pre><span style="color: #000000;">Target <span style="color: #0000FF;">As</span> AnimationKit.FrameTarget, Frames <span style="color: #0000FF;">As</span> AnimationKit.FrameSet</span></pre> | ||
Creates a task for Target with the provided set of frames. The frame set can be modified after the task is created, but before it is run. | ||
|
||
## Properties | ||
|
||
<pre id="property.durationinseconds"><span style="color: #000000;">DurationInSeconds <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Double</span> = <span style="color: #006633;">1.0</span></span></pre> | ||
If the Looping property is true, this is the number of seconds required to complete one loop of the animation. If the Looping property is false, this is the number of seconds required to complete the animation. | ||
|
||
[AnimationKit.Coordinator.FramesPerSecond](AnimationKit.Coordinator.md#property.framespersecond) has minimal impact on the animation speed. The duration property fully determines the speed at which frames will be swapped. This means frames may be duplicated or dropped to match the intended duration. | ||
|
||
For example, assuming the default of 60 frames per second, a frame set of 30 frames, and a duration of 1 second, each frame in the set will be displayed for two animation frames. | ||
|
||
The implementor will only receive a change notification when the frame actually changes; duplicated frames will not trigger duplicate notifications. | ||
|
||
<pre id="property.frames"><span style="color: #000000;">Frames <span style="color: #0000FF;">As</span> AnimationKit.FrameSet = <span style="color: #0000FF;">New</span> AnimationKit.FrameSet()</span></pre> | ||
The set of frames to play/loop through. | ||
|
||
<pre id="property.identifier"><span style="color: #000000;">Identifier <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Text</span> = <span style="color: #6600FE;">""</span></span></pre> | ||
The identifier is used to instruct the implementor which sprite the new frame is for. | ||
|
||
<pre id="property.looping"><span style="color: #000000;">Looping <span style="color: #0000FF;">As</span> <span style="color: #0000FF;">Boolean</span> = <span style="color: #0000FF;">False</span></span></pre> | ||
If true, the animation will never end. | ||
|
||
## See Also | ||
|
||
[AnimationKit.Frame](AnimationKit.Frame.md), [AnimationKit.FrameSet](AnimationKit.FrameSet.md), [AnimationKit.FrameTarget](AnimationKit.FrameTarget.md) |
Oops, something went wrong.