Skip to content

support map() inside p5.strands shaders #8750

@Nixxx19

Description

@Nixxx19

right now p5.strands doesn't support the regular p5 map() function inside shader callbacks. since map is one of the most used helpers in normal p5 sketches, not having it in strands means people end up rewriting it manually as something like start2 + (n - start1) / (stop1 - start1) * (stop2 - start2) every time.

would be nice to add it to the strands builtins so it just works the same way it does in regular p5 code.

something like:
map(n, start1, stop1, start2, stop2)

with the same signature as the cpu version. the withinBounds variant can probably come later if needed.

came up in a recent call, opening this so we have a place to track it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions