added new features

-remade animation
-added xml support
-finished dynamic values
-added new object: graphic
-added themes for frames
-textfield got some basic improvements to create coding editors
This commit is contained in:
Robert Jelic
2022-07-17 19:20:02 +02:00
parent 3b33bb7009
commit b940ef7154
33 changed files with 2487 additions and 768 deletions

View File

@@ -4,6 +4,8 @@ For now the animation class is very basic, it will be expanded in the future, bu
Right now animation is a class which makes use of the timer event.<br>
You can find more information below:
`The animation object is still a WIP and the way you use it right now could change in the future!`
## add
Adds a new function to an animation
#### Parameters:
@@ -16,9 +18,9 @@ Adds a new function to an animation
#### 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
local mainFrame = basalt.createFrame("myFirstFrame"):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 mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():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()
```
@@ -32,9 +34,9 @@ Sets a wait timer for the next function after the previous function got executed
#### Usage:
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):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 mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():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()
```
@@ -49,9 +51,9 @@ Plays the animation
#### Usage:
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local testButton = mainFrame:addButton("myTestButton"):show()
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setBackground(colors.black) end):wait(1):add(function() testButton:setBackground(colors.gray) end):wait(1):add(function() testButton:setBackground(colors.lightGray) end)
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():add(function() testButton:setBackground(colors.black) end):wait(1):add(function() testButton:setBackground(colors.gray) end):wait(1):add(function() testButton:setBackground(colors.lightGray) end)
aAnimation:play() -- changes the background color of that button from black to gray and then to lightGray
```
@@ -65,9 +67,128 @@ Cancels the animation
#### Usage:
```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local testButton = mainFrame:addButton("myTestButton"):show()
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setBackground(colors.black) end):wait(1):add(function() aAnimation:cancel() end):wait(1):add(function() testButton:setBackground(colors.lightGray) end)
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():add(function() testButton:setBackground(colors.black) end):wait(1):add(function() aAnimation:cancel() end):wait(1):add(function() testButton:setBackground(colors.lightGray) end)
aAnimation:play()
```
## setObject
Sets the object which the animation should reposition/resize
#### Parameters:
1. `table` object
#### Returns:
1. `animation` Animation in use
#### Usage:
```lua
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():setObject(testButton)
```
## move
Moves the object which got defined by setObject
#### Parameters:
1. `number` x coordinate
2. `number` y coordinate
1. `number` time in seconds
1. `number` frames (how fluid it should look like)
1. `table` object - optional, you could also define the object here
#### Returns:
1. `animation` Animation in use
#### Usage:
```lua
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():setObject(testButton):move(15,3,1,5):play()
```
## move
Moves the object which got defined by setObject
#### Parameters:
1. `number` x coordinate
2. `number` y coordinate
1. `number` time in seconds
1. `number` frames (how fluid it should look like)
1. `table` object - optional, you could also define the object here
#### Returns:
1. `animation` Animation in use
#### Usage:
```lua
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():setObject(testButton):move(15,3,1,5):play()
```
## offset
Changes the offset on the object which got defined by setObject
#### Parameters:
1. `number` x offset
2. `number` y offset
1. `number` time in seconds
1. `number` frames (how fluid it should look like)
1. `table` object - optional, you could also define the object here
#### Returns:
1. `animation` Animation in use
#### Usage:
```lua
local mainFrame = basalt.createFrame():show()
local subFrame = mainFrame:addFrame():show()
local aAnimation = mainFrame:addAnimation():setObject(subFrame):offset(1,12,1,5):play()
```
## size
Changes the size on the object which got defined by setObject
#### Parameters:
1. `number` width
2. `number` height
1. `number` time in seconds
1. `number` frames (how fluid it should look like)
1. `table` object - optional, you could also define the object here
#### Returns:
1. `animation` Animation in use
#### Usage:
```lua
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():setObject(testButton):size(15,3,1,5):play()
```
## textColoring
Changes the text colors of an object
#### Parameters:
1. `color|number` multiple colors
#### Returns:
1. `animation` Animation in use
#### Usage:
```lua
local mainFrame = basalt.createFrame():show()
local testButton = mainFrame:addButton():show()
local aAnimation = mainFrame:addAnimation():setObject(testButton):textColoring(colors.black, colors.gray, colors.lightGray):play()
```

View File

@@ -1,73 +0,0 @@
This is just a script which helps you to install basalt.lua, if it's not already on the computer. Means, you create your program (which requires basalt) and add this on the top of your program. Now, everytime you execute your program it checks if basalt.lua exists or not. If not, it will download it first and then continue to execute your program.
## Visual Installer
This is a visual version, it asks the user if he wants to install basalt.lua (if not found)<br>
![](https://i.imgur.com/b4Ys7FB.png)
```lua
--Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then
local w,h = term.getSize()
term.clear()
local _installerWindow = window.create(term.current(),w/2-8,h/2-3,18,6)
_installerWindow.setBackgroundColor(colors.gray)
_installerWindow.setTextColor(colors.black)
_installerWindow.write(" Basalt Installer ")
_installerWindow.setBackgroundColor(colors.lightGray)
for line=2,6,1 do
_installerWindow.setCursorPos(1,line)
if(line==3)then
_installerWindow.write(" No Basalt found! ")
elseif(line==4)then
_installerWindow.write(" Install it? ")
elseif(line==6)then
_installerWindow.setTextColor(colors.black)
_installerWindow.setBackgroundColor(colors.gray)
_installerWindow.write("Install")
_installerWindow.setBackgroundColor(colors.lightGray)
_installerWindow.write(string.rep(" ",5))
_installerWindow.setBackgroundColor(colors.red)
_installerWindow.write("Cancel")
else
_installerWindow.write(string.rep(" ",18))
end
end
_installerWindow.setVisible(true)
_installerWindow.redraw()
while(not(fs.exists(filePath))) do
local event, p1,p2,p3,p4 = os.pullEvent()
if(event=="mouse_click")then
if(p3==math.floor(h/2+2))and(p2>=w/2-8)and(p2<=w/2-2)then
shell.run("pastebin run ESs1mg7P")
_installerWindow.setVisible(false)
term.clear()
break
end
if(p3==h/2+2)and(p2<=w/2+9)and(p2>=w/2+4)then
_installerWindow.clear()
_installerWindow.setVisible(false)
term.setCursorPos(1,1)
term.clear()
return
end
end
end
term.setCursorPos(1,1)
term.clear()
end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
------------------------------
```
## Basic Installer
Here is a very basic one which just installs basalt.lua if don't exist:
```lua
--Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then
shell.run("pastebin run ESs1mg7P")
end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
```