1 00:00:05,790 --> 00:00:12,930 Here even so now we have created our main body for almost screen pet. 2 00:00:13,190 --> 00:00:19,670 And now we will move to create some of its functionalities like blinking of eyes in this video and then 3 00:00:19,670 --> 00:00:21,530 rest in the next videos. 4 00:00:21,530 --> 00:00:30,050 So in this video we will cover blinking of eyes and if we have a proper look and it we focus on the 5 00:00:30,050 --> 00:00:30,950 walking. 6 00:00:31,010 --> 00:00:36,930 Then you will notice that here when this one is blinking his eyes actually what is happening there. 7 00:00:36,980 --> 00:00:41,840 The pupils they are at present in normal state. 8 00:00:41,840 --> 00:00:48,440 They get hidden and the bedroom color that is right in the eyes becomes equal to body color. 9 00:00:49,340 --> 00:00:50,960 So that's what actually happening here. 10 00:00:51,140 --> 00:00:55,050 And this one seems like blinking of eyes. 11 00:00:55,050 --> 00:00:59,630 So let me show that how that is working with a function here. 12 00:00:59,690 --> 00:01:02,660 Then you will understand this one better. 13 00:01:02,710 --> 00:01:09,320 So here if you notice on this one we have tuple there we have this the eyes and tuples. 14 00:01:09,470 --> 00:01:15,930 What we will do will change the colors so let's begin with that one. 15 00:01:16,030 --> 00:01:21,930 First of all I will define a function to the realize to Dougal underscored eyes. 16 00:01:24,280 --> 00:01:26,210 And what will happen in this function. 17 00:01:26,260 --> 00:01:35,500 I will first take the collateral file that is at present so current underscored color and how I get 18 00:01:35,500 --> 00:01:36,280 the color. 19 00:01:36,370 --> 00:01:37,150 That is very simple. 20 00:01:37,150 --> 00:01:43,450 I will use items to get better so see what items we get. 21 00:01:44,230 --> 00:01:50,500 So by using this method you can get any of these things that you require from your canvas. 22 00:01:50,500 --> 00:01:52,040 So what I want there. 23 00:01:53,290 --> 00:01:58,900 Take any of the idea like left or right time taking left one because both have the same color. 24 00:01:59,490 --> 00:02:10,410 It's filled so there we have on the I feel so I am just taking value of this field and after that one 25 00:02:10,920 --> 00:02:13,550 I will define a new color. 26 00:02:14,880 --> 00:02:18,930 And that will be equal to the opposite of the color that is at present. 27 00:02:18,930 --> 00:02:24,740 Like if the eye is closed then at present day color is the body color. 28 00:02:24,750 --> 00:02:27,540 Otherwise the killer is white. 29 00:02:27,540 --> 00:02:32,130 So new color is equal to see the body underscored color. 30 00:02:32,790 --> 00:02:36,440 If my current color. 31 00:02:37,470 --> 00:02:46,380 Equal to white I hope you get this one that my new color will became body color that is blue. 32 00:02:46,380 --> 00:02:54,300 Only if my current color is equal to white otherwise became white. 33 00:02:54,480 --> 00:02:58,380 So a little hard to understand but very easy. 34 00:02:58,470 --> 00:03:04,230 Let me show you what I mean like if this is right now white then became bald eagle. 35 00:03:05,220 --> 00:03:12,930 And if it is not white it is body color then just became white I hope you get this for now. 36 00:03:12,990 --> 00:03:16,940 Again the new color variable will be equal to body color. 37 00:03:17,330 --> 00:03:21,590 If my present color that is at that instant is white. 38 00:03:22,040 --> 00:03:25,060 Otherwise if it is blue it will become white. 39 00:03:25,100 --> 00:03:27,840 So I have just added this hole in the line. 40 00:03:27,890 --> 00:03:29,890 That's why it's a little hard to understand here. 41 00:03:31,080 --> 00:03:37,430 After this one I will focus on pupils just like here I have taken the new color there. 42 00:03:37,620 --> 00:03:43,890 I will take a new state because he already I have the blue color on the computer I know you don't want 43 00:03:43,890 --> 00:03:49,510 to change the color of pupil from black to like blue I will just change it straight from normal to be 44 00:03:49,510 --> 00:03:57,920 done so that it will not be visible and this eye color will make like this is a closed. 45 00:03:57,960 --> 00:04:06,680 So if we also focus on of a screen let anyone notice the event is either closing pupils are actually 46 00:04:06,680 --> 00:04:11,150 hiding and the complete eye color become like body color. 47 00:04:11,600 --> 00:04:13,010 So that's what we are going to do here. 48 00:04:14,180 --> 00:04:18,700 I will take a valuable current underscore state. 49 00:04:18,790 --> 00:04:19,330 There we go. 50 00:04:20,060 --> 00:04:28,580 And this will be able to see what items get and there we have the pupil right and left there to Bill. 51 00:04:29,710 --> 00:04:33,910 Actually that pupil here watching them to pupil. 52 00:04:33,910 --> 00:04:38,550 Now we also don't mention here this state because that is by default normal one. 53 00:04:38,890 --> 00:04:41,000 So don't panic about that then. 54 00:04:41,260 --> 00:04:43,610 Now here pass any of these. 55 00:04:43,620 --> 00:04:55,790 People say you believed in what we knew there state maybe your and then new state will be equal to normal 56 00:04:58,070 --> 00:05:05,000 if my original state at present that is current state equal to hidden. 57 00:05:05,040 --> 00:05:11,070 Otherwise if it is normal right now then hidden. 58 00:05:11,140 --> 00:05:18,380 So again a conditional variable using if condition so that's how you can take variables that have two 59 00:05:18,380 --> 00:05:21,770 different values depending on the situation. 60 00:05:21,800 --> 00:05:24,520 So I hope you get these two after that one. 61 00:05:24,530 --> 00:05:25,580 What will I do. 62 00:05:25,610 --> 00:05:28,970 I will just configured the items to new state. 63 00:05:29,180 --> 00:05:30,100 All of these. 64 00:05:30,770 --> 00:05:32,590 So see Dot item configure. 65 00:05:34,480 --> 00:05:35,250 They will. 66 00:05:35,570 --> 00:05:42,200 And first of all I will take the pill left and right adjusted new state 67 00:05:46,000 --> 00:05:46,920 news. 68 00:05:47,030 --> 00:05:48,040 You go. 69 00:05:48,670 --> 00:05:54,160 Then just copy this whole base this one here. 70 00:05:54,160 --> 00:05:55,040 Change the bill bill. 71 00:05:55,050 --> 00:06:16,890 Right there we go again I left and new color copied this one based this on here and I right now this 72 00:06:16,890 --> 00:06:26,120 condition will make the eye closed ones like it will take the eye color which is at present 73 00:06:29,270 --> 00:06:34,930 white so it will just make this one like body color And these hidden for once. 74 00:06:34,970 --> 00:06:41,560 Now few students are thinking what if this one take color white and current state hidden right now. 75 00:06:41,800 --> 00:06:47,600 Then it will be like blue eye and black dots there but that's not what it's civil because we're starting 76 00:06:47,630 --> 00:06:49,670 our initial stages. 77 00:06:49,670 --> 00:06:57,290 Normal pupils here and white eyes so it we just take white color and then the new global equal to both 78 00:06:57,290 --> 00:07:01,420 regular and new state will equal to hidden because at present their normal. 79 00:07:02,240 --> 00:07:04,700 But this one is called only once. 80 00:07:04,820 --> 00:07:06,260 So what will I do here now. 81 00:07:08,340 --> 00:07:10,950 I will define another function blink 82 00:07:14,230 --> 00:07:15,550 and what will happen in that one. 83 00:07:15,910 --> 00:07:20,630 I will call the toggle function that is toggle the school eyes. 84 00:07:20,630 --> 00:07:30,440 There we go and I will just again call this one windowed after said 250 milliseconds 85 00:07:33,070 --> 00:07:35,750 so that it will again again goes on. 86 00:07:36,340 --> 00:07:37,850 And then again after 87 00:07:40,420 --> 00:07:47,830 say 3000 milliseconds I will make recursion here by calling this function again. 88 00:07:48,490 --> 00:07:56,870 So I would just call here blink so I hope you get this one by to make this function call again and again 89 00:07:57,280 --> 00:07:59,480 by a specific period of time. 90 00:07:59,930 --> 00:08:04,950 In this way we will get a blink Videla get. 91 00:08:04,990 --> 00:08:07,870 So this is about making this one. 92 00:08:08,590 --> 00:08:12,250 And we are done with blinking the eyes in the next video. 93 00:08:12,250 --> 00:08:13,840 We will focus on the time. 94 00:08:14,770 --> 00:08:15,700 So thanks for watching. 95 00:08:16,100 --> 00:08:17,320 And I will see in the next video.