reformatted Animation.md
This commit is contained in:
@@ -1,35 +1,53 @@
|
|||||||
With animations, you can create a beautiful experience for users while interacting with objects.<br>
|
With animations, you can create a beautiful experience for users while interacting with objects.<br>
|
||||||
For now the animation class is very basic, i will expand it in the future, but i have to say already now you can do almost everything you can imagine!
|
For now the animation class is very basic, it will be expanded in the future, but we have to say you can already do almost everything you can imagine!
|
||||||
|
|
||||||
Right now animation is a class which makes use of the timer event<br>
|
Right now animation is a class which makes use of the timer event.<br>
|
||||||
Here are all possible functions available for animations:
|
You can find more information below:
|
||||||
|
|
||||||
## add
|
## add
|
||||||
adds a new function to your animation
|
Adds a new function to an animation
|
||||||
|
#### Parameters:
|
||||||
|
1. `function` The function containing animation logic
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `animation` Animation in use
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
* This will set the button position to 3,3, waits 1 second, then sets position to 4,4, waits 2 seconds, and then sets the position to 5,5
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local testButton = mainFrame:addButton("myTestButton"):show()
|
local testButton = mainFrame:addButton("myTestButton"):show()
|
||||||
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setPosition(3,3) end):wait(1):add(function() testButton:setPosition(1,1,"r") end):wait(2):add(function() testButton:setPosition(1,1,"r") end)
|
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setPosition(3,3) end):wait(1):add(function() testButton:setPosition(1,1,"r") end):wait(2):add(function() testButton:setPosition(1,1,"r") end)
|
||||||
|
aAnimation:play()
|
||||||
aAnimation:play() -- this will set the button position to 3,3, waits 1 sec., sets it to 4,4, waits 2 sec. and then sets the position to 5,5
|
|
||||||
````
|
````
|
||||||
**parameters:** function<br>
|
|
||||||
**returns:** self<br>
|
|
||||||
|
|
||||||
## wait
|
## wait
|
||||||
sets a wait timer for the next function after the previous function got executed, no wait timer calls the next function immediatly
|
Sets a wait timer for the next function after the previous function got executed, no wait timer calls the next function immediately
|
||||||
|
#### Parameters:
|
||||||
|
1. `number` The length of delay between the functions _(in seconds)_
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `animation` Animation in use
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local testButton = mainFrame:addButton("myTestButton"):show()
|
local testButton = mainFrame:addButton("myTestButton"):show()
|
||||||
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setPosition(3,3) end):wait(1):add(function() testButton:setPosition(1,1,"r") end):wait(2):add(function() testButton:setPosition(1,1,"r") end)
|
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setPosition(3,3) end):wait(1):add(function() testButton:setPosition(1,1,"r") end):wait(2):add(function() testButton:setPosition(1,1,"r") end)
|
||||||
|
|
||||||
aAnimation:play() -- this will set the button position to 3,3, waits 1 sec., sets it to 4,4, waits 2 sec. and then sets the position to 5,5
|
aAnimation:play()
|
||||||
````
|
````
|
||||||
**parameters:** timer - how long we should wait to call the next function<br>
|
|
||||||
**returns:** self<br>
|
|
||||||
|
|
||||||
## play
|
## play
|
||||||
starts to play the animation
|
Plays the animation
|
||||||
|
#### Parameters:
|
||||||
|
1. `boolean` Whether it will loop forever, will most likely be replaced with a count in the future
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `animation` Animation in use
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local testButton = mainFrame:addButton("myTestButton"):show()
|
local testButton = mainFrame:addButton("myTestButton"):show()
|
||||||
@@ -37,11 +55,15 @@ local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:set
|
|||||||
|
|
||||||
aAnimation:play() -- changes the background color of that button from black to gray and then to lightGray
|
aAnimation:play() -- changes the background color of that button from black to gray and then to lightGray
|
||||||
````
|
````
|
||||||
**parameters:** [endlessloop] - bool if it should loop forever - will change that to loopcount in the future<br>
|
|
||||||
**returns:** self<br>
|
|
||||||
|
|
||||||
## cancel
|
## cancel
|
||||||
cancels the animation
|
Cancels the animation
|
||||||
|
|
||||||
|
#### Returns:
|
||||||
|
1. `animation` Animation in use
|
||||||
|
|
||||||
|
#### Usage:
|
||||||
|
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local testButton = mainFrame:addButton("myTestButton"):show()
|
local testButton = mainFrame:addButton("myTestButton"):show()
|
||||||
@@ -49,5 +71,3 @@ local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:set
|
|||||||
|
|
||||||
aAnimation:play()
|
aAnimation:play()
|
||||||
````
|
````
|
||||||
**parameters:** -<br>
|
|
||||||
**returns:** self<br>
|
|
||||||
Reference in New Issue
Block a user