Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4272768
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:37:20+00:00 2026-05-21T07:37:20+00:00

Ok, I made an app in C# that polls info from my screen for

  • 0

Ok, I made an app in C# that polls info from my screen for ambilight SFX using an external LED controller. My question is, what is the code or how do I go about making a color cross fade type thing where I get a fade from red to green to blue and out put the RGB values as

red = CODE;
green = CODE; 
blue = CODE;

I have done this long ago in C++ using “Interpolation(FadeSteps, Delay, Array)”, I just don’t have a clue how in C#

Think of drawing a 2D box and have it fade from one color to the next that’s the idea.

I just want to be able to set speed of the fade
Idea as to what it’s controlling

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:37:20+00:00Added an answer on May 21, 2026 at 7:37 am

    Ok, If I understand you right, you want to fade from Red, to green to blue?

    Starting off with a struct and an enum to hold our color data and state.

    public enum PrimaryColor
    {
        Red,
        Green,
        Blue
    }
    
    public struct Color
    {
        public byte r;
        public byte g;
        public byte b;
    
        public Color(byte r, byte g, byte b)
        {
            this.r = r;
            this.g = g;
            this.b = b;
        }
    }
    

    We then make some variables to hold our state data, including an array of which we will traverse.

    Color ActualColor = new Color(255, 0, 0);
    int State = 0;
    PrimaryColor[] Order = { PrimaryColor.Red, PrimaryColor.Green, PrimaryColor.Blue };
    

    Then, in your update function (say a timer, or while loop, etc.) we add a little switch statement to update colors, check for byte underflow and change states.

    switch (Order[State])
    {
        case PrimaryColor.Red:
            ActualColor.r++;
            if(ActualColor.g > 0) ActualColor.g--;
            if (ActualColor.b > 0) ActualColor.b--;
            if (ActualColor.r == 255 && ActualColor.g == 0 && ActualColor.b == 0) State++;
            break;
        case PrimaryColor.Green:
            ActualColor.g++;
            if (ActualColor.r > 0) ActualColor.r--;
            if (ActualColor.b > 0) ActualColor.b--;
            if (ActualColor.r == 0 && ActualColor.g == 255 && ActualColor.b == 0) State++;
            break;
        case PrimaryColor.Blue:
            ActualColor.b++;
            if (ActualColor.g > 0) ActualColor.g--;
            if (ActualColor.r > 0) ActualColor.r--;
            if (ActualColor.r == 0 && ActualColor.g == 0 && ActualColor.b == 255) State++;
            break;
        default:
            break;
    }
    if (State == Order.Length) State = 0;
    
    //Send color data to your controller
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made an app that paints FFT to the screen realtime (from mic).
I have made an app that gets an array of addresses from a web
This is the case: I made an app using the Audio Streamer library that
I made an WPF app that plays sounds using the MediaPlayer class. This works
I made a web app that loads images using jquery, ajax and json. I
I made this app that takes time entries from fogbugz and posts them to
i have made an app that would calculate numbers from input fields. **main Activity
I made a quiz app using wordpress using a quiz plugin so that, the
I made an App using cocos2D that has a hierarchical structure. And I used
I saw that someone has made an app that tracks your feet using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.