Added a super guide function

This commit is contained in:
Devine Lu Linvega
2019-07-25 13:33:57 +09:00
parent 7f3a8cef52
commit 11c81aed6f
3 changed files with 11 additions and 4 deletions

View File

@@ -94,11 +94,17 @@ function Library (ronin) {
return rect
}
this.gradient = (line, colors = ['white', 'black']) => {
this.gradient = (line, colors = ['white', 'black']) => { // Defines a gradient color.
return ronin.surface.linearGradient(line.a.x, line.a.y, line.b.x, line.b.y, colors)
}
this.guide = (shape) => { // Draws a shape on the guide layer.
ronin.surface.drawGuide(shape)
return shape
}
this.clear = (rect = this.frame()) => { // Clears a rect.
ronin.surface.clearGuide(rect)
ronin.surface.clear(rect)
return rect
}

View File

@@ -160,8 +160,8 @@ function Surface (ronin) {
this.drawGuide = function (shape, context = this.guide) {
this.clearGuide()
this.stroke(shape, 5, 'black', context)
this.stroke(shape, 2, 'white', context)
this.stroke(shape, 3, 'black', context)
this.stroke(shape, 1.5, 'white', context)
}
this.clone = function (a, b) {