Line gradiant - flow in line

Post questions on how to use or achieve an effect in Inkscape.
Obiter
Posts: 5
Joined: Sun Feb 10, 2013 5:29 am

Line gradiant - flow in line

Postby Obiter » Sun Feb 10, 2013 5:36 am

Hi guys,

Just this afternoon I installed Inkscape and tingled with it a bit. In other words; first time user here and enjoying it. No prior experience in making graphics so Inkscape might be a bit of a challenge but that's ok; tutorials are there to help after all. There is one thing I can't seem to figure out however, an I'll insert the graphic here so you can follow.

Image

I have a curved line, which I wish to fill. Now, from left to right here's how I imagine it. From the starting point on the left all the way to "Punt A" (point A) needs to be solid red. Starting at Punt A all the way to Punt B needs to be a gradiant from red to green. From Punt B all the way to the end on the far right needs to be solid green.

I have managed to figure out how to curve and bend a line, fill it and use nodes and stops for the gradient. The problem however is that the gradiant follows a horizontal line, and does not follow the line itself. Result of this is that Cirkel A is red (bad) and cirkel B is green (also bad). Is there any way to get this trick done?

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Line gradiant - flow in line

Postby druban » Sun Feb 10, 2013 6:19 pm

No. Gradient meshes not available in Inkscape. Gradients on path not available in Inkscape. Possible to do like this, but not recommended for beginners. :( This is just a rough sketch but if you really want to do it this way I recommend more segments carefully blended...

rect4153.png
rect4153.png (28.69 KiB) Viewed 3633 times
Attachments
drawing.svg
It's not pretty... but it gets the job done.
(10.29 KiB) Downloaded 246 times
Your mind is what you think it is.

Obiter
Posts: 5
Joined: Sun Feb 10, 2013 5:29 am

Re: Line gradiant - flow in line

Postby Obiter » Sun Feb 10, 2013 7:28 pm

Am I seeing it correctly that what you did was cut the line up in segments using this technique and colour it from there?

http://www.inkscapeforum.com/viewtopic.php?t=961

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

Re: Line gradiant - flow in line

Postby brynn » Mon Feb 11, 2013 12:27 pm

Lol, that is definitely not pretty, druban!

Obiter, he has several objects there, some with gradients, all blurred, and arranged just right. Then he used clipping to get rid of the blurred edges. I don't think the topic you referenced has anything to do with it, because Inkscape still doesn't have a razor tool. But he did use several individual objects.

There really isn't a way to do what you want, not a very good way. I could probably come up with something using interpolation, or maybe stitch subpaths. But it won't be very much nicer than what druban did (if at all).

In the case of your example, if you turned the gradient handles 90 degrees (perpendicular) it will look close to what you described. But that won't work will all curved lines. Gradient's just can''t be easily curved yet, with Inkscape.

Obiter
Posts: 5
Joined: Sun Feb 10, 2013 5:29 am

Re: Line gradiant - flow in line

Postby Obiter » Mon Feb 11, 2013 7:41 pm

Darn, I was really hoping I could get this done using Inkscape. Would you guys happend to have any clue as to where to go from here to get the gradiant right?

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Line gradiant - flow in line

Postby druban » Mon Feb 11, 2013 9:08 pm

This can easily be done in GIMP witha single stroke using the dynamics panel and mapping the gradient to the stroke. I would do it in giMP at high resolution and import it into Inkscape where I could clip or mask it with a vector path for maximum smoothness..
Your mind is what you think it is.

Obiter
Posts: 5
Joined: Sun Feb 10, 2013 5:29 am

Re: Line gradiant - flow in line

Postby Obiter » Mon Feb 11, 2013 10:03 pm

Allright, I'm really starting to feel I'm in a bit over my head here, but I'm trying as good as I can.

I installed Gimp and opened the saved .svg. Gimp didn't open it as vector, so it get's all pixellie when zooming in. Nor are the layers imported. Did some Googeling, and found out others were having problems importing too, however their files didn't open at all so that wasn't much use to me. I have tried saving the image in Inkscape as a "normal" .svg instead of a Inkscape .svg but that didn't do the trick either.

See, the problem is that the graphic I want to create is good to go. It's all finished (but the gradiant of the line), and the line is part of a bigger whole. The image of the line I posted is not what I'm working on, but since it's a logo I'm working on I didn't want to use that image as it would feel like spam/ plugging a website. Since it's a logo I want to get things right and make sure it's scalable for the future, which is why i dove into Inkscape.

Now, I've found here (http://doc.opensuse.org/documentation/h ... p.graphics) that Gimp converts svg to raster graphics upon opening

GIMP has only a very limited support for vector graphics. For example, GIMP can open and rasterize vector graphics in SVG format or work with vector paths.


Which is not what I'm looking for. Also, upon opening the layers of the .svg are all merged so I can't edit the line individually.

I'm starting to feel a bit like a retard, as I'm sure most of you would have this job done between morning coffee and what comes after that, but I am doing the best I can here and appriciate your help a lot!

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Line gradiant - flow in line

Postby hulf2012 » Tue Feb 12, 2013 9:19 am

Hello
Well, I'm also making tests here, about my capacity to edit a video, so please forgive the continuity errors

Simulating curved gradients

Other thing, Synfig has a way to put a curved gradient
http://wiki.synfig.org/wiki/Curve_Gradient_Layer

On the other hand, personaly, i find Synfig slow at rendering on screen, and also its layer system is not so easy to understand.
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Line gradiant - flow in line

Postby druban » Tue Feb 12, 2013 9:43 am

I hope this will be reasonably simple.
1. Save the path to be stroked in its own svg file.
2. In the gimp, open a new document that will be the pixel size you want this element of your drawing to be with some extra room. In the paths panel import the svg file. It will appear as a path.
3. In the GIMP gradients panel create a new gradient that is what you want to color this path with.
4. Select the brush you want. Just a slightly soft edge is good enough since you'll be clipping it in Inkscape. In the dynamics section edit the dynamics that you have selected to link color to 'fade' and nothing else. Remove all other links. Also 100% for fade length.
5. In the paths panel select stroke path. This should be what you want, if not change the params.
6. Save this file as a PNG and open it in the original Inkscape file.
7. Stroke the original path to the width you like, according to the PNG of the gradient, and overlay it exactly.
8. Then do a stroke to path, and select both the bitmap and the path and do clip set.
gradpath.png
gradpath.png (40.13 KiB) Viewed 3518 times
Attachments
gradpath.svg
(223.69 KiB) Downloaded 230 times
Your mind is what you think it is.

Obiter
Posts: 5
Joined: Sun Feb 10, 2013 5:29 am

Re: Line gradiant - flow in line

Postby Obiter » Tue Feb 12, 2013 8:33 pm

Can't believe you acctually went through the hassle of making a tutorial for this, thanks! Watched it, but didn't use it. I have tried converting the file and opening it in Synfig, but that gave me some "couldn't open" errors... Probably didn't exactly use best practices creating this :p.

However, I have sorted it out! Here's what I did for future reference;

I made new nodes at Punt A, at the right end of Cirkel B, at the left end of Cirkel A and at punt B. I cut these to individual objects. After this I created a new image, used solely to create a rectangle and gave this rectangle the desired gradiant. I put markerlines on this gradiant at 25%, 50% and 75%. Checked their HEX values and used these values to make sure the gradiant on the line is continues.

Now, that's where it got a bit buggy. When filling the gradiant of the line between Punt A and Cirkel B all the other parts were still influenced by it. I reckon this is a bug, which can be worked-around by selecting the segment of the line you wish to edit, making it solid color, change it back to gradiant and thén filling it.

Result: to the naked eye it looks like a perfect gradiant. I'm sure in reality it is not, since I have 25, 50 and 75% as reference colors which is a bit off to the actuall curve, but it looks damn fine to the naked eye. Thanks for the help guys!


Return to “Help with using Inkscape”