Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,030 --> 00:00:01,900
Body move in.
2
00:00:01,900 --> 00:00:06,280
Allowed us to export our animation as Jason.
3
00:00:06,280 --> 00:00:14,440
But react to Lodhi is a library on the other side that is going to allow us to render that Jason as
4
00:00:14,440 --> 00:00:22,930
an animation on our page all include a link to the react what documentation page here attached to this
5
00:00:22,930 --> 00:00:28,870
video where we're going to get started by going over the options that we have to configure our animation
6
00:00:31,120 --> 00:00:39,700
and as they say here this is a wrapper of body moving J.S. which allows you to render the Jace on the
7
00:00:39,700 --> 00:00:42,220
body move and has exported.
8
00:00:42,350 --> 00:00:49,520
It's really simple to use and all we'll have to do to get started is npm install the package so we'll
9
00:00:49,520 --> 00:00:57,680
go ahead and copy that right now and we can see how they set it up is just importing react Lodhi as
10
00:00:57,740 --> 00:01:02,660
a lady component and then importing the animation data as well.
11
00:01:03,920 --> 00:01:08,990
They import that from the Jason that was exported from body move in.
12
00:01:09,080 --> 00:01:16,030
So if you skipped the body move in videos all you need to know is we moved the data.
13
00:01:16,190 --> 00:01:23,870
Jason into a data J.S. file so that all of the images would be contained within the one file.
14
00:01:23,870 --> 00:01:29,570
Otherwise the Jason tries to reference them from another location and then just gets a little more convoluted
15
00:01:29,870 --> 00:01:36,740
so that's why in the project 1 files that you have downloaded all of the animation data are within their
16
00:01:36,740 --> 00:01:39,990
respective folders and then data dot J.S..
17
00:01:40,010 --> 00:01:45,470
So that is where we'll get our animation data from but we'll still be using it in the exact same way
18
00:01:45,470 --> 00:01:54,400
as they have here in this example where they pass it as animation data to a default options object this
19
00:01:54,400 --> 00:02:03,040
default options object is basically what makes React quality work and is where you have some customization
20
00:02:03,100 --> 00:02:05,300
for how your animation will work.
21
00:02:06,170 --> 00:02:14,240
You can see down here the props that you can pass to Lodhi as our options which are the loop auto play
22
00:02:14,420 --> 00:02:22,320
animation data and renderer settings the renderer settings will always really just use this preserve
23
00:02:22,350 --> 00:02:29,970
aspect ratio of X mid why mid slice which for all the animations I've worked with has rendered them
24
00:02:29,970 --> 00:02:38,160
perfectly and then the animation data you pass in the animation data that you've imported and then the
25
00:02:38,190 --> 00:02:45,390
last two are optional you can make sure that the animation will loop and it defaults to false so we
26
00:02:45,390 --> 00:02:51,840
will be setting that as well as the auto play property which will also need to set to TRUE because it
27
00:02:51,840 --> 00:02:54,390
defaults to false as well.
28
00:02:54,540 --> 00:03:00,270
We want to make sure that as soon as our page loads the animations are playing without the user having
29
00:03:00,270 --> 00:03:02,670
to press a button or interact with them at all.
30
00:03:02,700 --> 00:03:10,440
So you just have to set up that options object and then you pass that object to the options property
31
00:03:10,680 --> 00:03:14,460
on the Lordy component that we import from react.
32
00:03:14,520 --> 00:03:19,490
Lady then you need to specify a height and a width.
33
00:03:19,540 --> 00:03:28,690
And here you see how they have used the is stopped and is paused properties for programmatic time control.
34
00:03:28,830 --> 00:03:35,040
We won't be needing to do this because our animations are not interactive and we're just going to be
35
00:03:35,040 --> 00:03:36,440
letting them play.
36
00:03:36,810 --> 00:03:41,280
So that really is all we need to get our animation into our application.
37
00:03:41,280 --> 00:03:46,650
We'll just import react lady pass in r animation data to the default options.
38
00:03:46,700 --> 00:03:52,740
Passive default options to the audio component and we should have an animation on the screen so let's
39
00:03:52,740 --> 00:03:58,410
go ahead and we'll start by bringing up the terminal or your command line and if you're a development
40
00:03:58,410 --> 00:04:04,290
server is running go ahead and stop that real quick and let's paste in that command that we'd copied
41
00:04:04,710 --> 00:04:12,600
the npm install dash to save react dash lady and let's go ahead and run this to install the library
42
00:04:13,720 --> 00:04:14,100
all right.
43
00:04:14,120 --> 00:04:20,270
And I've got that installed currently at version 1 point two point three.
44
00:04:20,310 --> 00:04:27,580
You can go ahead and start your development server backup and now that that's loaded we are ready to
45
00:04:27,580 --> 00:04:28,400
go.
46
00:04:28,420 --> 00:04:31,870
So I'm gonna go ahead and shrink this down.
47
00:04:31,880 --> 00:04:35,290
Right about there and bring up the code.
48
00:04:35,290 --> 00:04:44,650
ED So we finally now want to actually add content to our home screen but all we have right now in the
49
00:04:44,650 --> 00:04:49,290
app dot J.S. is our dummy component with our height.
50
00:04:49,330 --> 00:04:56,810
So we need to replace this with an actual react component let's come over to our components folder and
51
00:04:56,810 --> 00:05:01,510
create a new file that we're going to name a landing page.
52
00:05:01,550 --> 00:05:12,100
J.S. let's import react from react and import Lodhi from react.
53
00:05:12,230 --> 00:05:24,080
Lady next let's create a new line and we'll import our animation data from up one directory animations
54
00:05:24,410 --> 00:05:33,200
and then landing animation and inside that folder are data dot J.S. let's come back to the top for a
55
00:05:33,200 --> 00:05:40,070
second and we'll import our Make styles from app material.
56
00:05:40,150 --> 00:05:46,640
She UI soft core slash styles just so we can make sure we have everything set up and ready to go.
57
00:05:46,670 --> 00:05:56,540
So we'll keep coming down and create are constant of use styles set to our Make styles function and
58
00:05:56,540 --> 00:06:02,620
we'll get access to a theme make our arrow function and make sure to get the parentheses.
59
00:06:02,630 --> 00:06:08,830
And then our brackets will open this up for our style object but we'll just leave it blank for now.
60
00:06:08,840 --> 00:06:19,220
So keep coming down and we'll finally export default function landing page and then we'll open that
61
00:06:19,220 --> 00:06:30,300
up create are constant of classes equal to our use styles hook and we'll also create our Conte's default
62
00:06:30,630 --> 00:06:38,790
options and we can go back to the documentation and let's just go ahead and copy that whole object actually
63
00:06:39,150 --> 00:06:41,550
and we'll paste that right in here.
64
00:06:41,550 --> 00:06:47,130
And since we use the same name it's already grabbing our animation data that we have imported and we
65
00:06:47,130 --> 00:06:53,190
actually do want true on loop we want true for auto play and we're going to leave the renderer settings
66
00:06:53,280 --> 00:07:00,990
as well so we literally can just copy over the default options from the documentation of React wadi.
67
00:07:01,080 --> 00:07:01,500
All right.
68
00:07:01,500 --> 00:07:11,280
And finally to see our animation live for the first time let's go ahead and we will return a Lodhi component
69
00:07:11,580 --> 00:07:17,450
with its options set to the default options that we just created.
70
00:07:17,700 --> 00:07:26,070
And then we're going to add a height of Make sure you get the brackets 100 percent 100 percent and you'll
71
00:07:26,070 --> 00:07:32,800
get the quotes in there as well and they width equal to 100 percent as well.
72
00:07:32,850 --> 00:07:38,520
And that's because I just want these animations to take up all of the screen space available to them.
73
00:07:38,550 --> 00:07:45,090
But as you can see in the documentation you can also specify a fixed pixel value as well.
74
00:07:46,110 --> 00:07:49,280
Let's go ahead and close up that lady component.
75
00:07:49,350 --> 00:07:56,250
And now we can go ahead and let's flip back to our development page going shrink this down and let's
76
00:07:56,250 --> 00:08:00,650
go ahead and save this real quick and you will see anything happen.
77
00:08:00,660 --> 00:08:05,130
And that's because we actually still haven't done anything to get rid of the dummy component.
78
00:08:05,160 --> 00:08:12,510
So now let's go over to our app dodgy s file and underneath our footer import let's import the landing
79
00:08:12,510 --> 00:08:22,370
page from components landing page and now it will come down to where the component property is for r
80
00:08:22,500 --> 00:08:25,610
slash path the home route.
81
00:08:25,680 --> 00:08:31,920
Let's go ahead and inside of those brackets get rid of that arrow function that dummy component and
82
00:08:31,920 --> 00:08:35,160
let's pass in the landing page component.
83
00:08:35,160 --> 00:08:43,350
We just created and if we go ahead save this now the page will actually refresh and you can see a very
84
00:08:43,350 --> 00:08:46,820
large version of my landing animation.
85
00:08:46,920 --> 00:08:48,750
So that looks really good.
86
00:08:49,030 --> 00:08:52,440
I'll go ahead and if you just click on it you can actually pause that.
87
00:08:52,470 --> 00:08:54,060
So that's a nice little trick.
88
00:08:54,330 --> 00:09:01,680
But you can see just how easy it was to get reactive body set up in and put an animation on the page.
89
00:09:02,190 --> 00:09:06,040
So let's go ahead and inspect this real quick just to take a look.
90
00:09:06,060 --> 00:09:12,160
Because I think it's kind of cool and you can see that this is actually rendering it as an SVP.
91
00:09:12,240 --> 00:09:21,610
So this is properly rendering that Jason to an SPG which as we've gone over is our superstar file format.
92
00:09:21,630 --> 00:09:27,960
So it's awesome that we can get our animations so easily in that same format that we had wanted for
93
00:09:27,960 --> 00:09:29,570
all the rest of our images.
94
00:09:29,640 --> 00:09:35,220
And I think that that really helps with the overall optimization of our site.
95
00:09:35,220 --> 00:09:40,080
Now we definitely don't want this giant huge animation here.
96
00:09:40,080 --> 00:09:42,130
And real quick I just remembered.
97
00:09:42,240 --> 00:09:48,690
If you see this little warning down here it's actually saying that the component will update function
98
00:09:48,720 --> 00:09:54,440
that the lady component is using is actually going to be outdated soon.
99
00:09:54,660 --> 00:10:02,070
So the react velocity package needs to be updated to include the newer lifecycle methods and by the
100
00:10:02,070 --> 00:10:04,350
time you're watching this maybe that has happened.
101
00:10:04,350 --> 00:10:10,410
And so you might not even see that but until then don't worry about it it won't cause any problems for
102
00:10:10,410 --> 00:10:10,700
now.
103
00:10:10,860 --> 00:10:17,610
But let's go ahead and we'll fix up this animation and get the rest of the text for the hero block built
104
00:10:17,850 --> 00:10:19,620
all in the next video.
12046
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.