Miggi: Hi friends, Miggi from
Figma here with another Study Hall.
Today we are gonna make interactive
component carousel galleries.
So just like in this prototype,
I can scroll and I can drag and I
can view each of these galleries.
What we're gonna do is we're gonna make
these a single interactive component
that can be reused again and again
with different images and even video.
So let's go.
I'm gonna begin right here in this file.
I'm gonna walk you through
what I've created and then
we're gonna start from scratch.
So here, this is what the
interactive component looks like.
It's a component set that's comprised
of three different components.
So this is the main component
and these are then variants.
Basically what's happening here
is we have these three squares.
These are gonna serve as
placeholders for the images and or
video in creating this prototype.
Now what we're doing is we have a frame
and, and we're gonna drag the images
over, gonna drag the placeholders over.
So then the second one will be in view,
and then we're gonna drag it again.
So the third one will be in view.
Then what we're gonna do is then
replace those placeholders with images.
The cool thing about having this as
an interactive component is that you
can easily swap out those images.
So let's start from scratch.
I'm gonna create a new
page and say gallery.
I'm gonna move this up to the top.
Let's begin by drawing a rectangle.
I'm gonna press the R key.
So here, I'm gonna press the R key.
There we go.
Let's also make my interface
just a little bit bigger so y'all
watching at home can see this.
So now that I have this rectangle
in my design panel, I'm gonna
set its width and its height.
I'm gonna set these both to
320, and the cool thing is, is.
When we make this and, and finish
this up, we'll be able to scale it
to whatever size that we want, but
we're gonna start it off as a square.
So we're gonna start
with this first square.
I'm gonna duplicate this, so I'm gonna
hold down the option key and drag
this to the right and we want to snap
it so it's immediately to the right.
Of that first square that we created,
this one, I'm gonna give it a different
fill color, so then that way we can
see the difference between them.
And then I'm gonna go ahead
and do the same thing.
I'm gonna hold down the option
key and drag this to the
right just until it snaps.
The option key is gonna be the duplicate.
If you're on windows,
it's gonna be the alt key.
And let's just change
that color right there.
So what we have now are three
different rectangles and you
can see them named over here.
Here.
What I would like to do is to name
them, so then that way I can more
easily understand what's happening here.
So I'm gonna select all three.
I'm gonna hit Command R, and that's
gonna allow me to rename those layers.
I'm gonna name this to image
and then add in those numbers.
So it's gonna be image one,
image two, image three.
I'll show you that one more time.
I'm gonna select all
three of those layers.
Hit command R, control R, if you're
on windows, and then type in image
and then add in those numbers.
And then here we go.
We have image one, image
two, and image three.
So what we're gonna do
next, we're gonna select.
All three of those we're gonna
come up here and we're gonna
create this as a component.
So a component is a reusable
element that we can have.
Once we create this as a component,
it will be available in the assets
area of our, our layer panel here.
So I'm gonna create this as a component.
So here we go.
We have our component.
Now what we want to do is we want to
frame this around the first image.
So I'm gonna hold down the command
key and drag this to the right.
If you're on windows, it's
gonna be the control key.
And what that is, is we're bounding
the first image, we're setting the
bounds for the first image there.
I'm gonna go ahead and name this.
This is gonna be our carousel
gallery, and we're only gonna
have three images in here.
However you can create it
to contain more images.
So, We have this.
Now what we need to do is create
additional variants so then
this way we can drag to them.
So here I'm gonna come up and with
the component selected, we're gonna
add a variant, and I'm gonna go
here to the variant that we just
created and then add a third one.
You might notice that.
It is all kind of clipping off.
So if we select the component
set that contains these variants,
we can now unclip that content.
So there we go.
We have 1, 2, 3.
Now what we're gonna do is set this
up so the bounds show the particular
image that we want for that variant.
So it's the first image here.
This is going to be the second one.
This is gonna be the third one.
So I'm gonna select, you'll see here
default, variant two, variant three.
If we want to rename those, we
can select the component set.
Come over here and we can change
those names so we can say, you
know, Gallery one, Gallery two.
And Gallery three.
So each one of these is
now named Gallery one.
Gallery two, Gallery three.
Let's go to this second one.
We can see that we have it selected
here, and I'm gonna press the return key.
The enter key on Windows.
And what that will do is
select all of the children.
So each of these.
Placeholders is nested inside of
this component here or this variant.
So what we're gonna do with them all
selected, I'm gonna hold down the shift
key and begin dragging to the right.
I'm also gonna hold the space bar just
to make sure we don't lose that nesting.
So as I am dragging it, I'm moving this.
To the left.
There it is.
So all three of those images are
still in there in that second
gallery, and you can see that its
bounds are around that second one.
So let's do that one more time.
Same thing.
We're gonna select gallery three.
We're gonna press.
Enter or return, it's gonna
select all of those children.
Now to select back to the parent,
we can press shift return,
that'll select the parent.
But by pressing enter or
return, we are now inside and
selecting those three images.
This one, we want to move,
so the bounds are around the.
Third placeholder.
So I'm gonna hold the shift key.
I'm gonna begin dragging and hold the
space bar just to make sure that it
remains nested inside of that component.
We're gonna check our layers.
So I'm looking at the layers here.
They're all still nested,
so that looks great.
Next thing what we're gonna do is we
want to add just a little bit more.
Base between all of our,
uh, different variants here.
So I'm just gonna extend
that out a little bit.
So there we go.
We move that out and if you
want to, you can also extend the
bounds of that component set.
The reason we want a little bit
more space is as we're prototyping
it, it provides an opportunity
for us to see our interactions.
Next, what we're gonna do is prototype
this, so then that way when we drag this
to the left, we will see the next action.
This is what's called an
interactive component.
This is a reusable element that will
contain these interactions that we can
use all over our prototypes, whether
we're making a presentation or we're
making a device prototype, so I'm
gonna go to prototype mode over here.
You can press shift E to swap
between prototype and design mode.
So when I'm in prototype
mode, my interface behaves
a little bit differently.
It allows me to create.
Interactions between elements.
So here, once again, I'm gonna
select this gallery, but if I
command click, it's gonna allow me to
select that first image placeholder.
And what that means is I can now
create an interaction from that
first placeholder inside of the
component to this next one here.
So we'll see on click change two.
We're gonna change those values in just
a moment, but we're gonna do so all
at the same time, so I'm not gonna be
too concerned about the details yet.
Let's go ahead and do
that with this next image.
I'm gonna command, click,
or control click on Windows.
I'm gonna drag this up.
Command, click on it again.
So you see we have image two
selected here in the layer panel,
and I'm gonna drag this down.
And so this way this.
One is gonna go to the second one.
The second one can go back to
the first one, and the second
one can now go to the third one.
So I'm gonna command, click on that third
one and we're gonna drag it so we go back.
So now we have two interactions going
back and forth between the first and
the second, and then two interactions
going between the second and the third.
Third.
I'm gonna click and drag to
select both of those interactions.
And now I'm gonna hold the shift
key and click and drag to select
all of these interactions.
So both of these interactions
and both of these interactions
are now selected together.
And I can come here to the interaction
details and I can change things in bulk.
So here I'm gonna choose on drag.
So now we have a bunch of on drag
behaviors, and we're gonna go
back and forth between those two.
The change to property mixed, this means
that each destination's gonna be a little
bit different, so we want to leave that.
Now.
We're gonna choose the animation type.
I'm gonna choose smart animate, and here
I'm gonna choose a custom beier curve.
What we want is we want a nice
little S-curve that appears here so
we have an ease in and an ease out.
So to change that and make it a little
more tighter or so we can repeat this.
I'm gonna type in my own values.
I'm gonna say .8,0,.2,1.
Now, what that means is the first
two coordinates represent this dot.
So it's 80% over to the right and
zero means it doesn't go up at all.
Then the next point right here means it's
20% over to the right and then 100% up at
the top, and that creates this S curve.
So this curve has now been applied
to all of these interactions, and
now let's supply a timing, that's
gonna be the same for them as well.
I'm gonna choose about 500 milliseconds,
and that 500 milliseconds is about a half
a second, so that should be pretty good.
Now this is set up, our interactive
component is ready and we can
reuse this as much as we want.
I'm gonna create a new frame.
I'm gonna press the F
key and draw out a frame.
So I'm gonna make sure I'm back in
the design mode and that's gonna
allow me to choose an iPhone 14 frame.
So here we go.
Here's my frame, and I'm gonna
call this, you know, let's see.
Phone.
Now what I can do is I can either copy
this first component and paste it here,
or I can grab it from my assets panel.
So here's my assets panel, and we can
see that we have our mobile gallery,
that's from another page, but this
right here we have our carousel gallery.
So this is our carousel gallery.
I'm gonna go ahead and drag this in,
and you can see that it exists now here.
So I'm gonna take this one and
I'm gonna drop in another one.
So we have two on this frame.
Let's give this a quick test.
I'm gonna click on the phone
frame, come over here to the
right and present the prototype.
So now we are viewing the prototype.
I'm gonna press the Z key to, to
zoom out and we're gonna drag it.
So we drag it to the right, we drag
it to the right, and that should work.
If it's not working, make sure the
interactions are on the actual image
placeholders that we have there.
So this is looking good.
Let's head back over here, and now I
can show you some ways to configure
this interactive component so you can
customize it with your own images.
I'm gonna select my phone frame here.
I'm gonna unclip the content
so then that way we can see
it extend beyond its borders.
Now I'm gonna place some
images into these squares.
I'm gonna come up here and choose file.
Place image will note that the keyboard
shortcut for me is shift command K.
It's gonna be shift control
K if you're on windows.
And when I do that, it's gonna bring
up this file browser that allows
me to find the files or the images
that I'm gonna be placing here.
So let's say I have some assets.
And I'm gonna choose some images.
So I have 1, 2, 3 images,
four, five, and six.
I'm holding down the shift
key to select them all.
I'm gonna press open.
And here what I can now
do is place these images.
So you'll notice up here the
interface has changed a little bit.
We can click or drag to
place, place, all discard.
But because we've generated these
rectangles, I can now place those images
to serve as fills in those rectangles.
So here we're creating those galleries.
Now that all of those images
have been placed, I can select
one of those components and if I
choose, I can clip that content.
So this one, let's say we leave it as is.
I'm gonna go back to the frame
that they're all nested in.
So if we look in our layers panel,
you can see here's our phone frame.
We have those two carousel galleries in
there, and now let's clip that content.
I'm gonna select the phone
prototype and hit play.
And now we can see, I'm gonna
press the Z key to zoom it out
a little bit as we drag this.
You can see it drag that those images,
and here when it's not clipped, we can
see the images on the edges and it's
what's known as more of an affordance.
So we know there's another image
there and we can work one way or
the other while creating these.
Next.
What I wanna show you is that as we
have these, if I were to click the
image inside of here, you'll notice
its constraints are both set to scale.
I'll show you that one more time.
If I command, click on this component
here, and we look at the constraints.
Both are set to scale.
What that means is, is that when I
drag this to the left, when I drag
this to the right, when I make this
a little bit taller, when I drag
this down, it will fill that space.
And what's cool about this is
that as I play this, when I
play this in the prototype, this
interaction will still work.
This makes the component that much more
flexible, so when you are making it, you
can do something where you have multiple
different types at different sizes.
Another cool thing that we can do
here is actually crop and adjust
the image within that thumbnail.
So here within this gallery,
let me clip that content.
Let's say I want to crop the
third image in this particular
gallery so I can select it.
I can come over here and I can
choose the second or the third item.
Let's say on this third
item, I want to crop it.
I can double click and I can then
option double click on that image and
I can choose how I want to crop it.
So I can extend this and I can make
any adjustment that I want to this
image and they will be retained.
So when I play this, You can see that it
will now keep that crop of this image.
There it is, and I can go back
to that first one or that second
one and see how that looks.
One little thing you want to be mindful
of is that once you crop it, it will
now stretch and squash the image.
So if you need to readjust that
image, just double click see
I am clicking on the image.
I'm gonna option double click on it.
That's gonna pull up the crop
options here, and I can set this
to fit or fill, and now when it's
set to fill, it will behave and
scale in a much more normal manner.
So once I've adjusted this image
right to where I want it, then
I can go ahead and re-crop it.
Let's just do one more.
I'm gonna draw another frame here.
And, let's go to our assets
panel and let's drop, you know,
another one of our galleries in.
I can make this the full size
as well, so I can expand this
to be the full size here.
let's say, want to populate
this, but it's already clipped.
I can use the shortcut, key
command shift K or control shift K.
If you're on windows, let's grab an image.
Let's place it here.
I'm going to, Click, so I'm inside,
and then option double click,
so then that way I can crop it.
There we go.
I'm gonna click outside of that.
Now when I select the gallery,
I can choose the next frame.
Let's place an image
into that frame as well.
So here we go.
I'm gonna place an image.
There we go.
That looks good.
And let's go to the third one.
And let's once again,
place another image there.
I'm gonna place that image there and then
we're gonna go back to that first one.
So now when I play my frame
in a prototype, I have
myself, let's press the Z key.
A nice carousel gallery.
Cool.
So be sure to check in the comments
for a link to a community file, if you
want to see how this is constructed.
That's it for today's study hall.
Hopefully you found this helpful.
We covered a whole range of
topics from interactive components
to nesting to prototyping.
So, I know there's a lot here.
Feel free to watch this a few times over.
Ask any questions that you may have in the
comments, and as always, happy designing.