Last active
February 16, 2020 12:18
-
-
Save MindScriptAct/0df093ab5a6a72fae460ab3499b63417 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
### Animator initialization: | |
```lua | |
-- Init | |
local animator = Animator() | |
local animation = animator:InitAnimation() | |
-- plan your animation | |
animation:Move(ObjectId.TestTile1, ObjectId.InBag1, 0, HandleMoveToItemDone) | |
-- start animation: | |
animator:Start(animation) | |
-- stop animation: | |
animator:Stop(animation) | |
-- stop all: | |
animator:StopAll() | |
``` | |
### Animation functions: | |
```lua | |
-- Single action: | |
animation | |
:Move(ObjectId.TestTile1, ObjectId.InBag1, 0, HandleMoveToItemDone) -- Move one item To Item | |
:Move({ObjectId.TestTile1, ObjectId.TestTile2}, ObjectId.InBag1, 0, HandleMoveToItemDone) -- Move Many To Item | |
:Move(ObjectId.TestTile1, {1,2,3}, 0, HandleMoveToPositionDone) -- Move To Position | |
:Move({ObjectId.TestTile1, ObjectId.TestTile2}, {1,2,3}, 0, HandleMoveToPositionDone) -- Move Many To Position | |
:Rotate(ObjectId.TestTile1, {90, 90, 90} 0, HandleRotateDone) -- Rotate one | |
:Rotate({ObjectId.TestTile1, ObjectId.TestTile2}, {90, 90, 90} 0, HandleRotateManyDone) -- Rotate many | |
:Scale(ObjectId.TestTile1, 2, 0, HandleScaleDone) -- Scale one | |
:Scale({ObjectId.TestTile1, ObjectId.TestTile2}, 2, 0, HandleScalemanyDone) -- Scale many | |
:Transform(ObjectId.TestTile1, {1,2,3}, {90,180,270}, 2, 0, HandleTransformDone) -- Move AND Rotate AND Scale one item | |
:Transform({ObjectId.TestTile1, ObjectId.TestTile2}, {1,2,3}, {90,180,270}, 2, 0, HandleTransformManyDone) -- Move AND Rotate AND Scale Many Items | |
:Teleport(ObjectId.TestTile1, {1,2,3}, {90,180,270}, 2, 0, HandleTeleportDone) -- Move AND Rotate AND Scale one item instantly | |
:Teleport({ObjectId.TestTile1, ObjectId.TestTile2}, {1,2,3}, {90,180,270}, 2, 0, HandleTeleportManyDone) -- Move AND Rotate AND Scale Many Items instantly | |
:Flip(ObjectId.TestTile1, 0, HandleFlipDone) -- flip one card/tile/object... | |
:Flip({ObjectId.TestTile1, ObjectId.TestTile2}, 0, HandleFlipManyDone) -- flip many card/tile/object... | |
:Sort(ObjectId.InBag1, SortFunction, 0, HandleSortDone) -- sort single container | |
:Sort({ObjectId.InBag1, ObjectId.InBag1}, SortFunction, 0, HandleSortManyDone) -- sort many containers | |
:Shuffle(ObjectId.InBag1, 0, HandleShuffleDone) -- Shuffle single container | |
:Shuffle({ObjectId.InBag1, ObjectId.InBag1}, 0, HandleShuffleManyDone) -- Shuffle many containers | |
:Lock(ObjectId.TestTile1, 0, HandleLockDone) -- lock one card/tile/object... | |
:Lock({ObjectId.TestTile1, ObjectId.TestTile2}, 0, HandleLockManyDone) -- lock many card/tile/object... | |
:Unlock(ObjectId.TestTile1, 0, HandleUnlockDone) -- Unlock one card/tile/object... | |
:Unlock({ObjectId.TestTile1, ObjectId.TestTile2}, 0, HandleUnlockManyDone) -- Unlock many card/tile/object... | |
:Delete(ObjectId.TestTile1, 0, HandleDeleteDone) -- Delete one card/tile/object... | |
:Delete({ObjectId.TestTile1, ObjectId.TestTile2}, 0, HandleDeleteDone) -- Unlock many card/tile/object... | |
:Execute(ObjectId.TestTile1, 0, CustomFunction) -- execute specific function on object | |
:Execute({ObjectId.TestTile1, ObjectId.TestTile2}, 0, CustomFunction) -- execute specific function on each object | |
:Draw(ObjectId.OutBag1, Player.color, 0, HandleDrawDone) -- Draw to player one item from container | |
:DrawMany(ObjectId.OutBag1, Player.color, 5, 0, HandleDrawDone) -- Draw to player one item from container | |
-- Collect objects for chaining: | |
:Take(ObjectId.TestTile1 0, HandleMoveCloneToItemDone, HandleOnItemTaken) -- Take one Item (for chaining) | |
:TakeMany({ObjectId.TestTile1, ObjectId.TestTile2} 0, HandleMoveCloneToItemDone, HandleOnItemTaken) -- Take many items (for chaining) | |
:TakeFrom(ObjectId.OutBag1 0, HandleMoveCloneToItemDone, HandleOnItemTaken) -- Take one Item from container (for chaining) | |
:TakeManyFrom(ObjectId.OutBag1, 5, 0, HandleMoveCloneToItemDone, HandleOnItemTaken) -- Take many items from container (for chaining) | |
:Clone(ObjectId.TestTile1 0, HandleMoveCloneToItemDone, HandleOnItemCloned) -- Clone one Item (for chaining) | |
:CloneMany(ObjectId.TestTile1, 6, 0, HandleMoveCloneManyToPositionDone, HandleOnItemCloned) -- Clone many copies (for chaining) | |
:ThenExecute(0, CustomFunction) -- execute specific function on object | |
-- Chaining functions: | |
:ThenPause(5, HandlAwaitDone) -- pause before chaining previous command object/objects. | |
:ThenMove(ObjectId.InBag1, 0, HandleThenMoveDone) -- chain previous command object/objects. | |
:ThenRotate({90, 90, 90}, 0, HandleThenRotateDone) -- chain previous command object/objects. | |
:ThenScale(2, 0, HandleThenScaleDone) -- chain previous command object/objects. | |
:ThenTransform({1,2,3}, {90,180,270}, 2, 0, HandleThenTransformDone) -- chain previous command object/objects. | |
:ThenTeleport({1,2,3}, {90,180,270}, 2, 0, HandleThenTeleportDone) -- chain previous command object/objects. | |
:ThenFlip(0, HandleThenFlipDone) -- chain previous command object/objects. | |
:ThenSort(0, SortFunction, HandleThenSortDone) -- chain previous command container. | |
:ThenShuffle(0, HandleThenShuffleDone) -- chain previous command container. | |
:ThenLock(0, HandleThenLockDone) -- chain previous command object/objects. | |
:ThenUnlock(0, HandleThenUnlockDone) -- chain previous command object/objects. | |
:ThenDelete(0, HandleThenDeleteDone) -- chain previous command object/objects. | |
:Await(HandlAwaitDone) -- wait for all previous animations to finish, resets current animation time to 0 for delay paramater. | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment