Sg2.9
Help with very simple things.
Recent RSS
Help with very simple things.
From:  Kasper
Date:  16. April 2007, 13:08

Hi,
I can't figure out some things. I'v got some programming experience(PHP, pawno(C like), Basic), but not with java.
I allready tried to understand things in the reference and documanation.(and looked at the preinstalled scripts)
But all I can script now are random lines.

So, i'm searching for somebody who is most time online(msn, icq, etc), and want to help me. So I can sometimes ask some questions.
(And if you want me to stop asking. I won't ask more.)

Sorry for my crappy English. I'm Dutch.
e-mail: Defusix@live.nl

Thanks,
Kasper

Re: Help with very simple things.
From:  Thijs Gadiot
Date:  19. April 2007, 10:00

Hey Kasper,

Try asking a bit more concrete questions, I'm sure you'll find the answers you're looking for. What is it you want to be able to do?

— And Dutch people are known for speaking English quite well!

Re: Help with very simple things.
From:  Kasper
Date:  19. April 2007, 20:32

Thanks for the response.
Okay, I'll ask more concrete questions.
Now i'v got this script:

  • --------------

for (var i = 0; i < 100; i++) {

var art = new Path();
art.segments.add(new Point(10,10));
art.segments.add(new Point(Math.round(Math.random()*1000),Math.round(Math.random()*1000)));
art.style.stroke.color = RGBColor(254,244,0);
art.pointsToCurves();

}

  • -------------

But I only get black lines.
I tried other things. But all i got was that the lines becom green. But that should't be green but organge.

And i'v got another questions:
Can i replace art with something else. Or must it be 'art'?

Thanks in advance,
Kasper

  • - I know. I don't want to say dutch are not good in English. But I think I'll look(/sound) more stupid when people think i'm English. ;-).
  • -² I'm 16 years =P
Re: Help with very simple things.
From:  Jürg Lehni
Date:  19. April 2007, 20:45

Hi Kasper.

In Illustrator, the RGB values are between 0 and 1, not 0 and 255, so that is why you only get black.

'art' can be replaced by anything, as it is just a variable name.

And RGBColor should be created by calling 'new RGBColor()'. The other works, but is not standard.

to learn more about JavaScript, you might want to look at one of the many tutorials out there.

I will soon work on some tutorials and guidlines for Scriptographer, as this is badly needed.

Re: Help with very simple things.
From:  Kasper
Date:  20. April 2007, 20:54

It worked.
Thank you very much!

By the way, i'm looking forwared to a tutorial.

Re: Help with very simple things.
From:  Kasper
Date:  28. April 2007, 17:25

Hi,
I'v got another question
How can I make a circle.
I tried this:

  • -----------------------------------------

var art = new Path();

for (var i = 0; i <= 7; i = i + 1) {

art.segments.add(new Point(Math.cos(i)*100,Math.sin(i)*100));
}

art.pointsToCurves();

  • -----------------------------------------

And I experimented with the values.
But I never get a nice circle.

And: Is it posible to use degree input for sin/cos/tan instead of radian?

Thanks

Re: Help with very simple things.
From:  Jürg Lehni
Date:  28. April 2007, 18:05

Hi Kasper,

Your code produces a numerical approximation of a circle. This will never really turn out perfect. There is an easier way to create ovals and circles:
Document.createOval.

If you are interested in the approximation used to draw circles with bezier curves, have a look at Drawing a circle with Bézier Curves by G. Adam Stanislav. Mathematically, this actually also never results in a perfect circle.

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
Mosaic Staple Raster 24.03.10