Timeline Animation not playing

I’m trying to create a music tutorial. I want to be able to click on a button and have it play a musical note and also highlight the key for one second.

I’m having trouble with animations not playing correctly after the first trigger event. Here is the code I’m using.

export function D4_click ( event ) {
$w ( ‘#D4player’ ) . play ();
timeline
. add ( $w ( ‘#image11’ ), { duration : 1 , opacity : 1 })
. add ( $w ( ‘#image11’ ), { duration : 1 , opacity : 0 } , 1000 )
. play ();
}

export function D4player_ended ( event ) {
$w ( ‘#D4player’ ) . stop ();
}

The animation plays perfectly the first time I click on the key. After the first time, all subsequent clicking will only have the first line of the animation play. Can anyone help me with this?