Principle - Paged Scrolling (Simple Walkthrough)

NorthGrid
26 followers
1 Video View·Oct 27, 2022
Hello and welcome to Sketch Together. My name is Pablo Stanley and this is part of a crash course
on Principle for Mac. Principle is a great tool for creating UI interactions and prototypes and
animations. On this session we're going to learn how to create simple page scrolling using drivers.
Just a simple walkthrough and it's going to look pretty cool. I know you're going to love this.
Let's go ahead and do it. So here I have a sketch file and on the sketch file I have two artboards,
one where the walkthrough is happening and also just a success screen for when you tap on this
button. So here I have the content of the walkthrough, all the different screens, but let
me show you, let me put outside the artboard so you can actually see it. So as you can see there
are three icons, one heart, chicken, and a skull. Let me change the color of the skull so you can
see it. There you go. So these are obviously outside the artboard and I also have a spacer
layer and this spacer layer is pretty much the size of the artboard multiplied by three.
That way that when you are using page scrolling it will, you have a layer that tricks the
principle into aligning everything on the center using that size of the spacer. So let's go ahead
and open principle and import all of this. I'm going to create a new document on principle
and I'm going to press the import button and yeah, automatically it tells me to import this
and I'm going to move this outside. I'm going to make principle big and here as you can see I have
all the elements. I have the chicken, the heart, and the skull. So let's go ahead and on this
group I'm going to add scrolling horizontal and I'm going to do page and that way it will
snap to the size of the screen. So let's go ahead and just test this. So here as you can see
it's trying to, now it's scrollable but it doesn't go all the way to the left and that's because
the size of this has to be the size of the actual artboard. So let's go ahead and try it again
and as you can see it snaps once it takes the, it's close enough to the next size of the page.
Perfect! So now we have that and that's pretty basic but you want to do more. You want to
be able to control the opacity of the dots and the appearance of this button when you're scrolling.
So to do that you're going to use drivers and here in drivers since we added a scrolling to this
now we can start editing layers when you're scrolling. And here in the drivers it looks
like it's a timeline like if you were controlling time but actually what you're controlling
is you're controlling different elements with the scrolling. So here for example is a scroll
on the x position of this element. When you're moving it you can start adding keyframes of
different elements that change. So the first thing that I want to do is change the opacity
of the dots. So dot one starts at 100 percent and then all these start up move to 40 percent.
So here I'm going to add around when it's around here it's 320 I think or 375 I'm going to change
the opacity of I'm going to add a keyframe to I'm going to select all of these dots I'm going to
add a keyframe here of opacity and then I'm going to add another keyframe here on zero just
just pressing there and then over here I'm going to change the opacity of dot one to 40 percent
from 100 to 40 percent and then dot two I'm going to change the opacity from 40 to 100 percent.
And now when the when the layers are being scrolled the opacity of the dots are changing
with the scrolling on the x position. Now I'm going to add another keyframe all the way here
when the skull is in the middle and here I'm going to change the I'm going to add keyframes
again and then dot three is going to change to 100 percent from 40 and then dot two is going
to change back to 40 percent. There you go. So now we have all the dots changing the opacity
according to the to the position of the scrolling. So let's test it out. So as you can see when I
move this this controls the different opacity of the of the dots down there because I'm using
drivers and I'm using depending on the x position of this element the the properties of this will
change. Let's start changing other elements. So for example now I want the button to appear
only when the last the skull appears. So what I can do is I'm going to to the button I'm going
to add a keyframe to the to the y position and then I'm going to add another keyframe around
another keyframe and then from here it's going to move from from all the way here and then it moves
here when when it appears. So let's go ahead and test it. So as you can see the button doesn't
appear until the x position of the draggable content is around there. Perfect. So that's it
and now I want to get a little bit crazy with the elements the elements the heart the chicken and
the skull. I want also them to grow and appear on screen. So for example I'm going to show you
I'm going to go ahead and and here on these elements I'm going to add keyframes to the opacity
right there and then I'm going to also add keyframes to the scale so they grow when they
appear when they appear on on screen. So I'm going to move all of this I'm going to make this a little
bit bigger there you go and and now let me zoom in so we can see the contents and now so from over
here these two elements start with a scale of let's go to 0.2 and then also the opacity of let's
say from 30 or 40 percent just as it does there you go so now I'm going to add another keyframe
around here in the middle and then I'm going to change the heart the scale I'm going to change
it to 0.2 just as the other ones and then I'm going to change the opacity to 40 percent and then
the chicken now it grows to the scale of one and also the opacity goes all the way to 100 percent
and then this little guy when it's here the skull I want to change the scale to one and also
opacity to 100 but I'm going to change the keyframes of these to start around here instead
all the way in in the beginning that way the keyframes start from here okay so now let's
test it out as you can see the elements when they move it they grow a little bit smaller
and they grow when they get in the screen apparently the chicken is not changing when I
move it all over here so I'm going to add another keyframe to the chicken over here so at the end
I want the chicken to grow back to 0.2 and then change the opacity to 40 percent let's test it out
and now see now the chicken appears on screen it grows in and all of these elements are doing the
same pretty pretty cool and all of this is being controlled by the drivers not by the timeline
but by the drivers because I have a scrollable element and now the drivers are controlling all
the keyframes that I added depending on the exposition of this draggable content of this
scrollable content okay so now just to finish this I'm going to add one action from here
and when I tap it it goes all the way to this and I'm going to do the same with this one
when I press go back I'm going to say that when it taps it goes back to here so let's test it out
and obviously I cannot tap until I'm at the end and I press it and it goes like that and
it creates that animation because some of the elements are called the same so if I were to
make this a little bit bigger for example and rotate it then it will do this sorry
go back and then creates that pretty cool stuff there you go and yeah that's it so now we were
able to use uh drivers and also uh the draggable contents uh when you create this uh a scrollable
content sorry a draggable content that is uh controlled by page uh horizontal scrolling
then you will be able to start adding uh drivers to be able to control all the other elements
depending on the exposition of that dragging obviously you can go a little bit crazier if
you for example if I were to add a vertical draggable like for page or scrolling uh to
this element then I will be able to let's just test it out so you can see where to table scroll
then you will be able to add more drivers to it depending on the on the y position of the element
but that's for you to uh to test it out and go crazy with the drivers and also with the page
