The full pattern
The gerund never changes. Avendo or essendo + participle for an earlier action.
| cause | Essendo stanco, … = siccome ero stanco |
| time | Uscendo dall’ufficio, … = mentre uscivo |
| condition | Prendendo il treno, … = se prendi il treno |
| concession | Pur sapendolo, … = anche se lo sapeva |
| own subject | Essendo tardi · Piovendo · Essendo il museo chiuso |
| past | avendo mangiato · essendo arrivata |
| pronouns | vedendolo · avendoglielo detto · essendosene andato |
No subject of its own? Then the gerund belongs to the main subject: mentre uscivo di casa, il telefono ha squillato.
With lo, la, li, le the participle agrees: avendola vista.
Anche se and nonostante need a full verb; pur takes the gerund.