Skip to content

Meteor Rain color changing #2

@Viktus04

Description

@Viktus04

Hello,

I am totally new to programming and I already talked to Tobias Blum because I'm using the Mc Lighting platform for my Wemos D1, he said that maybe you could help me.
I want the Meteor Rain Effect to change the color after every cycle.
I already tried to do it by myself but I'm not getting to the point where it works like this, I added the color_wheel the color is changing extremely fast and not after every cycle.
but maybe I'm wrong with that. maybe you have a quick solution for me?

Thank you very much for your great work!

  uint16_t meteorRain(uint8_t meteorTrailDecay, boolean meteorRandomDecay) {  
    uint16_t meteorSize = SEGMENT_LENGTH * 0.20;
    
    SEGMENT_RUNTIME.aux_param = get_random_wheel_index(SEGMENT_RUNTIME.aux_param);
	RgbColor color = color_wheel(SEGMENT_RUNTIME.aux_param);
	
	
	
	if(SEGMENT_RUNTIME.counter_mode_step == 0){
      _strip.ClearTo(rgbcolor_black);
	}
  
    if( SEGMENT_RUNTIME.counter_mode_step <= SEGMENT_LENGTH*2 ) {
      // fade brightness all LEDs one step
      for(uint16_t i=0; i <= SEGMENT_LENGTH; i++) {
        if( (!meteorRandomDecay) || (random(10)>5) ) {
          fadeToBlackVal(i, meteorTrailDecay );        
        }
      }
      // draw meteor
  for(uint16_t i = 0; i <= meteorSize; i++) {
        if( ( (SEGMENT_RUNTIME.counter_mode_step)-i <= SEGMENT_LENGTH) && ((SEGMENT_RUNTIME.counter_mode_step)-i >= 0) ) {
          if(!SEGMENT.reverse){
            this->setPixelColor(SEGMENT_RUNTIME.counter_mode_step - i, color);
		  } else {
		    this->setPixelColor(SEGMENT_LENGTH - SEGMENT_RUNTIME.counter_mode_step + i, color);
          }
        } 
      }
    } 

	SEGMENT_RUNTIME.counter_mode_step = (SEGMENT_RUNTIME.counter_mode_step + 1) % SEGMENT_LENGTH;
    return
    (SEGMENT.speed / SEGMENT_LENGTH);
  }
  
  uint16_t mode_meteor_rain(void) {
    return meteorRain(64, true);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions