AdderAccumulator

Constructor

AdderAccumulator <id> (double init_val, double clamp_min, double clamp_max)

Action

Accumulates the successive values of the input property and keeps the result within the boundaries provided by clamp_min and clamp_max if they have different values.

Predefined children

input, clamp_min, clamp_max, result

Example


use core
use base
use input

_main_
Component root {
  mouse = find ("input://Mice/PixArt USB Optical Mouse") // Linux platforms only, specify here the name of your mouse
  Component pointer {
    Double x (0)
    Double y (0)
  }
  AdderAccumulator acc_x (0, 0, 500)
  AdderAccumulator acc_y (0, 0, 500)
  mouse.move.x => acc_x.input
  mouse.move.y => acc_y.input
  acc_x.result => pointer.x
  acc_y.result => pointer.y
}