How to fit an inverted gradient to a shape?

Post questions on how to use or achieve an effect in Inkscape.
sagegami
Posts: 6
Joined: Tue Jul 31, 2012 1:16 pm

How to fit an inverted gradient to a shape?

Postby sagegami » Mon Oct 21, 2013 9:49 pm

I am trying to fit an inverted gradient precisely to a shape and I can only get as far as inverting the gradient using shift + r but I can't figure out how to conform the gradient to the shape. I am using the current version of Inkscape on a Mac. Please help!
Screen Shot 2013-10-21 at 8.38.21 PM.png
Here is a simplified view of my problem, the shape is rectangular but the gradient is circular I need the gradient to be rectangular as well.
Screen Shot 2013-10-21 at 8.38.21 PM.png (59.2 KiB) Viewed 2152 times

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How to fit an inverted gradient to a shape?

Postby Maestral » Mon Oct 21, 2013 10:21 pm

There`s still no rectangular gradient in Inkscape but you could either make gradients from each corner to the center on four separate rectangles and then align them or duplicate the rectangle, adjust color and then blur it.
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

sagegami
Posts: 6
Joined: Tue Jul 31, 2012 1:16 pm

Re: How to fit an inverted gradient to a shape?

Postby sagegami » Mon Oct 21, 2013 10:31 pm

As I said this is a simplified version of my problem the real shape I'm working with has no straight lines and several dozen anchor points.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How to fit an inverted gradient to a shape?

Postby Maestral » Mon Oct 21, 2013 10:48 pm

Why haven`t you posted the real shape then? How does the rectangular gradient fit the curved shape?

Perhaps you would like to make gradient to follow the path, from edge to the center? Scale down and blur it or just interpolate.
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

sagegami
Posts: 6
Joined: Tue Jul 31, 2012 1:16 pm

Re: How to fit an inverted gradient to a shape?

Postby sagegami » Mon Oct 21, 2013 11:30 pm

Screen Shot 2013-10-21 at 9.57.45 PM.png
Screen Shot 2013-10-21 at 9.57.45 PM.png (94.85 KiB) Viewed 2123 times
I don't want a rectangular gradient, that was just for demonstration purposes. Fortunately I found an answer.

Step 1: draw shape
step 2: duplicate it
step: 3 use Path > Dynamic Offset then click and drag LMB outwards.
Step 4: Create new layer move shape into it then lock new layer
Step 5: Give outside shape fill color then set strokes to have no color.
Step 6: Set shape opacity to 35%
Step 7: Lock layer and unlock previous layer.
Step 8: Duplicate open layer
(You will now have three layers)
Step 9: Set desired stroke color in middle layer and leave fill with no color
Step 10: Set stroke width to desired value and set blur to 3.5
Step 11: Unlock top layer and select both inside shapes.
Step 12: Use Object > Clip > Set.
Step 13: Delete underlying fill color

And there you go, the process actually does not involve gradients at all but the end result looks like it does.

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

Re: How to fit an inverted gradient to a shape?

Postby hulf2012 » Tue Oct 22, 2013 12:56 am

Hello:
Your method is good.
Even more, There are other methods to simulate the same effect.
- One is using the interpolate extensiob between the path and its offset as you have done. But some things get automatized. A better explanation here:
http://tavmjong.free.fr/INKSCAPE/MANUAL ... nterpolate

- Other is duplicating, offseting, bluring the path, and then cliping it. There are more steps involved.

And maybe there are more
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
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How to fit an inverted gradient to a shape?

Postby Maestral » Tue Oct 22, 2013 4:23 am

@ sagegami

.... or as vigorous web searcher as you are...

you could hear of the mesh gradient?! Can you?
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: How to fit an inverted gradient to a shape?

Postby v1nce » Tue Oct 22, 2013 4:26 am

you could use filters too

viewtopic.php?f=9&t=12678&start=25#p49067

In the exemple I used stripes (using FeMorphology) but it would be easier to get a gradient (using feBlur)


Return to “Help with using Inkscape”