Skip to content

Commit 3df6b4a

Browse files
feat(strands): add lerpColor() support mapping to GLSL mix()
1 parent ad2ffcd commit 3df6b4a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/strands/strands_api.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,15 @@ export function initGlobalStrandsAPI(p5, fn, strandsContext) {
329329
return createStrandsNode(id, dimension, strandsContext);
330330
});
331331

332+
const originalLerpColor = fn.lerpColor;
333+
augmentFn(fn, p5, 'lerpColor', function (...args) {
334+
if (!strandsContext.active) {
335+
return originalLerpColor.apply(this, args);
336+
}
337+
// In strands, colors are vec4s — lerpColor maps directly to GLSL mix()
338+
return fn.mix(...args);
339+
});
340+
332341
augmentFn(fn, p5, 'getTexture', function (...rawArgs) {
333342
if (strandsContext.active) {
334343
const { id, dimension } = strandsContext.backend.createGetTextureCall(strandsContext, rawArgs);

0 commit comments

Comments
 (0)