Skip to content

[p5.js 2.0 Bug Report]: p5.strands | methods and properties of filterColor not known in instance mode #8574

@christophseibel

Description

@christophseibel

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.2.2.

Web browser and version

Safari 26.3

Operating system

MacOSX

Steps to reproduce this

Problem

Even though they are definetly usable, in instance mode the methods and properties of filterColor don't show up on autocomplete and typescript says they don't exist on type object (ts(2339)).

Snippet:

import p5 from "p5";

let sketch = (p5: p5) => {
  let filterShader: p5.Shader;

  function testShader({ p5 }: { p5: p5 }) {
    p5.filterColor.begin();
    let coord = p5.vec2(p5.filterColor.texCoord);
    p5.filterColor.set([coord, 0, 1]);
    p5.filterColor.end();
  }

  p5.setup = () => {
    p5.createCanvas(800, 800, p5.WEBGL);
    p5.fill(255);

    filterShader = p5.buildFilterShader(testShader, { p5 });
  };

  p5.draw = () => {
    p5.background(0);
    p5.filter(filterShader);
  };
};

new p5(sketch);

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions