Solved

Fade text

Posted on 1998-02-07
5
285 Views
Last Modified: 2010-04-02
How do you fade a text string in c.
I use Turbo c for dos.
I need source
0
Comment
Question by:hh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
Ready4Dis earned 100 total points
ID: 1257186
This is only for fading the color white out. If you need more, tell me, and I will do it.
Ok... here is the source:

#include <conio.h>
#include <stdio.h>
#include <dos.h>

main ()
{
      int i;
      clrscr();
      printf("Hello");  //here is the text.
      for (i=45;i>0;i--)
      {
            outportb(0x3c8,7);
            outportb(0x3c9,i);
            outportb(0x3c9,i);
            outportb(0x3c9,i);
            delay(100);  //Change for faster/slower fade
      }
            //Resets port...
            outportb(0x3c8,7);
            outportb(0x3c9,45);
            outportb(0x3c9,45);
            outportb(0x3c9,45);
return 0;
}
0
 

Author Comment

by:hh
ID: 1257187
Here is the source to fade out of white, into red, then out of red, and back to white.  Look for comments to changge colors.

#include <conio.h>
#include <stdio.h>
#include <dos.h>

main ()
{
      int i;
      clrscr();
      printf("Hello");  //here is the text.
      for (i=45;i>0;i--)
      {
            outportb(0x3c8,7);
            outportb(0x3c9,i);  //Red
            outportb(0x3c9,i);  //Green
            outportb(0x3c9,i);  //Blue
            delay(100);  //Change for faster/slower fade
      }
      for (i=0;i<45;i++)
      {
            outportb(0x3c8,7);
            outportb(0x3c9,i);  //Fade into Red.
            outportb(0x3c9,0);
            outportb(0x3c9,0);
            delay(100);  //Change for faster/slower fade
      }
      for (i=45;i>0;i--)
      {
            outportb(0x3c8,7);
            outportb(0x3c9,i);  //Fade out of Red.
            outportb(0x3c9,0);
            outportb(0x3c9,0);
            delay(100);  //Change for faster/slower fade
      }
            //Resets port...
            outportb(0x3c8,7);
            outportb(0x3c9,45);
            outportb(0x3c9,45);
            outportb(0x3c9,45);
return 0;
}
0
 
LVL 2

Expert Comment

by:Ready4Dis
ID: 1257188
How do you flash the whole screen
0
 

Author Comment

by:hh
ID: 1257189
#include <conio.h>
#include <stdio.h>
#include <dos.h>
main ()
{
int i;
clrscr();
for (i=0;i<45;i++)
{
outportb(0x3c8,0);
outportb(0x3c9,i); //Red
outportb(0x3c9,i); //Green
outportb(0x3c9,i); //Blue
delay(100); //Change for faster/slower fade
}
for (i=45;i>0;i--)
{
outportb(0x3c8,0);
outportb(0x3c9,i);
outportb(0x3c9,i);
outportb(0x3c9,i);
delay(100); //Change for faster/slower fade
}
return 0;
}
0
 
LVL 2

Expert Comment

by:Ready4Dis
ID: 1257190
//Flash whole screen
#include <conio.h>
#include <stdio.h>

main ()
{
  outportb(0x3c8,0);
  outportb(0x3c9,63); //Red
  outportb(0x3c9,0); //Green
  outportb(0x3c9,0); //Blue
  getch();  //Wait for keypress
  outportb(0x3c8,0);
  outportb(0x3c9,0); //Red
  outportb(0x3c9,0); //Green
  outportb(0x3c9,0); //Blue
  return 0;
}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question