What does it mean when he teases you in a mean way?

So I have this guy friend who gets along with me very well. He can be a very shy person but he's very open and friendly around me. He is a very sweet guy however, lately he's been teasing me and sometimes even in a mean way. Here are some situations where it's happened:

-he will walk past and glares at me

-if I say something jokingly to another friend like "I will sometimes act dumb if I want to avoid something or someone" then he will look at me and say "act dumb?" and then I will give him that wide mouthed surprised look that means excuse me and he will put on that I'm only joking face, blush and rub my back saying just joking

-once I said to him "You're going to be a loner for your lunch break?" and he turns and says "your face is a loner." I gave him a surprised hurtful look and he turns red, has an apologetic look on his face and says "I'm just kidding." Then he will come find me later and try to make conversation with me

-there was this one time he was being mean to me and when I asked him why he was so mean to me, he told me that he was mean to me because he likes me. I don't know if he was serious or not as I was walking away from him when he told that to me

These are a few examples. I just don't understand why he used to be really sweet and then just recently he is so mean to me. Before when he was really nice to me, I kinda had a slight crush on him, even though he could be gay (I'm not positive if he is because he's never straight out told anyone that he is.) But now that he's being mean to me lately, I don't know what to make of his actions and I'm not sure how I feel about him anymore because what he did made me feel hurt. What does his behavior mean?

What does it mean when he teases you in a mean way?
Post Opinion