Color change Bezier curves?

Post questions on how to use or achieve an effect in Inkscape.
pewknee
Posts: 2
Joined: Sat Jun 23, 2012 3:28 am

Color change Bezier curves?

Postby pewknee » Sat Jun 23, 2012 3:51 am

I'd like a color-change effect to follow my bezier curves/lines.

For example, imagine a cursive letter "g", and think of the path a pen takes while drawing the letter. I want the start point to be blue and the end point to be red. NOT a gradient relative to the workspace (entire letter blue on one side, red on the other), but following the line.

Is this possible?

Also, please let me know if my question is unclear; I can draw a mock-up of what I'm trying to do.

Thanks for any information.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Color change Bezier curves?

Postby brynn » Sat Jun 23, 2012 10:10 am

Image
Welcome to InkscapeForum!

I think I understand what you're asking. You want a gradient to follow a path. It's not easily possible with Inkscape. I can think of a definitely long and complicated workaround, but it's so bad, it's hardly worth mentioning.

pewknee
Posts: 2
Joined: Sat Jun 23, 2012 3:28 am

Re: Color change Bezier curves?

Postby pewknee » Sun Jun 24, 2012 7:16 am

Thanks for the welcome and reply.
:)

Yes, I want the gradient to follow a path. You worded it much better than I did!

Any suggestions for programs that can do this?

*How* difficult is your work around idea? I've thought of a few tedium-fests myself... I only have to do this 52 times to get a full upper/lower cased English alphabet, so it might be worth it. (Uhg.)

I was so hoping there was an easier answer I was overlooking!

Thanks again for the help.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Color change Bezier curves?

Postby brynn » Sun Jun 24, 2012 12:12 pm

Actually, I just thought of something that will make it not as tedious as I thought.

I was thinking of using the script letter, drawn as a single path, using whatever tool you want. Open Path Effect Editor (Path menu), and apply Pattern Along Path, to that path. Next make a tiny rectangle, whose width is the width you want for the path that makes the letter, and whose height doesn't matter. (So if you want the script letter to be 1 px in width, you'll have to do some zooming to make a rectangle 1 px wide.) Apply the gradient that you want for the letter, to the rectangle. Select and copy the rectangle. Then select the path to which you applied PAP. In the "Current effect" section of the editor, click the Paste button (beside Pattern Source). Uh-oh.....ok nevermind. I don't understand why, but the gradient fill won't be applied to the path. I can't seem to make any color fill apply to the path.

Ok, well the tedious method was this. Do the same thing, except that the height of the original rectangle will matter. But you'll have to experiment about it's height. I would probably actually start with a square. After you copy the rectangle or square and paste into path effect, switch the Pattern Copies to Repeated. What you should see now, is a chain of connected rectangles or squares. So there, you'll be able to decide how high the original rectangle should be. Or you might wait until you have the colors applied, to decide whether to make the original rectangle taller or shorter.

Next I was thinking of using the Paint Bucket tool, to fill each little rectangle. Note that you won't be able to select the little rectangles, but the Paint Bucket tool will fill the closed areas. (It can even fill areas in imported raster images!) Alternatively, you could select the chain of rectangles, and do Path menu > Object to Path, and then Path menu > Break Apart. Then you'll be able to select the individual rectangles. This might actually work better, because filling the rectangles with a regular fill, works better than Paint Bucket tool.

Next, I was thinking that you could draw another, much larger rectangle for a color reference. Apply the gradient that you want for the letter, to the ref rectangle. Now you can use the Dropper tool, in Pick mode, to color each little rectangle. It would help if you make the reference rectangle in some units that match the number of little rectangles in the chain. Then you could use either the ruler, or a grid, to help you choose points along the gradient in the ref rect, to color each little rectangle in the chain.

If the gradient is very complex, you would need many, many tiny rectangles. If it's fairly simple, you could get by with only....say, several tiny rectangles. You'd have to add some blur to the finished chain of colored rectangles, to fake the gradient. If you don't want the letters to appear blurred, you could use Clipping to obscure the blurred edges.

There might also be a way to use Interpolate, in a similar way. But I can only imagine it to be quite a bit more tedious. (Interpolate would make a much better fake gradient, but it would be making the paths or objects to interpolate, that would take so much time. And also the whole letter probably couldn't be interpolated all at once, so deciding which sections would take a lot of trial and error too.)

So, as I said from the beginning, probably not worth the trouble. I know I've seen this effect somewhere, where the gradient follows the path. It might have been in The GIMP, which is a raster graphics program, but I'm not sure. I also briefly used Paint.NET so I might have seen it there. I've used Alchemy too (although I currently can't seem to install it).


Return to “Help with using Inkscape”