1

I'm trying to create a gradient both in the horizontal and in the vertical direction in Sketch.

  • Layering two gradient fills on top of each other, one horizontal, one vertical doesn't work: the top and left edges are not uniform
  • A radial gradient doesn't work: it has a "round" shape instead of a rectangular one

enter image description here

1 Answer 1

4

You could add multiple inner shadows with a small opacity just varying the distance from the corner.

I used 10% opacity for the red and just changed the X-Y coordinates.

inner shadow setup

that's the result, probably you can refine it with more steps / more transparency:

resulting gradient

As a bonus if you create a style with it you can reuse it in any shape.

3
  • Thanks! I was hoping for a way to achieve this without manually creating many visual layers, but I'll accept your answer if no one else has a better method :)
    – antoine
    Aug 11, 2017 at 18:04
  • Btw, did you notice that the top-left corner of the gray rectangle seem to "bleed" towards the top-left corner of the red rectangle? The diagonal is definitely lighter than its surrounding area. I suppose it's a result of how the shadows merge together...
    – antoine
    Aug 11, 2017 at 18:07
  • perhaps it is because of the multiple small inner shadows, if you make them larger you might get less "bleeding" - but there's a chance that right+bottom will bleed the red.
    – Luciano
    Aug 14, 2017 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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