Sg2.9
define fill color at runtime
Recent RSS
define fill color at runtime
From:  alessandro
Date:  29. February 2008, 14:31

hi every one,
I'm new of scriptographer and I'm trying to write a little script to understand how it works.

I saw this tutorial – http://www.scriptographer.com/Forum/Help/Tutorial-02-Color/ – about the color, but I want to define the color of a rectangle just before drawing it (and not after I've made all the rectangles).

is it possible?
thanks in advance!

Re: define fill color at runtime
Date:  1. March 2008, 02:02

this should do the trick:

var rect = new Rectangle(10, 10, 10, 10);
var rectPath = document.createRectangle(rect);
rectPath.style.fill.color = RGBColor(0,1,0);
Re: define fill color at runtime
From:  alessandro
Date:  14. March 2008, 14:08

thank you jonathan, but your code doesn't work for me...

I have to put you code into this function:

function drawAlien(x1, y1, size, colorato){
var nero = new CMYKColor(0, 0, 0, 1);

var rect = new Rectangle(x1, x2, size, size);
rect.center = new Point(x2, y2);
activeDocument.createRectangle(rect);
}

Re: define fill color at runtime
From:  alessandro
Date:  18. March 2008, 11:25

thank you, now I'll try your code and I'll post feedback!

Re: define fill color at runtime
From:  Alessandro
Date:  22. March 2008, 16:54

Yes! it works thank you very very much!

I'll try to go further with my script idea (this is only a part of it)...
I hope I'll can post something soon!

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Crop Marks 14.02.12
by Zed