Animate pseudoelement with js

I want to animate pseudoelement with js but I have a problem. I try to use querySelector like this

const element = doument.querySelector(".hello::before")

but all the this console return me null. How can I use pseudoelement in JS?