Guest User

dropLoop

a guest
Sep 19th, 2024
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | Software | 0 0
  1. int speedDrop = 5;
  2. float fpsDrop = 0.08;
  3. int spacingDrop = 10;
  4. int particlesDrop = 6;
  5. float rowDelayDrop = 0.50;
  6.  
  7. int id(int row, int col) {
  8.   return col + 90*row;
  9. }
  10.  
  11. for (float i = 0; i < 6.0; i += fpsDrop) {
  12.       int position[particlesDrop];
  13.       for (int k = 0; k < 4; k++) {
  14.        for (int j = 0; j < particlesDrop; j++) {
  15.          position[j] = (int) ((89-(j*spacingDrop))*(i-rowDelayDrop*k) - ((22.25-(j*1.25)) * (i-rowDelayDrop*k)*(i-rowDelayDrop*k)));
  16.           if (position[j] > 0 && position[j]) {
  17.            leds[id(k, position[j])] = CRGB((int) 150.0 *((float) j/(float) particlesDrop), (int) 150.0 *((float) j/(float) particlesDrop), 255);
  18.           }
  19.         }
  20.       }
  21.       FastLED.show();
  22.       delay(speedDrop);
  23.       FastLED.clear();
Tags: FastLED
Advertisement
Add Comment
Please, Sign In to add comment