Why did he (kind of) started ignoring me?

There's this guy and he started texting me two months ago. We got along very well over text, but few days ago, I talked to him in real life for longer than 30 minutes. I'm very confident by nature, well-liked and i think my looks are okay (few men told me that i was beautiful and I'm taking them for their word, i used to be quite 'ugly' as a child so i was never used to this kind of treatment). Anyways, the guy is replying slower and slower, week ago he was making sexual jokes (i was not bothered by it and i played along, because why not). He may be very stressed at the moment because of exams and stuff but i did EVERYTHING to be supportive of him (gave him notes, explained a bunch of stuff). I really don't get why he's giving me this kind of treatment, and i don't want to lose a friend. I'm quite popular but i never had a close friend or someone that would even bother to reach out to me. I'd also be okay with dating him eventually (even though I'm struggling with bipolar and self harm). I was trying to get better for him but now it literally hurts everytime i see that he hadn't texted me. I never told him how much i struggle in my day to day life because i didn't want to bother him. I don't know why this is happening, he always gave me compliments on my personality and was genuinely the first person that seemed like they cared. I really need a second opinion, i don't think I'm capable of thinking rationally at this moment.

Why did he (kind of) started ignoring me?
Post Opinion