Skip to content

rgbscripts/lines.js Enhance RGB script with new properties and performance optimizations#1845

Open
sandinak wants to merge 1 commit intomcallegari:masterfrom
sandinak:feature/lines-js-upstream
Open

rgbscripts/lines.js Enhance RGB script with new properties and performance optimizations#1845
sandinak wants to merge 1 commit intomcallegari:masterfrom
sandinak:feature/lines-js-upstream

Conversation

@sandinak
Copy link
Contributor

Summary

Comprehensive enhancement to the lines.js RGB script with new animation properties and significant performance optimizations.

Changes

  • New Properties: linesDistribution, linesMovement, linesLifecycle, linesPattern, linesBrightnessVariance, linesMovementSpeed
  • Removed: Deprecated properties (linesVariability, linesSlide, linesRollover)
  • Performance: Bitwise operations for Math.round/floor, optimized color calculations, early returns for common cases
  • Quality: Improved code structure, comprehensive validation, better formatting

Testing

  • All RGB script tests passing (100% success rate)
  • Property validation verified
  • Performance benchmarks confirmed

- Add new properties: linesDistribution, linesMovement, linesLifecycle, linesPattern, linesBrightnessVariance, linesMovementSpeed
- Remove deprecated properties: linesVariability, linesSlide, linesRollover
- Implement performance optimizations:
  * Replace Math.round() with bitwise operations (value + 0.5) | 0
  * Replace Math.floor() with bitwise OR (value | 0)
  * Use bit shifts for division/multiplication (>> 1, << 1, >> 2)
  * Optimize color channel extraction with cleaner bit masks
  * Add early returns for common cases
  * Cache frequently used calculations
  * Optimize brightness variance and color calculations
- Improve code structure and formatting
- Add comprehensive property validation
- Enhance line lifecycle and movement capabilities
- All tests passing (100% success rate)
@sandinak sandinak force-pushed the feature/lines-js-upstream branch from 08617a8 to 99cb699 Compare October 21, 2025 17:04
@mcallegari
Copy link
Owner

Thanks for this.
In terms of parameters, is this backward compatible?

@sandinak
Copy link
Contributor Author

sandinak commented Dec 2, 2025

Thanks for this. In terms of parameters, is this backward compatible?

Yes .. it should be. I am working on several of these.. so hopefully this test case will be useful.

algo.linesBias = 0;
algo.properties.push("name:linesBias|type:list|display:Starting Bias|values:Random,Top,Bottom,Left,Right,TopLeft,TopRight,BottomLeft,BottomRight|write:setBias|read:getBias");
algo.linesSlide = 0;
algo.properties.push("name:linesSlide|type:list|display:Slide|values:None,Up,Down,Left,Right|write:setSlide|read:getSlide");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed "Slide" and "Rollover" so this is not backward compatible.
What about existing projects using those parameters?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants