This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Adobe Illustrator for Windows > December 2006 > Random baseline shift





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Random baseline shift
Nol._G.@adobeforums.com

2006-11-19, 9:14 pm

Hello to all !

My question is : is it possible to randomly change the "baseline shift" on a text, to get an effect like this : <http://ddisk.ovh.org/text.jpg>

I've done this manually, and it's very long and boring to do, especially when there's more text. So, if there's any way to do this automatically, I would be glad to know it.

Thanks a lot to all !
James_Talmage@adobeforums.com

2006-11-19, 9:14 pm

The script below will do that. It's a very simple script that does what it does in only 10 lines. But I've commented each line to help you see how it works.

Copy everything below my initials. Paste it into a text editor. Save it as a PLAIN TEXT file. Name it whatever you want, but give it a .js filename extension. Put in in Illustrator's Presets/Scripts folder. Quit and relaunch Illustrator. The script will a
ppear in the File>Scripts submenu.

To use it, "normal select" a single textFrame object. Then select the script from the File>Scripts menu. The script will prompt you for a baseline shift range value. It defaults to 10 pts, but you can enter whatever value you want. It will then randomly s
hift the baseline of each character between the positive and negative of the value you entered.

JET

//--------------------------
//JET_RandomBaselineShift.
//A Javascript for Illustrator CS2.
//By James E. Talmage.
//Randomly sets the baseline shift of each character in a single selected textFrame.
//The topmost selected object must be a text object.
//It can be pointType, areaType, or pathType.
//But it must be normally selected as an object, not as a range of test.
//Just select the text object and then run the script.

//Reference the document.
var docRef = activeDocument;

//Reference the first selection in the document.
var textRef = docRef.selection[0];

//Get the number of characters in the selected object.
var charCount=textRef.textRange.characters.length;

//Set a variable to serve as alternate positive and negative value.
var shiftSign=1;

//Let the user determine the baseline shift range.
var shiftRange = prompt("Enter the distance, in points, by which you want the Baseline Shift to vary.", 10);

//For each character...
for(i=0; i<charCount; i++){

//...flop the positive/negative...
shiftSign*=-1;

//...reference the range multiplied by a random number between 0 and 1...
var curShift=Math.round(Math.random()*shiftRange);

//...shift the current character by that amount.
textRef.textRange.characters[i].characterAttributes.baselineShift=curShift*shiftSign;

}
//-------------------------
Nol._G.@adobeforums.com

2006-11-19, 9:14 pm

Wonderful !
I really ought to learn javascript...

Thanks a lot for your fast anwser Mr. JET !

Nol.
Kurt_Gold@adobeforums.com

2006-11-19, 9:14 pm

If it were not that important to maintain editable text, you could also outline the text object, ungroup and then execute the Transform Each command (Move vertical) with the Random option turned on.
Nol._G.@adobeforums.com

2006-11-19, 9:14 pm

Thanks a lot for this useful tips, Kurt !
It's definitely something to know. But as James'script does the same thing, I'd rather use it, because I could have the need to change the font quickly, or some other character parameters.
Anyway, thanks again for your help. I think it will be very useful if I have to do this effect again while not working at home (without the script)

Nol.
Bert Philippus

2006-12-06, 8:16 pm

Here's another way:

Draw a short horizontal path. Copy and paste it so the left end of the copy aligns with the right end of the original. Ctrl-D until you have a long line of dashes.

Copy the long line of dashes down a bunch of times.

Select all, Object>Transform>Transform Each, set for Preview, Random, and enter a number for vertical transformation, and a small angle for rotation if you wish.

Leave selected, then go to Type>Threaded Text>Create.

Apply any text to this threaded complex of paths, and play with the result.

Bert
Nol._G.@adobeforums.com

2006-12-06, 8:16 pm

Thanks for this new method Bert !
Something between the previous ones, and very useful too I'll say !

Nol.
Bert Philippus

2006-12-06, 8:16 pm

I had a lot of fun with it last night...
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews