1

Say I have a white curve in black background:

enter image description here

The curve has some points cut it to separate segments. From point A in the line whose opacity is 100%, the transparency gradually increasing and then decreasing so that when it reach point B, the opacity is 100% again. The middle point of the segment, therefore, will be fadest. The longer the segment is, the fader the middle point is. This will repeat for other segments.

The idea is that when a pendulum swinging in the dark then in the extremes it is most visually clear, and its balance point is fadest, and the trajectory is gradiently going from clear to faded. I use Inkscape, but answers for other tools are welcomed, because I guess the terminology is the same.

An example is provided by @Joonas, except that the slider points to the 100% opacity points, not 0. And I don't know how to add more gradient points like that.

How can I make this effect in a curve?


Also ask on Reddit.

  • 1
    I'm not sure I get it. Do you want a gradient that follows the path? That's what I think after reading the first paragraph after the image. Reading the second paragraph just makes me confused. Do you want to fake a long exposure photo effect in Inkscape? – Joonas Jun 14 '18 at 7:05
  • Yes, I want a gradient that follows the path, but the points I mark should always be whitest. The long exposure will create this effect, is that right? – Ooker Jun 14 '18 at 7:06
  • You mean they should always match whatever is behind them or something? If you make the points white, nothing in the background can be whiter than that... – Joonas Jun 14 '18 at 7:09
  • yes they should match what is behind them – Ooker Jun 14 '18 at 7:20
  • 1
    Oh I see... So you want to create a gradient that follows a path. So something like this, right? — I did some very quick googling and it seems like it's not possible in Inkscape, but who knows. I did this in Illustrator. It has a simple toggle in gradient settings: Apply gradient along stroke. – Joonas Jun 14 '18 at 11:19
2

The SVG format has no support for a gradient along a path, and neither does Inkscape, but you can get something similar with a Mesh Gradient*, using the Create and Edit Meshes tool.

For example, here's a stroked path, converted to outlines using Path > Stroke to Path, then a Mesh Gradient with 5 rows and columns was applied, and then the mesh was edited.

enter image description here

*Note: Inkscape's Mesh Gradients are not currently supported in browsers, so this won't display in an SVG viewed in a browser. However, that may change in time. It would still be possible to export the finished work as a raster image however, such as a PNG. Also, mesh gradients are supported in PDFs.

Edit:

After seeing what you did in Illustrator, there is another way this could be achieved in Inkscape, so that it would render in an SVG properly in a web browser.

The effect is simple. Place some radial gradient filled circles along a path and group them. Group the black background and white stroke to make a mask. Bring the mask to the top of the stack, and apply the mask to the grouped gradient objects. Place it over another black background.

enter image description here

  • why can't SVG support gradient? I thought that the format is for anything computable? – Ooker Jun 15 '18 at 1:43
  • @Ooker SVG does support gradients, but only gradients as a fill, not as a gradient along a path/stroke. It has never been implemented. And the mesh gradient feature hasn't made it into web browsers yet, but that might change in the future. – Billy Kerr Jun 15 '18 at 7:38
  • 1
    @Ooker because illustrator targets PDF and PDF can do this. Once SVG supports gradient meshes well you can ask for this feature into Inkscape. Like i said if you think of any feature than form your point of view everything is a just random unless you understand what the underlying rendering target the applications targetting. – joojaa Jun 15 '18 at 8:58
  • 1
    @Ooker -By the way Illustrator can do gradients along a path, however, it won't work when you output it as an SVG from illustrator, it will simply rasterize the gradient, which is not really a solution to the problem. – Billy Kerr Jun 15 '18 at 9:16
  • 1
    @Ooker the set of things that would be nice is infinitely big. Even illustrator did not support gradients on strokes before CC vesion. What standards designers have in mind is a big set of general purpose solutions where harder problems can be disected into. SVGs problem is that its no use of adding features if nobody is implementing them. The gradient mesh has been suggested its now waiting for enough browser vendors to implemnent it. Untill it does theres not much use for it. On that note you want to target PDF since your making publications and SVG does not work so well for print – joojaa Jun 15 '18 at 10:22
0

I finally make it:

  1. Appearance of the curve: Fill: none, Opacity: 100%. Select the stroke color and click gradient.

  2. Click on the underneath of the gradient slider to add more color stops. Even stops have 100% opacity, odd stops 0%. Slide all the midpoints as close as possible to the 100% stops.

  3. To make the opacity decreases faster, between two 100 points add two 0 points, then push each 0 point as close as possible to one end.

The result:


See more: Gradients in Illustrator

  • 1
    I believe you need to wait 48 hours and then you can mark your own answer as the correct one. Though you may want to add illustrator to the tags, since you switched to Illustrator. – Joonas Jun 15 '18 at 6:48
  • Thanks. What makes me wonder is that I only have 3 full opacity stops, but there are 5 in total. Do you know why? – Ooker Jun 15 '18 at 7:52
  • Anyway your cheating, its an ok answer but you have changed scope. I would be much happier if youd take your original questions scope back and start this question with no but illustrator can do this.Because you now invalidate Billy Kerrs effort. In either case you may want to present us the full problem your trying to solve instead. Tgat way we could rwally explain how you should approach your problem. – joojaa Jun 15 '18 at 8:30
  • Ooker you may have two curves on top of eachother. – joojaa Jun 15 '18 at 8:31
  • @joojaa but I've said at the beginning that I accept any software? Anyway, it's not that I didn't want to present the full problem, it's that I virtually didn't know any term to call it properly – Ooker Jun 15 '18 at 9:05
0

  • Place the image
  • Add a background black rectangle behind the image
  • Selecting the image > From the Transparency Panel > Make Mask
  • Transparency Panel > click the mask field to activate it
  • Make a circle > fill it with a radial gradient from white to black
  • Select the circle and pressing Alt to duplicate, move it
  • When ready > Transparency Panel > click back the editing area (the left square)

AI MASK


Shamelessly copied from Danielillo's answer from How to make multiple sneak peak holes?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.