When you cast a spell that says 'target,' you choose all targets as part of the process of casting that spell, before it ever goes on the stack as a fully cast spell. This is governed by CR 601.2c, which states that targets are chosen during the casting of a spell, after the mode is chosen but before costs are paid.
Animate Dead is an Aura enchantment with the ability to enchant a creature card in a graveyard. As an Aura spell on the stack, it targets the creature card in a graveyard at the time of casting (CR 601.2c, 702.2c). The target is locked in at that moment and must be legal both when chosen and when the spell resolves (CR 608.2b).
This matters practically: if the targeted creature card is removed from the graveyard (e.g., exiled by a Tormod's Crypt activation) after Animate Dead is cast but before it resolves, the spell has an illegal target and will be countered on resolution by CR 608.2b, returning Animate Dead to its owner's graveyard with no effect.
Concrete example: You cast Animate Dead targeting a Griselbrand in your graveyard. Your opponent responds by activating Relic of Progenitus, exiling that graveyard. When Animate Dead tries to resolve, Griselbrand is no longer in a graveyard, the target is illegal, and Animate Dead is countered — Griselbrand stays wherever it went.
So remember: targeting happens at cast time (CR 601.2c), but legality is also checked again at resolution (CR 608.2b). Both windows matter.
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.