So as you can see here these are the lines of code that I pasted here.
So now as you can see we have a method here and now I'm going to actually explain to you what's going
on here.
Exactly.
So the access modifier of this method is private and as you can see here the return type of the Smurfette
is void.
And this means that this method is going to return nothing.
The name of the Smurfit is animate animal quiz.
Right.
So the purpose of this method is to actually create an animation when the user is actually guessing
the name of our animal.
So for example here if you have a peacock and he asked just need to select a picture here as you can
see it's kind of eight.
And then he's going to actually perform an animation here.
So here for example we have a dolphin.
It's kind of eight.
And then he's going to perform an animation.
So now let me actually change the background color of our Quiz linearly out so choose by going on color
and choose for example black.
And then we can back as you can see here we have actually our rabbit.
So just choose rabbit and then it's going to perform an animation as you can see here.
So let's look at our Mefford animal animate animal quiz.
And this method actually accepts an argument of type Boolean.
The name of this argument is animate out animal image.
So this means that whenever For example the user is actually let me show you the emulator.
So for example the user is actually guessing the name of the animal.
So here you have actually a horse.
So now horse and then it's going to actually animate this image animate out.
Right.
So here we have a flappy bird and then it's going to animate out here as you can see the animate out
occurred here.
So now I actually created this boolean variable here so when will we actually passed the value true
to this method is going to animate out these are image.
So here we have a chat and now it's going to animate out this animal image.
So it's going to animate out if we actually pass the value true to this method.
So otherwise if you actually pass the value falls to the Somerford it's not going to animate out that
image.
For example here we have fish.
Now it's going to animate out this fish image.
And now as you can see we have another animation that actually is performed here in order to show the
next animal.
So here we have a peacock and now is going to animate out this Picart and then it's going to actually
perform another animation to show the next animal which is now Pinguin.
So now let me show you what's going on here exactly.
And then it will make sense.
So here let's look at this statement here.
As you can see we have an if statement.
So what is this if statement to hear this statement here is saying if number of right answers is equal
to zero.
So what does this mean.
This means that for example as you can see let me change the background color of arccos application
for example to blue.
And now click on back as you can see here we have our quiz here right.
This is animal one of 10.
It says this is animal one of.
And now this means that this is for for the first time that the quiz is started.
And here this statement here is going to actually prevent the animation to occur here.
So when are actually of iniquity as we said or when our application is actually started then I don't
want an animation to occur here.
I just want to show the first image to the user.
So that's why I created these statements.
If number of right answers is equal to zero and this means that if this is the first image that we are
showing to the user then I don't want to add any mission to a card here.
So I just want to return from the Smurfette and then it's not going to execute the lines of code after
this if statement.
Right.
Because we put the return statement here.
Right.
And now so for example of we have actually just the first image.
And this is ours.
Just for example this is thought if you and I just need to click on Dolfin here and now it's going to
show us the next image.
So now as you can see because you are actually actually in the second image.
This is our animal too often.
Now let's look at our lines of code here.
So first of all line number two hundred and sixty seven we created a variable of type integer.
The name of this valuable is its top left right.
So what we mean by it is it's top left East uplift is here.
Exactly here right.
Eaks top left.
And I assigned the value 0 and here in line number two hundred and sixty eight.
We have another variable and the name of this variable is white top left.
And again as you can see here the white uplift is here and I assign the value 0 to this variable.
And now as you can see in line number 271 I created another variable which is an integer and the name
is X bottom right.
So expanding right is going to be here.
As you can see by them right and in line number two hundred and seventy two we have another variable
and its name is void by them right.
So divide by them right is going to be here.
So let's look at our variable here.
X bottom right.
And let's see.
What is the value that be assigned to this variable.
Animal quiz linearly out.
So here I'm referring to this linearly out animalcules linearly out DOT gets left.
So it's going to actually get the left of this animal who is linear left and then it's going to actually
add the value of this get left to the animal quickly nearly out that gets right.
So it can actually add the body of this get left to the value of this gets right.
So it's going to actually give us this expanded right here.
Right.
So that's the value of this ex-spy them right.
And then we have this white bottom right.
So animalcules linearly out that top.
So he's going to try to give us this increase linearly at the top and then plus animal squeeze linearly
out that get them.
And as you can see here it's going to be at the value of the top two to get them.
And then it's going I should give us this very bottom them right here.
Right.
So now as you can see here I created a comment and it says here is the max value for radius.
So here because we are going to have a circular animation as you can see if I click on this chat here.
Now it's kind of 8 and then it's going to perform a circular animation right.
So we need to have the value of the radius.
This is really important in radius assignment operator math.
So we have a class a predefined class in Java called Math and we can actually use this class and then
we can actually use the predefined methods in say that math class to our advantage.
So math that Max this method is going to actually give us the maximum value between the two values that
we pass through this method.
So for example math that Max the first Argive the first argument that I passed through this method is
animalcules linearly out that gets Viets.
So it's going I should get the Viets of this animalcules linearly out.
And the second argument is animalcules linearly out that gets hight.
So the height is here right.
This is the height.
So now it's going to decide if it is going to look at these two arguments and then it's going to actually
choose one of them which is actually the maximum value.
Right.
And then it's going to choose that value as the radius and then it's going to assign that value to the
radius the maximum value of these two values here animal Quizon anything else that gets fit or animalcules
linearly out of that get height the maximum value is going to be assigned to this radius variable which
is after integer number two hundred seventy seven as you can see.
I created variable which is of type animator which is required if you're going to actually perform an
animation and the name of this variable is animator.
Right.
So now let's look at this if statement so here you have an if statement if I animate out animal image.
So here I am referring to this argument animates out and in one image.
If you actually if the value of this animated out animal image which is actually an argument of the
Smurfit if the value of this argument is actually true.
Right.
If the value of this animate our animal image is true then it's going to actually execute the lines
of code inside the curly braces.
So that's the meaning of this expression here.
If animate our animal image is true then it's going to go inside the curly braces here and then it's
going to secure the lines of code here.
So if the past the value true to the Smurfette then it's going to be a cute if statement.
So in line number two hundred and eighty one I referred to the name of this animator here as you can
see animator assignment operator view animation teals that create circular revealed.
So here we want to actually create a circular animation right.
The animation you tell us that creates circular reveal.
So for the first argument as you can see we need to pass the linearly out anyone quizz linearly.
So this is our animal with linear lay out and for the second argument as you can see here we want to
actually specify the two values for the x and y.
So for example here if we actually want to create and animate our animation if for example the user
is actually kissing the animal name here for example we have a bird here.
Right.
So now I was going to perform an animated animation.
Did you see that it actually went through to the ekes by them right and vibra them right here.
Right.
So here horse and now it's going to go straight through these ex-spy them right.
And you buy them right.
So that's the meaning here.
That's the meaning of these two arguments here.
So now let me actually referred to the name of this animation Steeles here that create circular reveal.
And now I'm going to actually show you these arguments.
The first one is the view.
So the view is animal linearly right.
The first one is the view as you can see here.
The second one as you can see here is centered eaks right disinterred eaks is going to expire them right.
And the second one is center Y which is going to be Viburnum right because you want the animation to
go up from actually here to here right.
So bottom line to why you buy them right.
As you can see here.
So center centerpiece is actually ex-spy them right and center Y is why you buy them right.
And then we need to specify the radius as you can see here.
So the radius is this value that we actually specify here.
And now let me show you the other arguments as you can see here for the int argument for the last argument
we need to specify the end radius.
So the radius is going to be zero.
OK.
The starting radius is disvalue as you can see here.
That actually is one of these values gets beat or gets height and the radius is going to be zero.
So I want to start from somewhere inside my linear layout get height or get it and then I move on to
actually the way I want the radius to end.
So the value for the radius is going to be zero and then it can actually perform this animation.
And then it's going to create this animation effect.
And now if I try to choose flappy bird here as you can see it can actually create this animation effect
here by assigning the value zero for the radius.
So hopefully that makes sense and Elizabeth me actually did this line of code here.
So now when the animation is actually finished.
So for example we have here a ship right now is going to perform and animate out here as you can see
the animation is finished.
You want to show the next image right.
So animator that adolescent or so are you want to be notified when the animation is finished finished
right.
Or you want to be notified when the animator animate out is actually finished when this image is actually
gone.
And then I want to show the next image right.
So animated that at listener new animator that animated a listener.
Right.
So then it's going to actually overwrite these methods.
So as you can see here again because you are actually creating a listener for this animator in order
to be notified that when the image is gone.
Here as you can see we need to actually create an anonymous inner class and that anonymous class is
actually conforming to this animator listener.
And now if I actually hold the comment here on my keyboard.
So if you are using a Windows machine use.
Just hold the control key on your keyboard and then click on this animator listener as you can see this
animator listen it is actually an interface right that tent that holds these methods on animation starts.
So this actually is called when the animation is actually started on animation.
And so it is if it is going to be called when the animation is actually evident on animation can and
decide if it is going to be called then the animation is Transworld on animation repeat and does this
if it is going to be called of and the repetition of the animation is actually a character.
So let me close this file here as you can see.
So that anonymous class here as you can see is actually conforming to this animator listener interface
and it can actually pro-white these methods here is going to overwrite these methods on animation.
Start on animation and on animation chancel and on animation repeat.
But we don't want to actually do anything to do with these methods on animation start or and on animation
chancel or on animation repeat we just these methods just need to be here.
We don't want to provide an implementation for those.
Its the only method that we want to just work with is this Mfat on animation and then the animation
is ended.
Or you want to show the next image.
So here I just need to click on this for example code and now is going to create an animated out effect
and then its going to show the next image.
So then the animation is ended when the animated out effect is that you want to show the next image.
So on animation and show an animal.
So we haven't still created this method yet just put this about you here should show an animal.
And then we will actually provide this method inside our class.
But for now just put it here and now as you can see if I scroll down as you can see we have an else
statement right.
We have this statement.
So this else statement here is vente the past the actually devalue falls for this animate our animal
image.
So as you can see here if you look at the Smurfette and more animate animal quis and this movement accepts
this argument animates our animal image.
If we pass the value true here is going to actually provide an animate out effect.
So for example here we have a penguin as you can see here.
It's going to provide an animal out in order to actually just make to make the current image to just
go.
And then the next image is going to be shown to the user right.
So if he has digital about you true if you just want to actually make the first make the current image
just go OK.
But now when we actually passed the value false to dismiss it if the value of this animate our animal
image is false then it is execute this statement.
And this means that when the next image is going to be shown to the user.
So for example here we have it and and then it's going to perform and animate out effect.
And then it can actually create another animation here in order to show the image to use it.
And as you can see here the next animation effect is actually started from here.
It's top left and right up left right.
The second animation is started from here.
So here we have a peacock.
So this is our next.
This is actually our final Alamance.
Let's actually set the quiz.
So here we have it bird as you can see and animate out is here and then it's going to actually perform
another animation from here.
It's top left and right up left.
So this statement here is going to be executed when the next animal image is going to be shown to the
user.
So animator.
So you referred to the name of this animator here assignment operator view animation tools that create
circular reveal.
And again we need to pass that view.
So animal animal is linearly out and then we need to pass the center X which is going to be X top lived.
We want the animation to start from here.
As you can see here and we need to pass the VEIDT uplift for their right to center Y which is here.
And now as you can see for the start radius I assigned the values zero right.
So it's going to actually start the animation from here right.
All told you that the X top left is here that we assign the values 0 light its top left zero.
This means that the E-Stop left this here.
And the very top left is also zero.
And this means that this animation is going to start from here and now as you can see for the radius
for this radius all you want the animation to start from here.
And then you want the animation to end to here as you can see here the bottom left to the bottom right.
Excuse me.
So that's why I actually put this radius here for the radius.
So for this thought radius I put the value zero but is going to start the animation from here.
And for the nth radius I actually put this radius here.
So it's going to actually end this animation here.
Let me actually just choose this.
I actually go here.
So it's going to just create and animate our effect.
And then it's going to just start the next animation from here and then it's going to end this animation
here.
So here we have an ant now and animate out.
And then as you can see the next animation is actually started from here.
And then it's going to end it here.
So hopefully that makes sense.
And finally this is very important animator that said duration seven hundred milliseconds.
So the animation is going to actually just last for 700 milliseconds.
So that's the duration of the animation.
Seven hundred milliseconds and a number seven hundred and seventeen.
We need we must actually call this method so that the animator is going to actually just perform that
animation animator that start and then it's going to perform this animation.
So for example sheep and now is going to create and animate out and then the next animation is going
to actually show the next image to the user.
So hopefully that makes sense.
And now you get the idea.
But now let me actually just create the Smurfette here on this animal and then this stuff that I talked
about about these animations will make more sense.
So just lets just actually creates this method here inside of us our class show next animal.