Now, to replace the point moving from left to right, we define the behavior of a point moving up and down.
let process up_down state = for i = 1 to 50 do emit state.vel (0., 2.); pause done; loop for i = 1 to 100 do emit state.vel (0., - 2.); pause done; for i = 1 to 100 do emit state.vel (0., 2.); pause done end
let process moving_point' state = run (up_down state) || run (compute_pos state) || run (draw state)
To reconfigure the previous point, we need only send
this moving_point'
process on the
signal new_behavior
.
emit new_behavior moving_point';;
We can restore the previous behavior as follows.
emit new_behavior moving_point;;