Changed the line syntax to (line x1 y1 x2 y2)

This commit is contained in:
Devine Lu Linvega
2019-07-24 20:29:03 +09:00
parent 33574979cd
commit 1c7b74d582
13 changed files with 71 additions and 140 deletions

View File

@@ -70,8 +70,8 @@ function Library (ronin) {
return { cx, cy, r }
}
this.line = (a, b) => { // Returns a line shape.
return { a, b }
this.line = (ax, ay, bx, by) => { // Returns a line shape.
return { a: this.pos(ax, ay), b: this.pos(bx, by) }
}
this.text = (x, y, p, t, f = 'Arial') => { // Returns a text shape.
@@ -146,8 +146,8 @@ function Library (ronin) {
// Gradients
this.gradient = ([x1, y1, x2, y2], colors = ['white', 'black']) => {
return ronin.surface.linearGradient(x1, y1, x2, y2, colors)
this.gradient = (line, colors = ['white', 'black']) => {
return ronin.surface.linearGradient(line.a.x, line.a.y, line.b.x, line.b.y, colors)
}
// Pixels