3

enter image description here Hey folks, just whipped this up in Illustrator manually, but looking to do it on a much larger scale. Anyone have an idea as to how to automate this process or have a script that does somethin like it? Thanks!

Also, here's how I did it — is there an easier way in general? enter image description here

3 Answers 3

4

There's a great script - Rotate Toward Point by Hiroyuki Sato. The script rotates the objects in the selection toward the center of the foreground object.

Make sure to place the "selected" object (the one you want rotated towards) on the top.

Right click → Arrange → Bring to front (Shift+Ctrl+])

You just select everything and run the script.

         Before                    After

Before After

(This video also shows the script in action - first he distributes them along the path and then rotates them towards the center person)


enter image description here


Code Below

// rotateTowardPoint.jsx

// rotates the objects in the selection toward the center of the foreround object.
// USAGE: select the objects and run this script.

// test env: Adobe Illustrator CC (Win/Mac)

// Copyright(c) 2014 Hiroyuki Sato
// http://shspage.blogspot.jp/
// This script is distributed under the MIT License.
// See the LICENSE file for details.

// Fri, 14 Feb 2014 21:08:40 +0900

function main(){
    // settings:
    // extract_groups: rotates each item in the groups, otherwise rotates each groups  (checkbox value)
    // show_dialog: shows a dialog before execution, otherwise shows no dialog
    var conf = {
        extract_groups : false,
        show_dialog : true
    }

    if(documents.length < 1) return;

    var sels = activeDocument.selection;
    if( sels.length < 2 ) return;

    if( conf.show_dialog){
        var win = new Window("dialog", "rotateTowardPoint");
        win.alignChildren = "fill";

        win.chk = win.add("checkbox", undefined, "extract groups");

        win.btnGroup = win.add("group", undefined );
        win.btnGroup.alignment = "center";
        win.btnGroup.okBtn = win.btnGroup.add("button", undefined, "OK");
        win.btnGroup.cancelBtn = win.btnGroup.add("button", undefined, "Cancel");

        var getValues = function(){
            conf.extract_groups = win.chk.value;
        }

        win.btnGroup.okBtn.onClick = function(){
            getValues();
            rotateToPoint( sels, conf );
            win.close();
        }

        win.btnGroup.cancelBtn.onClick = function(){
            win.close();
        }
        win.show();
    } else {
        rotateToPoint( sels, conf );
    }
}

function rotateToPoint( sels, conf ){
    var target = sels[0];

    if( conf.extract_groups ){
        sels = extractGroup( sels.slice(1) );
    } else {
        sels = sels.slice(1);
    }

    // gets the center of the foreground object.
    // the other objects are rotated toward this point.
    var point = getCenter( target );

    for(var i = 0; i < sels.length; i++){
        var t = getAngle( point, getCenter(sels[i]));
        sels[i].rotate( t - 90, true, true, true, true, Transformation.CENTER );
    }
}

function getCenter(p){
    return [p.left + p.width / 2,
            p.top - p.height / 2];
}

function getAngle(p1, p2){
    return Math.atan2(p2[1] - p1[1],
                      p2[0] - p1[0]) * 180 / Math.PI;
}

function extractGroup( s, r ){
    if( r == undefined ) r = [];

    for( var i = 0; i < s.length; i++){
        if( s[i].typename == "GroupItem" ){
            extractGroup( s[i].pageItems, r );
        } else {
            r.push( s[i] );
        }
    }

    return r;
}

main();

The nice thing about using this script, is that you don't need to expand anything (non destructive). If you used a brush stroke you can easily change it later to a different one if needed.

1

It can be made duplicating arrow blends and replacing spines

enter image description here

  • Create the spines blending two angles, expand them and ungroup

spines

  • Create a blend between a horizontal and vertical arrow

enter image description here

  • Select the arrow blends and one of the angles and replace spine

spine

Result

result

1

I would use Effect > Distort & Transform > Transform

Draw a vertical row of arrows. The bottom dot is used as a rotation point.

enter image description here

Group all that.

Choose Effect > Distort & Transform > Transform from the menu

Set the Origin point to the Bottom Left:

enter image description here

Then add the amount of negative degrees you want in the Angle field and the number of copies you want in the Copies field.

enter image description here

Click Okay. Choose Object > Expand Appearance, then Object > Ungroup (twice), and delete what you don't want.

enter image description here

Illustrator will do math for you if needed as well....

If you know you want 8 angles of arrows within a 90° section, then you can insert 360/32 into the Angle field, then insert 8 in the Copies field.

360 degrees of a circle / 4 sections with 8 columns in each section so 8x4 = 32, thus 360/32

Illustrator will calculate the angle degree to fit 8 copies in one quadrant of the circle. Tab out of the Angel field, then go back and just add a minus (-) sign in front of the angle to get them to rotate right.

3
  • Too bad there is no skew option
    – joojaa
    Commented Oct 19, 2018 at 4:42
  • This is great, but is there a way to create the grid layout I have in the original post?
    – Josh K-H
    Commented Nov 15, 2018 at 16:06
  • @JoshK-H If the grid aspect is imperative, I honestly think either your existing method or the method posted by Danielillo are the better solutions. I'm not a fan of the javascript in this instance because none of the arrows are aligned to anything. My method aligns the arrows to each other while pointing to a central location. Danielillo's method aligns the arrows to a rectangular grid while pointing to a central location. The javascript just changes the angles of the arrows. -- But it's not my project :)
    – Scott
    Commented Nov 15, 2018 at 16:19

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.