예제 #1
0
    def __init__(self, rate, clock_name=FRAME_CLOCK_NAME):
        """Create a new Trigger.

        This trigger will initially be in a state where it will fire immediately
        when first polled.

        Uses the name registration system to get the clock.
        """
        self.rate = rate
        self.clock = get(clock_name)
        self.last_trig = self.clock.time() - self.period
예제 #2
0
    def __init__(self, rate, func, clock_name='frame clock'):
        """Create a function generator with a specified function.

        func should take two positional arguments: (phase, rate)

        Internally keeps track of phase on the range [0.0, 1.0)
        """
        self.rate = rate
        self.func = func
        self.clock = get(clock_name)
        self._phase = 0
        self.last_called = self.wc.now
예제 #3
0
 def __init__(self, rate, clock_name=FRAME_CLOCK_NAME, seed=None):
     """Initialize a diffusor with a rate."""
     self.rate = rate
     self.clock = get(clock_name)
     self.last_called = self.clock.time()
     self.rand_gen = GaussianRandom(0.0, 0.0, seed)