Added star example

This commit is contained in:
Devine Lu Linvega
2019-07-21 11:20:58 +09:00
parent 3093a74d57
commit 0b72893ae9
4 changed files with 60 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ function Commander (ronin) {
this.run = (txt = this._input.value) => {
if (txt.indexOf('$') > -1) { ronin.log('Present: $'); return }
ronin.surface.maximize()
ronin.interpreter.run(txt)
ronin.always === true && requestAnimationFrame(() => this.run(txt))
}

View File

@@ -31,8 +31,8 @@ function Library (ronin) {
return { x, y, w, h, t }
}
this.circle = (x, y, r, t = 'circle') => { // Returns a circle shape.
return { x, y, r, t }
this.circle = (cx, cy, r, t = 'circle') => { // Returns a circle shape.
return { cx, cy, r, t }
}
this.line = (a, b, t = 'line') => { // Returns a line shape.
@@ -345,6 +345,11 @@ function Library (ronin) {
return args
}
this.table = (arg) => {
console.table(arg)
return arg
}
this.time = (rate = 1) => { // Returns timestamp in milliseconds.
return (Date.now() * rate)
}

View File

@@ -100,7 +100,7 @@ function Surface (ronin) {
}
this.traceCircle = function (circle, context) {
context.arc(circle.x, circle.y, circle.r, 0, 2 * Math.PI)
context.arc(circle.cx, circle.cy, circle.r, 0, 2 * Math.PI)
}
this.traceText = function (text, context) {