Added a super guide function
This commit is contained in:
parent
7f3a8cef52
commit
11c81aed6f
@ -51,6 +51,8 @@ Additional functions can be found in the [includes](https://github.com/hundredra
|
|||||||
- `(svg x y d)` Returns a svg shape.
|
- `(svg x y d)` Returns a svg shape.
|
||||||
- `(stroke ~shape)` Strokes a shape.
|
- `(stroke ~shape)` Strokes a shape.
|
||||||
- `(fill ~rect)` Fills a shape.
|
- `(fill ~rect)` Fills a shape.
|
||||||
|
- `(gradient line ~colors 'black'])` Defines a gradient color.
|
||||||
|
- `(guide shape)` Draws a shape on the guide layer.
|
||||||
- `(clear ~rect)` Clears a rect.
|
- `(clear ~rect)` Clears a rect.
|
||||||
- `(frame)` Returns a rect of the frame.
|
- `(frame)` Returns a rect of the frame.
|
||||||
- `(center)` Returns a position of the center of the frame.
|
- `(center)` Returns a position of the center of the frame.
|
||||||
@ -59,7 +61,6 @@ Additional functions can be found in the [includes](https://github.com/hundredra
|
|||||||
- `(crop rect)` Crop canvas to rect.
|
- `(crop rect)` Crop canvas to rect.
|
||||||
- `(clone a b)`
|
- `(clone a b)`
|
||||||
- `(theme variable ~el)`
|
- `(theme variable ~el)`
|
||||||
- `(gradient line ~colors 'black'])`
|
|
||||||
- `(pixels rect fn q)`
|
- `(pixels rect fn q)`
|
||||||
- `(saturation pixel ~q)`
|
- `(saturation pixel ~q)`
|
||||||
- `(contrast pixel ~q)`
|
- `(contrast pixel ~q)`
|
||||||
|
@ -94,11 +94,17 @@ function Library (ronin) {
|
|||||||
return rect
|
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)
|
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.
|
this.clear = (rect = this.frame()) => { // Clears a rect.
|
||||||
|
ronin.surface.clearGuide(rect)
|
||||||
ronin.surface.clear(rect)
|
ronin.surface.clear(rect)
|
||||||
return rect
|
return rect
|
||||||
}
|
}
|
||||||
|
@ -160,8 +160,8 @@ function Surface (ronin) {
|
|||||||
|
|
||||||
this.drawGuide = function (shape, context = this.guide) {
|
this.drawGuide = function (shape, context = this.guide) {
|
||||||
this.clearGuide()
|
this.clearGuide()
|
||||||
this.stroke(shape, 5, 'black', context)
|
this.stroke(shape, 3, 'black', context)
|
||||||
this.stroke(shape, 2, 'white', context)
|
this.stroke(shape, 1.5, 'white', context)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clone = function (a, b) {
|
this.clone = function (a, b) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user