From 11c81aed6f6f6a44ca018f4b0791a7641601474b Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 25 Jul 2019 13:33:57 +0900 Subject: [PATCH] Added a super guide function --- README.md | 3 ++- desktop/sources/scripts/library.js | 8 +++++++- desktop/sources/scripts/surface.js | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 81d654e..15ee3a3 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ Additional functions can be found in the [includes](https://github.com/hundredra - `(svg x y d)` Returns a svg shape. - `(stroke ~shape)` Strokes 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. - `(frame)` Returns a rect 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. - `(clone a b)` - `(theme variable ~el)` -- `(gradient line ~colors 'black'])` - `(pixels rect fn q)` - `(saturation pixel ~q)` - `(contrast pixel ~q)` diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 640c601..dc176e8 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -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 } diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js index b820783..52c2697 100644 --- a/desktop/sources/scripts/surface.js +++ b/desktop/sources/scripts/surface.js @@ -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) {