I spent a sleepless night, recently, thinking about the cat in The Diary of Anne Frank.

In one of the best suspense sequences in the movies, Otto Frank (Joseph Schildkraut) comes downstairs from the attic where the Franks are hiding. There is a burglar in the house and Frank has to dispatch him. The burglar goes away, but before Frank can close the door, a night watchman notices it ajar, and calls over a couple of patrolling Nazis.

Frank retreats to the attic and all wait breathlessly, while the Nazis scout the house below. Now comes the cat. She pads along a kitchen ledge in the hidden attic, she puts her head into a funnel resting on the ledge, she pushes the funnel toward the edge. Now everyone in the world holds his or her breath. Now the funnel goes over the ledge. But wait, the cat's head is still stuck in the funnel.

Should the funnel drop off, the Nazis will hear, and discover the hidden attic and kill all the inhabitants. But continue to wait - the cat now pulls its head, the funnel still on it, back onto the ledge, and now draws its head off. What a great sequence. But how did they do it?

I surmise that they stuck some tuna fish inside the funnel, surrounded it with glue, and then turned the camera on. That would get the cat's head into the funnel, and stuck there, but how did they get it over the ledge?

Perhaps, I reason, monofilament line. One prop guy easing the funnel over the edge, another heaving gently on another line to get it back.

Good idea. But what do you do on the second take?

The cat ain't going to put her head back into another gluey funnel. (My knowledge of actual film-making is sufficient to consider that they left the cat glued to the funnel, and called it a day.)

But no, the cat actually got her head out of the funnel at the end of the shot. All right, what about magnets? Cat, with magnet hidden (or, indeed, implanted) in its neck, is lured to stick its head into a funnel smeared with tuna fish. Funnel contains radio-controlled electromagnet. Two prop guys hold monofilament lines, one to ootz cat and funnel over the ledge, second to ootz it back. Electromagnet is turned off, and grateful cat removes head from funnel. In this scenario, I would shoot the cat sequence first. That is, before "establishing" the cat.

Or: set up four or five ledges, four or five different cats. Whichever cat-and-team first got the shot in the can, that cat would be the Hero Cat, and play in the rest of the film. This version, of course, would require many, many cats standing by.

There are only two things wrong with my proposed electromagnetical solution: 1) it is too elaborate, and 2) the gag is so good, it feels like something dreamed up on the set. That is, here we are, filming the "Nazis almost find us" sequence, and someone, the director or assistant director, starts jumping up shouting "ooh ooh ooh", and comes up with the cat. And the funnel.

Maybe not, but in my experience, the prop people and the stunt people are smarter about the gags than the director. But in this case, the director was George Stevens. Now, George Stevens started out as assistant cameraman for Hal Roach, shooting Laurel and Hardy silents. These, to me, are the perfection of essential movie-making. Perfect simple plot, no distracting "jabber" (or "dialogue", as it is more generally known).

I will give the cat gag one more think, and then surrender. So, to the film-maker, the Occam's Razor approach is that "they probably shot it backwards". But, no, the cat can't be shot backwards, because he starts and ends with his head free of the funnel. (If the cat started the shot with his head in the funnel, and ended it free, one could simply film a cat free, who sticks his head in the funnel, and then run the film backwards.)

I start my reasoning again: there existed, in antiquity, a cat trained to stick her head in a funnel, inhale sufficiently to keep the funnel stuck onto the head ... oh, I give up.

So, I will telephone George Stevens Jr, and he will describe to me the simple, and, now, totally obvious method his father used. I will slap my forehead, and then share it with you. But, before I give you the answer, I will note some of my favourite effects.

In Only Angels Have Wings, Kid Dabb (Thomas Mitchell), aircraft mechanic to flyer Geoff Carter (Cary Grant), stands on the field as Carter lands in his monoplane. Dabb takes a cigarette from his pack, places it in his mouth. We see Carter's plane. Dabb takes a wooden match and holds it above his head. The plane comes closer to touchdown. Now the plane is about to touch down and the passage of its wing over Carter's upraised hand lights the match and Dabb lights his cigarette.

This is a conjunction of a gag (something done on the set), and an effect, something done in or using the talents of the lab. In this case there is a rear screen projection of the approaching plane, which dips just below frame at the last moment. A physical mockup of the wing then replaces it and passes over Mitchell's head to light the match.

Note also: Julia Roberts getting into her car in Erin Brockovich. The car pulls out into traffic and then is demolished by an oncoming vehicle. (This is an effect: Julia actually swaps her place with a stuntwoman early in the sequence, the two shots are melded in the lab, and the stuntwoman takes the hit.) Another magnificent effect is the running-upstairs shot in Contact (director Robert Zemeckis, cinematographer Don Burgess). Where the camera takes the little girl, pulls her down a corridor, up the steps, and towards a medicine cabinet holding the drugs that will save her father from his heart attack. She opens the cabinet to "reveal" the medicine cabinet. The camera, however, does not move. It is as if the entire shot were, somehow, a reflection in the medicine cabinet mirror. A stunning effect.

A brilliant gag is the murder of Moe Greene (Alex Rocco) in The Godfather. The unknown assassin kills Greene on a massage bench. Greene is getting a rub. He senses something amiss, and puts on his eyeglasses. The assassin fires, and Greene's glasses shatter as he is shot in the eye. How did they do that? Answer: his temples contained a minuscule BB apparatus and air gun. On cue, the BB was propelled forward, from the face, towards the lens.

I call George Stevens Jr and plead for an answer. He laughs. This shot, it seems, is already a part of film lore. Mr Stevens tells me (to my pride) that 1) there was a bunch of cats; and 2) his father, the director, "just turned on the cameras and shot an unbelievable amount of film, waiting for some cat to do something 'uncatlike'." What a wonderful business.