〜たとたん(に)
The moment…, immediatelymachine translation
FormationVerb た-form + とたん(に)
〜たとたん(に) expresses "the instant A happened, B happened immediately": 窓を開けたとたん、冷たい風が入ってきた (the moment I opened the window, cold air rushed right in). Written in kanji it is 途端. The gap between A and B is nearly zero, and B is usually something the speaker didn't expect.
Because it describes something witnessed, this pattern is used only for past events, and clause B must be something that happened outside the speaker's control — it is not used for the speaker's own intentional actions. To say "as soon as A is done I'll do B" as a plan, use 〜次第.
You learned the conditional 〜と at N4 meaning "whenever… then" — 〜と leans toward repeated rules or natural consequences, while たとたん recounts one specific occasion with a feeling of suddenness. Also don't confuse it with the discovery 〜たら (開けたら、猫がいた): たら just says "I opened it and found," while たとたん stresses that the event erupted at that very moment.
Examples
窓を開けたとたん、冷たい風が入ってきた。
The moment I opened the window, cold air rushed right in.
立ち上がったとたんに、頭が痛くなりました。
The moment I stood up, my head started hurting.
その知らせを聞いたとたん、彼女は泣き出した。
The moment she heard the news, she burst into tears.