Fader - transition value animation

There's no built-in function for this, but with some javascript it's possible:

// button.script
var start = Date.now(),
    duration = 1000,
    fps = 30,
    from = get('fader_1'),
    to = 1

setInterval(()=>{

  var x = (Date.now() - start) / duration

  if (x < 1) {

    var y = (to - from) * x + from
    set('fader_1', y)

  } else {

    set('fader_1', to)
    clearInterval()

  }

}, 1000/fps)

https://openstagecontrol.ammd.net/docs/widgets/scripting/

2 Likes