Alias GLSL's mix function as lerp in p5.strands (#7875)
Resolves #7875
Changes:
- Introduced an alias for the GLSL
mixfunction under the namelerpinp5.strands. - Ensures that
lerp()withinp5.strandsmaps tomix()when generating shader expressions. - Falls back to the original p5.js
lerp()function outside ofp5.strands.
Rationale:
This change bridges the gap between core p5.js and p5.strands by making lerp() work seamlessly within shader code. It increases accessibility by allowing familiar p5.js functions to be used in new contexts.
A short inline comment was also added for clarity:
PR Checklist
- [x]
npm run lintpasses - [x] Inline reference is included / updated
- [x] Unit tests are included / updated
fixes #7875
I was using VS Code but the issue I was facing was not because of environment. I had created a syntax error by mistake which I was not noticing.
Thank you, almost there! Could you also remove the unused variable fn on line 11?
I have made the changes as you suggested. Please review it when you have time.
Thank you for working on this! It looks good to me. @davepagurek could you review too?
@all-contributors please add @LalitNarayanYadav for code
Looks great, thanks @LalitNarayanYadav! Let us know if you're interested in taking on more strands functions 🙂
You're very welcome @davepagurek ! 😊 And thank you@ I'd be glad to take on more p5.strands functions or any other related work! Just let me know where help is needed next. happy to contribute more.