Skip to content

[p5.js 2.0 Bug Report]: Can't assign to a property of inputs in a branch in p5.strands #8396

@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 RC

Web browser and version

All

Operating system

All

Steps to reproduce this

Steps:

  1. Create a p5.strands shader
  2. Create a branch or a loop
  3. Assign to a property of inputs in it

The shader won't compile.

Snippet:

let material

function setup() {
  createCanvas(windowWidth, windowHeight, WEBGL);
    material = baseMaterialShader().modify(() => {
    getPixelInputs((inputs) => {
      if (inputs.texCoord.x > 0.5) {
        inputs.color = [1, 0, 0, 1]
      } else {
        inputs.color = [0, 0, 1, 1]
      }
      return inputs
    })
  })
}

function draw() {
  background(255)
  noStroke()
  shader(material)
  sphere(100)
}

Live: https://editor.p5js.org/davepagurek/sketches/vOrLgKr0R

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions