Design&Prototype
Published in

Design&Prototype

Sketch: Responsive, “focusable” and swappable images using nested symbols and masks.

Sketch: Responsive images using nested symbols.

This technique improves on these current workflows:

Sketch 48 UPDATE! (December 11 2017):

Fix Width and Height for the masked image. The mask must instead be pinned to the borders of “image with mask”.

The setup is fairly simple…
You need a symbol to contain an image, and a mask, and the proper pinning properties via AutoLayout.

1. Create the core image template as a symbol

1000px x 1000px (big enough for the standard use in your project, mobile project? Try 320p x 320px)
One nested symbol with mask over a responsive image – also a symbol. And images with various focal points (the green dotted line represents the “focal area”)

2. Lay out in the square symbol:

The green dotted line represents the “focal area”

3. Create another symbol of the same dimensions as the image:

Pin the symbol containing the image to the center.. et voilà… the image/symbol is now masked! :)

4. Pin the symbol/image to the center of the mask

Pin the symbol/image to the center of the mask

5. Pin the mask to resize as the parent symbol is resized

With these pinning settings the mask will always match the dimension of the symbol that contains it.

6. Time to use your swanky 💎 new responsive image!

Insert the symbol “image with mask”
Drag it and resize it according to your needs
Override time!
Override the responsive image with another “image with focus” — notice that some are horizontal images, some vertical, but they all have the same size focal area.

Important:

4b. Pin the symbol/image to the center of the mask AND to the top and bottom of the symbol

Add top and bottom pins to make sure the images will be responsive horizontally

You can then swap a vertically responsive image/symbol for an horizontally responsive one. That’s pretty neat!

Swap a (vertically) responsive image symbol for an horizontally responsive one. 🐛 🚨 -> There’s a little bug… the nested symbol override is lost when swapping symbols 😟
When ready, turn off the dotted line.
Had a similar reaction? :)

Get the Sketch file:

  1. Download the .Sketch file
  2. Edit the symbols and see how they are set up.
  3. Change images and focal points and see how they change when you resize them in the main artboard.

To Download the .Sketch file – name a fair price:

Go make awesome stuff! :)

--

--

Design and prototyping tools and create user experiences for Mobile, Desktop, Wearables and beyond! I started this group to meet other prototyping enthusiasts and learn from each other.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store