"colours": ["red", "yellow", "green"],
"position": [300, 300],
"intensity": 0.5
+ },
+ {
+ "type": "pulsatinglamp",
+ "colour": "cyan",
+ "pulse_range": [20, 100],
+ "pulse_velocity": 1,
+ "position": [250, 450],
+ "intensity": 0.5
}
]
}
self.invalidate_fitting_image()
+class PulsatingLamp(BaseLight):
+
+ FITTING_IMG = "lamp.png"
+ DEFAULT_RANGE = (20, 100)
+ DEFAULT_VELOCITY = 2
+
+ def __init__(self, **kw):
+ self.pulse_range = kw.pop("pulse_range", self.DEFAULT_RANGE)
+ self.pulse_velocity = kw.pop("pulse_velocity", self.DEFAULT_VELOCITY)
+ super(PulsatingLamp, self).__init__(**kw)
+
+ def tick(self):
+ radius = self.ray_manager.max_radius
+ radius += self.pulse_velocity
+ if radius < self.pulse_range[0]:
+ radius = self.pulse_range[0]
+ self.pulse_velocity = -self.pulse_velocity
+ elif radius > self.pulse_range[1]:
+ radius = self.pulse_range[1]
+ self.pulse_velocity = -self.pulse_velocity
+ self.ray_manager.max_radius = radius
+
+
class SpotLight(BaseLight):
FITTING_IMG = "spotlight.png"
return self._max_radius
@max_radius.setter
- def max_radius_setter(self, value):
+ def max_radius(self, value):
self._max_radius = value or 0.0
@property
return self._min_radius
@min_radius.setter
- def min_radius_setter(self, value):
+ def min_radius(self, value):
self._min_radius = value or 0.0
def reaches(self, position):