psytask - v1.1.1
    Preparing search index...

    Function Grating

    • Grating stimulus component for generating sinusoidal, square, triangle, or sawtooth gratings

      Parameters

      • props: {
            type: "triangle" | "square" | WaveFunction | "sin" | "sawtooth";
            size: number | [number, number];
            sf: number;
            ori?: number;
            phase?: number;
            color?: RGB255 | [RGB255, RGB255];
            mask?: MaskFunction;
        }
        • type: "triangle" | "square" | WaveFunction | "sin" | "sawtooth"

          Wave type or wave function that return [-1, 1]

        • size: number | [number, number]

          Width or [width, height] (in pixels)

        • sf: number

          Spatial frequency (cycles per pixel)

        • Optionalori?: number

          Orientation (in radians)

        • Optionalphase?: number

          Phase (in radians)

        • Optionalcolor?: RGB255 | [RGB255, RGB255]

          Color or [color, color] (RGB255 values)

        • Optionalmask?: MaskFunction

          Mask function that inputs [-1, 1] and returns [0, 1]

      • ctx: Scene<never>

      Returns { node: HTMLCanvasElement } & {
          props: {
              image?: (...) | (...) | (...);
              draw?(ctx: CanvasRenderingContext2D): void;
          };
      }

      using gratingScene = app.scene(Grating, {
      defaultProps: {
      type: 'sin',
      size: [200, 200],
      sf: 0.05,
      ori: Math.PI / 4,
      phase: 0,
      color: [255, 255, 255],
      mask: GaussianMask(0.3),
      },
      });
      await gratingScene.show();