In Shakespeare's Hamlet, during the "play within the play" (the production Hamlet calls Mousetrap—an allusion to his plan to prove Claudius' guilt by re-enacting Old Hamlet's murder), Hamlet is very much like the cat preparing to pounce on his mouse. He is very excited.
Hamlet torments Ophelia—as if punishing her for her loyalty to father and the King rather than to him—by making ribald and vulgar comments to the woman he once professed to love. What he says also displays the attributes of a rambling madman, thereby continuing his guise of insanity. He has already told his friends that he planned to...
To put an antic disposition on... (I.v.172)
His behavior is in keeping with his plan to throw Claudius off-guard so that Hamlet might find evidence to prove that the Ghost is an "honest" one—telling the truth—rather than a specter of evil, attempting to trick Hamlet into sacrificing his eternal soul by committing the sin of murdering a king—for regicide was viewed as such.
Beneath the façade that Hamlet displays for the world to see, is his certainty that he will find proof that validates his right to avenge his father's death, as requested by the Ghost. In Act Two, he made his intent fairly clear when he announced that he would use the play to his own benefit:
I'll have grounds
More relative than this—the play's the thing
Wherein I'll catch the conscience of the King. (II.ii.603-605)
By the time the play is ready to begin, Hamlet has elicited Horatio's assistance, asking that he also watch for Claudius' reaction toward the actors on stage.
Observe my uncle...
Give him heedful note;
For I mine eyes will rivet to his face... (III.ii.76, 80-81)
We can infer that Hamlet is overly eager: if Claudius does not react, Hamlet will know the Ghost to be an evil spirit. If Claudius does react, Hamlet will have his proof of the King's guilt of murdering Old Hamlet. As the players act out the poisoning of Gonzago (the king in the play), Polonius notes that the King has stood up. This would be a signal for the play to stop and all those present to rise also. Hamlet's glee almost climbs off the page into the audience's lap; he crows:
What, frighted with false fire? (255)
Hamlet's point is that if it were just a play, bearing no semblance to reality, the King would not have reacted at all. Hamlet now has proof of Claudius' guilt: he points it out to Horatio—
O good Horatio, I'll take the ghost's word for a
Didst perceive? (275-277)
In other words, the Ghost spoke the truth. Horatio agrees that Claudius' guilt was indeed obvious. Hamlet cannot help now but feel vindicated by Claudius' reaction. This would also provide Hamlet with a sense of intense relief for all the time he has not been certain and for all the secrecy and subterfuge that have shadowed every word he has spoken and each action he has taken since the Ghost first appeared to him. He can now plan vengeance upon Claudius, which he will soon attempt to carry out, as well as taking his mother to task for her behavior with this villain she has married.