Repository navigation
Releases: That-One-Nerd/betterlights
Release list
BetterLightStrips 1.2.3
The following changes to the engine have been made:
- The
Gradientclass now has a constructor to deep copy from another gradient. Gradientscan now also sharply switch between colors, rather than always smoothly interpolating between them. Use.sharp().- #6: Transition logs now have the option to be condensed into a single line rather than two. Use
config.withMergedTransitionLogs().
The following light wrappers have been added/changed:
BreathingLightWrapper: A unary light wrapper forLEDPattern.breathe(). This wrapper will smoothly pulse its pattern over a given time.OverlayLightWrapper: A binary light wrapper forLEDPattern.overlayOn(). This wrapper applies a pattern directly on top of another pattern.- Similarly to
.mask(), the implementation ofLightPattern.overlayOn()differs quite significantly from its base implementation. I believe the original implementation was quite flawed, and I believe this one is an improvement. Overall, the two wrappers have fairly similar behavior.
- Similarly to
- Changed
ScrollLightWrapper: Scrolling now will interpolate between pixels at the corners of the patterns, making the overall affect much smoother. It can be disabled with.sharp().
The following light patterns have been added/changed:
- Changed
RandomLightPattern: This pattern now has the ability to randomize along a true gradient, rather than simply two colors. ProgressBarLightPattern: A powerful pattern that takes aDoubleSupplierto animate a progress bar from left-to-right. Both the active and inactive sections of the bar can be either single colors or entire gradients, and this class can be inherited from.
- In addition, some methods regarding interpolation in a variety of patterns have been renamed to
.sharp()and.smooth()to create a standard convention across the library. Because nobody is using the library at this time, I've opted to make this a breaking change.
Breaking Changes
From 1.2.2: To standardize the naming convention of interpolation in this library, several existing methods have had their names changed to .sharp() and .smooth(). This includes the following:
BounceLightPattern.withFade()->.smooth().withSharp()->.sharp()
RandomLightPattern.withSmoothInterpolation()->.smooth().withRoughInterpolation()->.sharp()
I hope this makes sense. In the future I may do deprecations, but nobody is using the library right now so I have no reason to.
From 1.2.1: Project files moved to root
From 1.1: Suppliers are used in .withStateAll() and .withTransitionAll()
To install:
- Download the source code from this release, extract it, and place the
betterlightsdirectory into yoursrc/java/mainfolder. - Alternatively, you could clone this project directly into your robot code with
git submodule add https://github.com/That-One-Nerd/betterlights.gitrun in yoursrc/main/javadirectory.
BetterLightStrips 1.2.2
The following changes to the engine have been made:
- Fixed a small bug with
RandomLightTransitionpreventing the.onEnabled()event from being raised in its patterns. - Improved the system for tick calculations of patterns in a transition. This likely will make zero practical difference.
The following light wrappers have been added:
MaskedLightWrapper: A binary light wrapper forLEDPattern.mask(). Multiplies the decimal color values of two patterns together, effectively masking one upon the other.- This implementation of
.mask()has been modified from the previous implementation inLEDPattern. The previous method used a bitwise AND operation between the 8-bit binary values of the two colors. I believe my implementation is better.
- This implementation of
BlinkedLightWrapper: A light wrapper forLEDPattern.blink()andLEDPattern.synchronizedBlink(). Turns a pattern on if a condition is true (or during a timed interval), otherwise show black. Allows customization for easing in or out.
Breaking Changes
From 1.2.1: Removed project files and moved all important source files to the root directory of the repository, to allow cloning the project as a submodule. Unless you were already cloning the project, this does not affect you at all. However, downloading the source is no longer a specific .zip file, simply download the source code attached to this release, or feel free to clone from this project.
From 1.1: Suppliers are used in .withStateAll() and .withTransitionAll()
To install: Download the source code from this release, extract it, and place the net/betterlights directory into your src/java/main/ folder.
BetterLightStrips 1.2.1
The following changes to LightPattern have been made:
gammahas been added as a protected field, since quite a lot of patterns use it. As such,colorLerp(a, b, t, gamma)has been removed, since gamma is autofilled with the protected field.- The functionality of
colorLerp()has moved toColorHelper.lerp(). The declaration will continue to exist inLightPattern.
The following changes to Gradient have been made:
- Quality of life stuff:
Gradient.rainbow()now exists, andGradient.linear(Color...)can be used to easily create a basic gradient.
The following light wrappers have been added:
UnaryLightWrapper: A wrapper that can be used to modify the colors of a pattern.BinaryLightWrapper: A wrapper that can be used to modify the colors of two patterns to create one.BlendedLightWrapper: A wrapper forLEDPattern.blend(). Blends between two patterns.BrightnessLightWrapper: A wrapper forLEDPattern.atBrightness(). Changes the brightness of the input pattern.- Separated specific wrappers like
BlendedLightWrapperfrom the generalized ones likeUnaryLightWrapper. If you were properly using the methods, this should not be a breaking change.
Breaking Changes
From 1.1: Suppliers are used in .withStateAll() and .withTransitionAll()
To install: Extract betterlights.v1.2.1.zip and place the net/betterlights directory in your src folder.
BetterLightStrips 1.2.0
The following changes to the engine have been made:
- Fixed a bug with multiple strip segments that would re-initialize a pattern twice during a state change. This was due to a reference-equals being used when a value-equals was proper.
- Fixed a bug with a transition being applied to multiple segments overriding itself. This was a bug caused by invoking a global state change request in the scheduler, rather than a state request for a specific segment.
- Patterns and transitions now have independent instances for independent light strips. This fixes some bugs and overall makes things smoother.
- This introduces a minor breaking change!
The following patterns have been added:
GradientLightPattern: A very powerful light pattern that can display pretty much any form of linear gradient, and even allows for an animation between multiple gradients over time.- Also created the
Gradientobject model.
- Also created the
The following transitions have been added:
RandomLightTransition: A transition that flips pixels at random from one pattern to the next. Can optionally flash to a specified color before switching, and the amount of pixels per tick can be changed.
Breaking Changes
From 1.1: Because patterns are now separate instances for each segment, a Supplier<LightPattern> is now being used in the .withStateAll() and .withTransitionAll() methods to replace the original, single instance LightPattern argument.
If you are using your configuration class in the standard way, the changes are quite minimal.
LightScheduler.configure()
//.withStateAll("patternA", // previous
.withStateAll("patternA", () -> // new
new SolidLightPattern(Color.kRed))
//.withTransitionAll("patternA", "patternB", // previous
.withTransitionAll("patternA, "patternB", () -> // new
new FadeLightTransition()
.withColor(Color.kWhite))
//.withUnknownBehavior( // previous
.withUnknownBehavior(() -> // new
new RandomLightPattern());To install: Extract betterlights.v1.2.0.zip and place the net/betterlights directory in your src folder.
BetterLightStrips 1.1.0
This release adds wrappers for certain concepts, mostly to create higher-level versions of default LEDPattern modifiers. For example, rather than rewriting your custom pattern to work in reverse, simply append the .reverse() to the end of your config declaration and a wrapper will be constructed that reverses your pattern. Animations and everything else still works.
A compatibility wrapper has also been added for if you've written patterns that use LEDPattern (say, as an anonymous function) and don't want to create a LightPattern class. Simply call LightPattern.from() and pass your pattern. Animations must be handled on the LEDPattern side of things, but other than that it should be seamless.
All wrappers (excluding CompatibilityLightWrapper) must derive from LightWrapper.
The following light wrappers have been added:
MappedLightWrapper: A wrapper that will remap LED indices to new ones. Used as a base class for some other wrappers.ReverseLightWrapper: A wrapper that reverses its underlying pattern. Use.reverse().OffsetLightWrapper: A wrapper that offsets the pattern by a given number of pixels. Use.offsetBy().ScrollLightWrapper: A wrapper that scrolls the pattern over time by a given number of pixels per second. Use.scroll().- Note that
.scrollAtRelativeSpeed()and.scrollAtAbsoluteSpeed()are also implemented for the sake of backwards-compatibility. I personally don't like them and would prefer you use.scroll(), but it's up to you.
- Note that
To install: Extract betterlights.v1.1.0.zip and place the net/betterlights directory in your src folder.
BetterLightStrips 1.0.0
This is the point at which I'd consider the project in a state that I'd consider finalized. The other main thing this project was missing was transitions, so that's what I've implemented.
How to use transitions:
- In your configuration, add a
.withTransitionAll("fromstate", "tostate", new ExampleTransition()). Preferred - Alternatively, you can directly control transitions by using the
TransitionPairtype, like so:.withStateAll(new TransitionPair("fromstate", "tostate"), -1, new ExampleTransition()). Not Recommended
Transitional patterns must always derive from the LightTransition base class. This is enforced at compile-time for the withTransition* methods, but only enforced at runtime for the withState* methods.
Aside from scheduler modifications, the following light transitions have been added:
FadeLightTransition: Fades between the two transitions. Can optionally fade to an intermediate color first.SwipeTransition: A block of color wipes between the two transitions, or optionally no block of color is visible.
To install: Extract betterlights.v1.0.0.zip and place the net/betterlights directory in your src folder.
BetterLightStrips 0.9.0
Hi! This is the first point at which I'd consider this project "stable." Transitions are in the next release (this description is being written after-the-fact), this is only including the point at which I'd stopped development in April, plus the readme I added in September.
Aside from all of the main systems (see the readme), the following light patterns have been added:
SolidLightPattern: Displays a solid color over the entire strip.RandomLightPattern: Fills the strip with a set of random colors. Refreshes after a certain number of ticks, and can display either rainbow colors, shades of a color, or randomly between two colors. Can also interpolate between refreshes (the "command block" look).BounceLightPattern: A segment of color bounces between the two ends of the strip. Can do a smooth sinewave wipe. Can also blend the bouncer as a gradient instead of it being solid color.
To install: Extract betterlights.v0.9.0.zip and place the net/betterlights directory in your src folder.