Added basic math functions
This commit is contained in:
parent
d309a9f032
commit
0dc0db98a9
@ -28,7 +28,7 @@ function Theme (_default) {
|
|||||||
|
|
||||||
this.load = function (data) {
|
this.load = function (data) {
|
||||||
const theme = parse(data)
|
const theme = parse(data)
|
||||||
if (!validate(theme)) { console.warn('Theme', 'Not a theme', theme); return }
|
if (!validate(theme)) { return }
|
||||||
console.log('Theme', `Loaded theme!`)
|
console.log('Theme', `Loaded theme!`)
|
||||||
this.el.innerHTML = `:root { --background: ${theme.background}; --f_high: ${theme.f_high}; --f_med: ${theme.f_med}; --f_low: ${theme.f_low}; --f_inv: ${theme.f_inv}; --b_high: ${theme.b_high}; --b_med: ${theme.b_med}; --b_low: ${theme.b_low}; --b_inv: ${theme.b_inv}; }`
|
this.el.innerHTML = `:root { --background: ${theme.background}; --f_high: ${theme.f_high}; --f_med: ${theme.f_med}; --f_low: ${theme.f_low}; --f_inv: ${theme.f_inv}; --b_high: ${theme.b_high}; --b_med: ${theme.b_med}; --b_low: ${theme.b_low}; --b_inv: ${theme.b_inv}; }`
|
||||||
localStorage.setItem('theme', JSON.stringify(theme))
|
localStorage.setItem('theme', JSON.stringify(theme))
|
||||||
|
@ -91,4 +91,21 @@ function Library (ronin) {
|
|||||||
this.of = function (h, k) {
|
this.of = function (h, k) {
|
||||||
return h[k]
|
return h[k]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Math
|
||||||
|
|
||||||
|
this.add = function (a, b) {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sub = function (a, b) {
|
||||||
|
return a - b
|
||||||
|
}
|
||||||
|
|
||||||
|
this.mul = function (a, b) {
|
||||||
|
return a * b
|
||||||
|
}
|
||||||
|
this.div = function (a, b) {
|
||||||
|
return a / b
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,5 +16,21 @@
|
|||||||
(pos 0 (of (frame) "h")))
|
(pos 0 (of (frame) "h")))
|
||||||
1 "red")
|
1 "red")
|
||||||
|
|
||||||
(stroke (line (pos 0 0) (pos (of (frame) "w") (of (frame) "h"))) 1 "red")
|
(stroke
|
||||||
|
(line
|
||||||
|
(pos (div (of (frame) "w") 2) 0)
|
||||||
|
(pos (div (of (frame) "w") 2) (of (frame) "h")))
|
||||||
|
1 "red")
|
||||||
|
|
||||||
|
(stroke
|
||||||
|
(line
|
||||||
|
(pos 0 (div (of (frame) "h") 2))
|
||||||
|
(pos (div (of (frame) "w") 2) (of (frame) "h")))
|
||||||
|
1 "#72dec2")
|
||||||
|
|
||||||
|
(stroke
|
||||||
|
(line
|
||||||
|
(pos (div (of (frame) "w") 2) 0)
|
||||||
|
(pos (of (frame) "w") (div (of (frame) "h") 2)))
|
||||||
|
1 "#72dec2")
|
||||||
)
|
)
|
Loading…
x
Reference in New Issue
Block a user