Transition not working on adding class

i want to add a class to my div which already have a class via javascript and use transition to see the change but somehow its not working. I am not applying it to hover instead what i am trying to see is firstly div has default class and I am trying to see transition when javascript add playing class to it.

pen is

the javascript is executed when the page load. You would need to look up how to delay javascript if you want what you are saying to happen

I am seeing the animation happening the first time I load the codepen but not afterwards when I refresh.

@ilenia is on the right track here.

how can i delay javascript?

well, that’s what researching is about.

try using google, see what comes up and if it could be useful for you