Implemented brush mirror.
This commit is contained in:
parent
99fce57b35
commit
d8b4559f8a
15
README.md
15
README.md
@ -25,7 +25,7 @@ $ 3 ; Save to temporary storage, accessible with L
|
|||||||
> 10 ; Size 10
|
> 10 ; Size 10
|
||||||
> -4 ; Eraser, Size 4
|
> -4 ; Eraser, Size 4
|
||||||
> 10,0 ; Add pointer at pos
|
> 10,0 ; Add pointer at pos
|
||||||
> -400,0 ; Add mirror pointer, at 400x
|
> 400x0 ; Add mirror pointer, at 400x
|
||||||
> 4 #ff0000 ; Red brush, Size 4
|
> 4 #ff0000 ; Red brush, Size 4
|
||||||
> ? ; Remove last pointer
|
> ? ; Remove last pointer
|
||||||
```
|
```
|
||||||
@ -57,8 +57,13 @@ $ 3 ; Save to temporary storage, accessible with L
|
|||||||
|
|
||||||
#Units*
|
#Units*
|
||||||
```
|
```
|
||||||
5 ; 5px
|
5 ; value: 5
|
||||||
5,7 ; 5x 7y
|
5,7 ; position: 5x 7y
|
||||||
7x9 ; 7w 9h
|
7x9 ; rect: 7w 9h
|
||||||
{5h - 5s} ; 5% of canvas width, minus brush speed
|
#ff0000 ; color: red
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Mirror
|
||||||
|
- Filter
|
||||||
|
- Noise
|
||||||
|
-
|
||||||
|
@ -12,8 +12,15 @@ function Brush()
|
|||||||
|
|
||||||
this.active = function(cmd)
|
this.active = function(cmd)
|
||||||
{
|
{
|
||||||
|
var pointer = new Pointer();
|
||||||
|
|
||||||
if(cmd.position()){
|
if(cmd.position()){
|
||||||
var pointer = new Pointer(cmd.position());
|
pointer.position = cmd.position();
|
||||||
|
}
|
||||||
|
if(cmd.rect()){
|
||||||
|
pointer.mirror = cmd.rect();
|
||||||
|
}
|
||||||
|
if(cmd.rect() || cmd.position()){
|
||||||
this.add_pointer(pointer);
|
this.add_pointer(pointer);
|
||||||
}
|
}
|
||||||
if(cmd.color()){
|
if(cmd.color()){
|
||||||
@ -33,8 +40,9 @@ function Brush()
|
|||||||
var hint_value = (cmd.value() ? "Size "+cmd.value()+" " : "");
|
var hint_value = (cmd.value() ? "Size "+cmd.value()+" " : "");
|
||||||
var hint_position = (cmd.position() ? "Position "+cmd.position().x+","+cmd.position().y+" " : "");
|
var hint_position = (cmd.position() ? "Position "+cmd.position().x+","+cmd.position().y+" " : "");
|
||||||
var hint_color = (cmd.color() ? "Color "+cmd.color().hex+" " : "");
|
var hint_color = (cmd.color() ? "Color "+cmd.color().hex+" " : "");
|
||||||
|
var hint_rect = (cmd.rect() ? "Mirror "+cmd.rect().width+"/"+cmd.rect().height+" " : "");
|
||||||
|
|
||||||
return "Brush: "+hint_value+hint_position+hint_color;
|
return "Brush: "+hint_value+hint_position+hint_color+hint_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pointers = [new Pointer(new Position())];
|
this.pointers = [new Pointer(new Position())];
|
||||||
|
@ -35,11 +35,11 @@ function Pointer(offset = new Position(), color = new Color('000000'))
|
|||||||
|
|
||||||
this.position = function()
|
this.position = function()
|
||||||
{
|
{
|
||||||
if(this.mirror && this.mirror.x > 0){
|
if(this.mirror && this.mirror.width > 0){
|
||||||
return new Position(this.mirror.x - (brush.position.x + this.offset.x), 0 + (brush.position.y + this.offset.y));
|
return new Position(this.mirror.width - (ronin.brush.position.x + this.offset.x), 0 + (ronin.brush.position.y + this.offset.y));
|
||||||
}
|
}
|
||||||
else if(this.mirror && this.mirror.y > 0){
|
else if(this.mirror && this.mirror.height > 0){
|
||||||
return new Position((brush.position.x + this.offset.x), this.mirror.y - (brush.position.y + this.offset.y));
|
return new Position((ronin.brush.position.x + this.offset.x), this.mirror.height - (ronin.brush.position.y + this.offset.y));
|
||||||
}
|
}
|
||||||
return new Position(ronin.brush.position.x + this.offset.x, ronin.brush.position.y + this.offset.y);
|
return new Position(ronin.brush.position.x + this.offset.x, ronin.brush.position.y + this.offset.y);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user