1

In the following post @joojaa writes out the math function for the artwork shown here:

enter image description here

His code is specifically in PostScript, which is awesome...but I'm wondering if this can't be converted to Javascript specifically to be written as an Illustrator script. I've tried it myself with no luck.

  var t = 1000;   //not sure what 't' should be other than a number
  var e = a.pathItems.ellipse(20*Math.cos(t)-10*Math.sin(5*t+Math.PI/2), 20*Math.sin(t)+10*Math.cos(5*t+Math.PI/2));
  e.stroked = true;
  e.filled = false;

The code actually does generate an ellipse but its def not correct. enter image description here

Any ideas on how to draw a math function for Illustrator using scripting?

4
  • @joojaa actual has a script for Illustrator for doing exactly that, which was linked to in the post you reference: bitbucket.org/joojaa/jooillustratorscripts/overview
    – Cai
    Sep 2, 2016 at 15:17
  • Thanks Cai. I saw the link but thought they were more PostScripts rather than Illustrator scripts. I'll see if I can learn something from these. I'll hold off answering my question until I've worked through the repo.
    – sushidub
    Sep 2, 2016 at 15:21
  • Its not postscipt its javascript.
    – joojaa
    Sep 2, 2016 at 15:28
  • Right - the scripts on your repo are Javascript. I'm referring to the section the post labeled PostScript. It threw me off. :) Thanks Joojaa for the scripts on Bitbucket btw. dropbox.com/s/fkkebu2zcqrujfp/…
    – sushidub
    Sep 2, 2016 at 15:32

1 Answer 1

1

I assume that this question is addressed at me. No, it isn't PostScript, its just a function I didn't claim otherwise (i mean pots script as in 'appended'). See GD.SE does not support LaTex so I use the next best thing, code.

You can drop the function into any function graphing utility you have. But if you dont have anything useful you can find one that I made for Illustrator users here (it is called jooGraphFunction), documentation can be found here with examples. Unfortunately there are infinite number of functions so I cannot cover entire math spectrum. But just as a tip Wikipedia contains quite a lot of examples.

enter image description here

Image 1 Graph the function (and rotate by 45 degrees)

Dont worry everything can be misunderstood. :)

4
  • To be fair, I just had a look and you did put it under the header "PostScript" ;-)
    – Cai
    Sep 2, 2016 at 18:37
  • @Cai yes cnaged it to Post scriptum is it better now?
    – joojaa
    Sep 2, 2016 at 18:38
  • looks good to me
    – Cai
    Sep 2, 2016 at 18:43
  • honest misunderstanding. In no way would I ever challenge your coding greatness. :) I mean that. Your work, since finding the repo, is helping me out a ton.
    – sushidub
    Sep 3, 2016 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.