How to make a led pulse / flash?

but it does nothing… is it supposed to work in O-S-C v1.x ?

No, most of these tricks are obsolete, I closed the ticket with a message that says that. Here is an adapted version of the snippet:

/* css property */
JS{{
    var x = OSC{/pulse}; // subscribe to osc messages on address "/pulse"
    locals.T = Date.now(); // generate timestamped css animations to force reset 
}}

@keyframes pulse-#{locals.T} {
    0% {opacity:0;}
    10% {opacity:1;}
    100% {opacity:0;}
}
inner:after {
    animation: pulse-#{locals.T} .5s 1 forwards
}

Alternatively you could use the new script feature to make the led 's value fall programmatically when it changes, for example:

// script property
var fallTime = 0.2,
    fps = 24,
    maxValue = 1,
    step = maxValue / fps / fallTime

setTimeout(()=>{
  if (value <= 0) clearTimeout()
  set("this", value - step)
}, 1000 / fps)
1 Like