Display: Controls.DrawProc ~ {
color: BOOL ¬ viewer.column = color;
font: Imager.Font ¬ VFonts.DefaultFont[];
DrawFunction:
PROC [function: Function, label: Rope.
ROPE, r, g, b:
REAL ¬ 0.0] ~ {
delta: REAL ~ 0.02;
p1: Imager.VEC ¬ [0.0, viewer.ch*function[0.0]];
IF color THEN Imager.SetColor[context, ImagerColor.ColorFromRGB[[r, g, b]]];
FOR t:
REAL ¬ delta, t+delta
WHILE t <= 1.0
DO
p0: Imager.VEC ¬ p1;
p1 ¬ [viewer.cw*t, viewer.ch*function[t]];
Draw2d.Line[context, p0, p1];
ENDLOOP;
Draw2d.Label[context, [viewer.cw*0.2-0.5*VFonts.StringWidth[label, font], viewer.ch*function[0.2]], label];
};
IF color THEN Draw2d.Clear[context, ImagerColor.ColorFromRGB[[0.5, 0.5, 0.5]]];
DrawFunction[ConstantLaw, "constant", 1.0, 0.0, 0.0];
DrawFunction[AccelerationLaw, "acceleration", 0.0, 1.0, 0.0];
DrawFunction[DecelerationLaw, "deceleration", 0.0, 0.0, 1.0];
DrawFunction[AccThenDecLaw, "acceleration then deceleration", 1.0, 1.0, 1.0];
DrawFunction[ValueVsEffortLaw, "value of this slide vs. effort", 0.0, 0.0, 0.0];
};