JSFiddle - React, Tailwind, and code Playground
HTML
<div id="testee"></div>
CSS
#testee {
height: 100px;
width: 100px;
background: black;
position: absolute;
}
JavaScript
var sw = 1
document.id('testee').addEvent("click", function() {
sw = sw == 1 ? 0 : 1
this.get('tween').setOptions({
duration: 1000
}).start('opacity', sw)
})