Mobile app version of vmapp.org
Login or Join
Odierno310

: Logarithmic Spacing in Illustrator I'm trying to space text logarithmically. My goal is essentially the same as the one presented here, which is useful but doesn't help me as the only advice

@Odierno310

Posted in: #AdobeIllustrator #IllustratorScripting #Javascript

I'm trying to space text logarithmically. My goal is essentially the same as the one presented here, which is useful but doesn't help me as the only advice provided is to use JS, which I'm not familiar enough with to write something like this in from scratch, let alone in Illustrator.

Here is some code linked in the answer I'm referring to (JSFiddle):

function log10(val) {
return Math.log(val) / Math.LN10;
}
var paper = Raphael('meh', 1000,1000);
for (var i = 1; i <= 100; i++) {
var log = log10(i) * 125;
var yPos = 260 - log;
var r = paper.rect(0,yPos,5,1,1);
if (i==1 || i==10 || i==100) {
paper.text(15,yPos,i);
}
r.attr({opacity: 0.6, 'stroke-width': 0, fill: '#000000'});
console.log(yPos);
};


Credit: user568458

My first thought was to use a blend and replace the spine, but as I'm using outlined text, that wouldn't work. It would blend between the letters as well as space them but that's not what I want. I need the letterforms to stay intact.

If someone could help me adapt this code to a script that I could run in Illustrator I would appreciate it. I would need to be able to input custom values to control the spacing each time I ran the script.

EDIT: Thanks for the replies so far. Here's an image of what I'd like to accomplish. I placed these letters by hand using the logarithmic grid tool in illustrator, but I have several hundred characters of text I'd like to set with varying bases to achieve different spacings.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Odierno310

1 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel278

#target illustrator

function log10(val) {
return Math.log(val) / Math.LN10;
}


docRef=app.activeDocument;
for (var i = 1; i <= 20; i++) {
var pointTextRef = docRef.textFrames.add();
pointTextRef.contents = "Text #"+i;
pointTextRef.translate(10,400*log10(i));
};

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme