Skip to content

[p5.js 2.0 Bug Report]: lerp() not working in p5.strands #8646

@davepagurek

Description

@davepagurek

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

All

Operating system

All

Steps to reproduce this

Steps:

  1. Go to https://beta.p5js.org/reference/p5/buildfiltershader/
  2. Scroll to the fifth example, with the animated red-blue gradient
  3. Replace mix with lerp
  4. The sketch stops working

mix and lerp should act like aliases in p5.strands. mix does already work, but lerp does not for some reason, although I thought we aliased it already? It may have gotten lost in a refactor at some point.

Snippet:

let myFilter;
function setup() {
  createCanvas(50, 50, WEBGL);
  myFilter = buildFilterShader(gradient);
  describe('A moving, repeating gradient from red to blue');
}

function gradient() {
  let time = uniformFloat();
  filterColor.begin();
  filterColor.set(lerp(
    [1, 0, 0, 1], // Red
    [0, 0, 1, 1], // Blue
    sin(filterColor.texCoord.x*15 + time*0.004)/2+0.5
  ));
  filterColor.end();
}

function draw() {
  myFilter.setUniform('time', millis());
  filter(myFilter);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions