Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void AnimateAndFill() {
- static uint8_t FrameCounter = 0; //counts frame for steps measure.
- uint8_t AnimationIndex;
- uint8_t AnimationAndSpeed;
- // Effect speed global, nudges everything from left to right!
- static int effectSpeed = 0; //animation speed, This is not the speed you want to set. use SpeedIndex!
- // NoiseDistanceJump += 5; // beatsin8(10,1,4); //noise movement speed: bpm,lowest,highest.
- if (0 < SpeedIndex && SpeedIndex < 20) {
- if(FrameCounter % (20 - SpeedIndex) == 0 ) //slowing down animation by waiting x frames with the update. So, speedIndex 1 means wait 20 frames before incrase step.
- { effectSpeed++; FrameCounter = 0; }
- }
- else if (SpeedIndex >= 20) {
- effectSpeed += SpeedIndex - 19;
- }
- FrameCounter++;
- for( int i = 0; i < NUM_LEDS; i++) {
- switch (AnimationMethod) {
- case 0: AnimationIndex = 0; break;
- case 1: AnimationIndex = inoise8(i*AnimScale,NoiseDistanceJump+i*AnimScale) % 255; break;
- case 2: AnimationIndex = sin8((i+SineOnePhase)*SineOneWaveLenght)*SineOneAmplitude + sin8((i+SineTwoPhase)*SineTwoWaveLenght)*SineTwoAmplitude; break;
- }
- if(Reverse) {AnimationAndSpeed = AnimationIndex - effectSpeed;}
- else {AnimationAndSpeed = AnimationIndex + effectSpeed;}
- leds[i] = ColorFromPalette(CostumPalette, AnimationAndSpeed, 255);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment