From the course: SVG: Clipping, Masking, and Filters

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

feOffset

feOffset

From the course: SVG: Clipping, Masking, and Filters

Start my 1-month free trial

feOffset

- [Morten] The feOffset filter primitive offsets the input graphic by the value defined in the dx and dy attributes. This is useful any time you need to move the output graphic relative to some other graphic you have in your SVG filter, for example, if you are creating a drop shadow. So right now you can see we've created this shadow by creating a sandwich of a blurred version of the rectangle, plus the solid version of the rectangle on top, but the shadow is uniform across the entire rectangle, making it look like the light source is directly above. If we want this to look like a true drop shadow, we need to shift the drop shadow either to the left, or to the right, and up or down so that it becomes a little offset from the original rectangle. That's exactly what we're gonna use feOffset for. FeOffset has two main attributes, dx and dy, this is a deviation in the x axis and the y axis, and this will take both positive and negative numbers. These numbers are relative to the top left…

Contents