So I had some new ideas for patterns and effects on the MatrixClock. I’m just not sure how to implement them. I remember a while back there was a mention of doing alpha blending. So my thought was to have three “layers”, each rotating at a different speed, and doing neat interactions with the colors. I was looking at using my Object3D class for this, as it makes it pretty simple to do rotations and movements of shapes - make a single face, rotate/translate it as I like.
FastLED has some HSV blend functions which may come in handy. A warning though, don’t try to use FastLED functions within the SmartMatrix Library, you will have dependency problems.
what kinds of dependency problems? The library should, in theory (and last time I was poking at it) play nicely with the smartmatrix library in a number of configurations.
Oh - wait, you mean to smartmatrix library itself - yeah, some of that is general library idiocies in arduino. However a sketch can include both smart matrix and FastLED together.
So I can see I’m going to have to write all new primitive functions to use the blend functions. I think I want to use blend() instead of nblend(), right?
I should be able to do something like this, I hope (in psuedocode)
for each pixel:
existing = leds[XY(X,Y)]; // grab the CHSV for that pixel
overlay = CHSV(H,S,V); // overlay color
new = blend(existing, overlay, .5); // blend by 50%, adjust to suit
drawPixel(X,Y,new);
end
Edit: Or maybe do something like add an overload that if I put in a float at the end, it blends that pixel. I can see this will be a whole lot of overhead though, since it’d be checking each pixel it draws.
scalevalue represents a byte which controls the balance of the blending. That method can be applied to more than 2 layers, too. Just make sure that the sum of all the scaling values is <256 to avoid a white out.