Feb 10 2010

illustrator techniques: defining a custom pattern brush, take-2

It came to my attention that I breezed by an important point in the tutorial on creating a custom pattern brush or frieze. The online Illustrator manual apparently doesn’t have a good overview of complex pattern brushes either. It’s important because it’s a potential pitfall when it comes to creating the single instance of the border design. So, here is a better method (and a more complete explanation) that works with a wider variety of drawing methods.

Start by drawing at least 3 replications of the design that you want to have repeated in the brush pattern. Note: make sure all objects are on the same layer.

Draw a box with no fill and no border and position it so that it defines exactly one instance of the pattern design:

This box should be the last object drawn or, if not, should be arranged in front (Object > Arrange > Bring to Front).

Select all of the pattern elements and the box (Select > All).

Create a clipping mask defined by the box (Object > Clipping Mask > Make)

This will result in one instance of the pattern design:

Next, make sure the mask contents are editable (Object > Clipping Mask > Edit Contents). The entire pattern will be selected, though those objects outside the mask will appear outlined:

In most cases you will need to Expand Appearance to divide strokes and fills into separate, editable objects (Object > Expand…) If this menu selection is not available it may mean that you already have discrete objects, though drawings consisting of both fills and strokes will require expansion.

This will bring up the Expand dialogue box. Choose both Fill and Stroke.

Note that the strokes now appear to be filled objects.

The next few steps are important and failure to do them is usually the reason for an error when it comes time to create the pattern brush. Check to see if anything needs to be Ungrouped (Object > Ungroup). If not, the menu option will be greyed-out and it is safe to continue. Otherwise, choose Ungroup and repeat, if necessary, until the option is greyed-out.

Then make sure the only the mask is editable (Object > Clipping Mask > Edit Mask).

After this, it is again important to click inside the masked instance of the design to select it, as opposed to the mask itself. Simply click once in the center of your design.

Next Divide the paths (Effect > Pathfinder > Divide):

Now, create a new pattern brush in the Brush panel (A) and, in the New Brush dialogue box, specify New Pattern Brush (B).

If all goes well, you should next see the Pattern Brush Options dialogue box. If you get an error message, the most likely cause is the contents of the mask were not expanded fully or they were not fully ungrouped. Undo repeatedly until you get back to before the mask was defined and try again. Depending on the intricacy of the design and the way it was constructed, you may need to choose (Object > ) Expand Appearance, instead if Expand… or it could be as simple as ensuring that you have clicked on the contents of the mask after making it editable.

Once you have successfully gotten to the Pattern Brush Options dialogue box, give the brush a name and the pattern instance should appear in the small preview pane indicating a “side tile” (as opposed to a corner).

Test the brush by drawing a line and applying the pattern brush to it:

The design should appear seamless, with no gaps or mismatches. Otherwise, go back and redraw the box to define the mask.


Jan 28 2010

flash techniques: inspect detail with a magnifying glass

Does anyone still use Flash? Okay, I admit, I do. I have a little library of useful tools and this is one of them. How many times have you embedded an image on your website and then decided that you needed to have an enlarged version for more detailed views?

This has an obvious drawback–piracy of the enlarged image is one. If a detailed view of a portion of the image is all that is required–for example, for inspection of intricate designs or to focus in on map details–this is a way to accomplish magnification without giving away your work. View an example.

The requirements are Flash (of course) and a little bit of Actionscript know-how. This example uses Actionscript 2.0 so it can be accomplished using venerable versions of Flash, beginning with Macromedia Flash MX and more recent.

The first thing you need is a large version of your image from which a smaller version will be made.

The small image will be sized to fit in your webpage layout. For this example, I wanted the image to be 480 px wide.

The magnification will be 2.5 times, therefore the large image would be 1200 px wide (480 x 2.5 = 1200). The image you choose should be at least 1200 px wide.

In Photoshop (or another image editing application), File > Open > (your large image) Now is a good time to save the image with a new name so that you don’t accidentally ruin the original. I saved the exmaple image as large.jpg (the image can be any format that Flash recognizes: .jpg, .gif, .psd, etc.)

Re-size the image to be 1200 px wide: Image > Image Size… Make sure the resolution is set to 72 ppi (A) and change the pixel dimension to 1200 px wide (B).

Now, save the image as large.jpg.
(File > Save As…)

Once again, re-size the image (Image > Image Size…) but this time the pixel dimensions will be 480 px wide (or 2.5 times smaller than large.jpg). Remember the height dimension— it will be needed in Flash.

Save this as small.jpg.

Open a new Flash file. If using CS4 be sure to specify Actionscript 2.0, not 3.0.

The stage size will need to match the size of small.jpg: Modify > Document…

In the dialogue box enter 480 px wide x the height dimension of small.jpg.

Import small.jpg to the stage: File > Import > Import To Stage…

Position the image so that it completely fills the stage. In the Properties palette, change the position to x: 0.00 and y: 0.00.

Rename the layer: small (A) (Note: rename the layer by double-clicking on the layer name to enter edit mode.)

Create a new layer (B) and rename it: large

At this point you should save the file: File> Save As…

The large image will be loaded into a Symbol: Insert > New Symbol…

Give the symbol the Name: large_mc and the Type: Movie Clip

This will open the new blank movie clip. Into this, import the large image: Import > Import To Stage…

Set the position to x: 0.00 and y: 0.00

Return to the main stage by clicking “Scene 1″ in the upper left of the project window:

Click on the keyframe in layer large (A) to make it active.

From the Library panel, drag the Movie Clip, large_mc (B) onto the stage.

The position on the stage is unimportant, however to better see what you are doing, drag it to one side or the other of the main stage.

With large_mc still selected, open the Properties panel and give it an Instance Name: largeView.

Right-click on the Movie Clip to bring up the contextual menu and select Actions.

This will bring up the Actions panel. Enter the following code, exactly as shown (be sure to include the closing bracket on the last line):

onClipEvent (enterFrame) {

_root.largeView._x = (_root._xmouse * -1.5);
_root.largeView._y = (_root._ymouse * -1.5);

}

This code works as long as the large image is 2.5 times larger than the small image. The value “-1.5″ controls the positioning of the mouse relative to the large view. If you think of the small view as being 1x and the large image as 2.5x, 1x – 2.5x = 1.5x. -1.5 is the value used in the code. Therefore, if your large image is 3 times larger than the small image, the formula would be 1x – 3x = 2x and -2 would be used instead of -1.5 in the code.

Close the Actions panel.

Create a new layer above large and name it glass. (Note: the order of the layers is important.)

At the bottom of the Tool panel, set the Stroke color (A) to transparent. The Fill color is unimportant.

Using the Oval Tool (B), draw a circle (hold down the SHIFT key as you drag to constrain to a circle shape).

In the Properties panel, make the diameter 140 pixels (C).

Right-click on the circle and select Convert to Symbol…

In the Symbol dialogue box, give the circle a Name of glass_mc and a Type of Movie Clip.

Close the dialogue box.

There should be a circle and small crosshairs in the center of your circle. In the Properties panel, give the Movie Clip an instance name of glassLens.

Right-click on the circle and choose Actions from the contextual menu. In the Actions panel, enter the following code:

onClipEvent (enterFrame) {

_root.glassLens._x = (_root._xmouse);
_root.glassLens._y = (_root._ymouse);

}

Close the Actions panel.

Right-click on the glass layer in the Timeline and choose Mask from the contextual menu.

The layers should appear as shown below and the circle will now be invisible.

Save the file.

Test the movie: Control > Test Movie.

If you want to add a bezel (rim) to the magnifying glass, create a new layer above glass and rename it bezel.

On this layer, draw a circle with a stroke color that will show against the background of your image.

In the Properties panel, change the diameter of the circle to 140 pixels and the stroke size to 2.00 pixels.

With the Selection Tool, double-click on the circle to enter edit mode.

Click once on the fill region of the circle to select it and press DELETE to erase it, leaving only the stroke.

Click on “Scene 1″ at the top of the edit window to return to the stage.

Right click on the bezel and select Convert to Symbol…

In the Symbol dialogue box, give the symbol a Name of bezel_mc and the Type of Movie Clip.

Close the Symbol dialogue box. In the Properties panel, give the Movie Clip and instance name of bezelEdge.

Right-click on the Movie Clip and select Actions.

Enter the following code in the Actions panel:

onClipEvent (enterFrame) {

_root.bezelEdge._x = (_root._xmouse);
_root.bezelEdge._y = (_root._ymouse);

}

Close the Actions panel.

To make the cursor invisible, place your cursor in the keyframe of the bezel layer (A), right-click and select Actions (B).

In the Actions panel, enter the following code:

Mouse.hide();

Close the Actions panel. Save and test the movie.

You should now be able to insert the .swf file to your webpage.


Jan 13 2010

illustrator techniques: use custom brushes to create a custom border or frieze

The technique of making a custom border in Illustrator is similar to specifying a pattern. View the example starting motif and the finished border.

Start with a linear pattern that you wish to repeat seamlessly. I found this albatross motif which I (hand) traced in Illustrator.

And generated at least one instance of a seamless repeat by copying and pasting and filling in the missing segment.

First, make sure all of the elements of the motif are grouped together: Select > All and then Object > Group

This will also place all of the objects on the same layer.

Make sure the rulers are visible: View > Show Rulers

Find the edges of the repeat and drag guide lines from the vertical ruler to align with each of the edges. Try to be precise so there are no gaps or overlaps in the repeated design.

Make sure the guides are locked: View > Guides > Lock Guides. Make sure there is a check mark next to Lock Guides. Click to toggle the lock on or off.

With the Rectangle Tool (1), draw a box with no fill and no border (2) that completely encompasses the area to be repeated.

Select All again and choose Crop (1) from the Pathfinder panel (2).

This should result in a single instance of the repeat.

Note: If the original design includes complex appearances or blends, you may have to expand the appearances (Object > Expand Appearance) or expand strokes and fills (Object > Expand…) before cropping.

Select All again and open the Brushes panel (1). Make a new brush (2) and select New Pattern Brush (3):

Frm the Pattern Brush Options dialogue box, name the brush (1) and click on the Side Tile indicator (2) and click OK:

To test the repeat, use the Pen Tool (1) to draw a straight line (2):

Select the line. From the Brushes Panel (1), choose the new custom brush (2):

To change the size of the border, first select Object > Transform > Scale…

From the Scale dialogue box, make sure Scale Stroke & Effects is checked:

With the line segment selected and holding down the Shift ket, pull the upper corner handles out: