Fade to Black 
Author Message
 Fade to Black

I'm trying to get the screen to fade to black.  Simple enough?

Right now I'm experimenting with this:

'Initialize
DEF SEG = &HA000
SCREEN 13
RANDOMIZE TIMER
DEFINT A-Z
'This purely for aesthetic value (as a test)
FOR i = 1 TO 50
LINE (INT(RND * 320), INT(RND * 200))-(INT(RND * 320), INT(RND * 200)),
INT(RND * 255)
NEXT i
DO
a$ = INKEY$
IF a$ = "q" THEN END
FOR x = 0 TO 319
FOR y = 1 TO 100
c = PEEK(x + (y * 320)) ' Check pixle color
IF c <> 0 THEN POKE x + (y * 320), (c - 1) ' If the pixle is not
NEXT y                                       'black then replace it
NEXT x
LOOP

The q to quit can go but it just takes too damn long to run!

        At first I had sacked the DEFINT command and did Y = 0 TO 199 (to clear
the whole screen) instead of Y = 0 to 100 but it took about 5 minutes to
clear the screen!  So I included the DEFINT and made Y only go through
100 (to prevent an overflow).  Now the program clears the top half of
the screen at a (much faster) pace that is probably 5 to 10 times faster
than the original.
        Okay I have somthing that works, but there are three problems with
it...  
1.) It is insufferably SLOW
2.) It doesn't clear the bottom half of the screen
3.) It doesn't really fade to black but cycles through every color from
        whatever random color was chosen, to zero. (I suppose if you
        solved this problem it would fix the speed problem as well).

        How could I clear the bottom of the screen at the same reasonable pace
(maybe break up the larger numbers into smaller powers of 2 (code?)) and
get the screen to (really) fade to black?

        Also I still need some help with loading bianary files (with BLOAD)
into a compiled program.  I can't quite seem to get it to work.

                                                Thanx



Fri, 24 Nov 2000 03:00:00 GMT  
 Fade to Black

Mon, 08 Jun 1998 20:22:01 -0500 - Countdown commences in comp.lang.basic.misc.
Jacob Woolcutt launched the following into space:

Quote:
> I'm trying to get the screen to fade to black.  Simple enough?

Usually...

Quote:
> Right now I'm experimenting with this:
> [snip]
> The q to quit can go but it just takes too damn long to run!

>    At first I had sacked the DEFINT command and did Y = 0 TO 199 (to clear
> the whole screen) instead of Y = 0 to 100 but it took about 5 minutes to
> clear the screen!  So I included the DEFINT and made Y only go through
> 100 (to prevent an overflow).  Now the program clears the top half of
> the screen at a (much faster) pace that is probably 5 to 10 times faster
> than the original.
>    Okay I have somthing that works, but there are three problems with
> it...  
> 1.) It is insufferably SLOW
> 2.) It doesn't clear the bottom half of the screen
> 3.) It doesn't really fade to black but cycles through every color from
>    whatever random color was chosen, to zero. (I suppose if you
>    solved this problem it would fix the speed problem as well).

>    How could I clear the bottom of the screen at the same reasonable pace
> (maybe break up the larger numbers into smaller powers of 2 (code?)) and
> get the screen to (really) fade to black?

It's not your code that needs changing, rather the entire program - the method
you're using is unbearably slow, as you've witnessed. The way to do it would be:

1- read the palette to get red, green and blue values for each colour attribute.
You could probably do this using INP &H3C9 (you change the palette using OUT
&H3C9) though I haven't got round to testing that. Maybe it works, maybe it
doesn't.

2- Anyway, now you have your values. Now, all you need to do is go through the
palette and modify it so the red, green and blue values go down each time. You
could make them go down by one each time or you could decrement them with a
value relative to their original values, so they all end up at zero at the same
time. This shouldn't be hard to do - I would make some code, but I don't have
time (at least until next week when my exams end - woohoo!)

3- Voila, you've faded to black. If you coded the above it should work pretty
quickly.

If you need more help, just ask the wise members of this newsgroup...

Quote:
>    Also I still need some help with loading bianary files (with BLOAD)
> into a compiled program.  I can't quite seem to get it to work.

Give us more info - what exactly happens (eg what error numbers etc.)?

HTH,
-EE
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
You see my name in lights everywhere...


to the email address above)



Sun, 26 Nov 2000 03:00:00 GMT  
 Fade to Black

Does anybody have any information whatsoever on fading in? I'm thinking
about how to implement such a thing. Perhaps create some form of screen
invisible to the viewer, use the pixel values, and fade into those?
Please, I would appreciate any help or ideas in existence. Thank you
VERY much.

Sincerely,
Vincent J. Florio



Sun, 26 Nov 2000 03:00:00 GMT  
 Fade to Black

Wed, 10 Jun 1998 13:30:09 -0400 - Countdown commences in comp.lang.basic.misc.
Vincent Florio launched the following into space:

Quote:
> Does anybody have any information whatsoever on fading in? I'm thinking
> about how to implement such a thing. Perhaps create some form of screen
> invisible to the viewer, use the pixel values, and fade into those?
> Please, I would appreciate any help or ideas in existence. Thank you
> VERY much.

Just do fade to black, only backwards. Obviously :)  So, you'd read the palette
info, then set the palette to black, draw your screen (which will now be
invisible), then increment the palette slowly to what it was originally, or
whatever you want it to be, in fact.

-EE
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
You see my name in lights everywhere...


to the email address above)



Mon, 27 Nov 2000 03:00:00 GMT  
 Fade to Black

I am not as stupid as I sound, Mr. Warren.....At least I hope not....I
think I was just trying to figure out drawing invisibly?

Sincerely,
Vincent J. Florio



Tue, 28 Nov 2000 03:00:00 GMT  
 Fade to Black

It was Fri, 12 Jun 1998 14:21:15 -0400, and in front of the crowd at
comp.lang.basic.misc, Vincent Florio staggered up to the Chief Commander and
spilt the following into his trousers:

Quote:
> I am not as stupid as I sound, Mr. Warren.....

Sorry if I sounded patronising! :)

Quote:
> At least I hope not....I
> think I was just trying to figure out drawing invisibly?

Yup, as I said, if you set the palette so every attribute is black, the user
won't see anything being drawn on the screen. Just use:

FOR I=0 TO 255
OUT &H3C8,I
OUT &H3C9,I
OUT &H3C9,I
OUT &H3C9,I
NEXT I

Then draw your stuff on the screen and fade in.

-EE
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
You see my name in lights everywhere...


to the email address above)



Wed, 29 Nov 2000 03:00:00 GMT  
 Fade to Black


Quote:
>FOR I=0 TO 255
>OUT &H3C8,I
>OUT &H3C9,I
>OUT &H3C9,I
>OUT &H3C9,I
>NEXT I

Hey Alex, how does this work? I usually use the PALETTE command, I'm
sure this is quicker.

Cheers,

Ali



Wed, 29 Nov 2000 03:00:00 GMT  
 Fade to Black

Oh, no, you didn't sound patronizing at all! I was asking forgiveness
for coming off sounding dim-witted. The way I phrased the question made
it sound like I knew less than I actually do.

Sincerely,
Vincent J. Florio



Wed, 29 Nov 2000 03:00:00 GMT  
 Fade to Black


Quote:
(Vincent Florio) writes:


writes:

Quote:
>> Does anybody have any information whatsoever on fading in?
<snip>
>>Just do fade to black, only backwards. Obviously :)  So, you'd read
>>the palette info, then set the palette to black, draw your screen
>>(which will now be invisible), then increment the palette slowly to
>>what it was originally, or whatever you want it to be, in fact.
>I am not as stupid as I sound, Mr. Warren.....At least I hope not....I
>think I was just trying to figure out drawing invisibly?

I don't think Alex was saying you are stupid and he gave a correct
answer to your post - read pallete, set pallete to black, draw screen,
reset palette to original colours.

Here's some code to fade out, I'm sure you can figure out how to
do a fade in  :)

Quote:
>================= cut here

SCREEN 13

FOR i = 0 TO 255
LINE (i, y)-(i, y + 200), i
NEXT
SLEEP 1

'get palette
DIM pal(255, 3)
FOR i = 0 TO 255
OUT &H3C7, i 'attribute
pal(i, 1) = INP(&H3C9)  'red
pal(i, 2) = INP(&H3C9)  'green
pal(i, 3) = INP(&H3C9)  'blue
NEXT

'fade out
DO
FOR i = 0 TO 255
IF pal(i, 1) > 0 THEN pal(i, 1) = pal(i, 1) - 1
IF pal(i, 2) > 0 THEN pal(i, 2) = pal(i, 2) - 1
IF pal(i, 3) > 0 THEN pal(i, 3) = pal(i, 3) - 1
OUT &H3C8, i
OUT &H3C9, pal(i, 1)
OUT &H3C9, pal(i, 2)
OUT &H3C9, pal(i, 3)
NEXT
WAIT &H3DA, 8
LOOP UNTIL INKEY$ > ""

SCREEN 0
WIDTH 80



Thu, 30 Nov 2000 03:00:00 GMT  
 Fade to Black

It was Sat, 13 Jun 1998 22:18:04 +0100, and in front of the crowd at
comp.lang.basic.misc, Ali Afshar staggered up to the Chief Commander and spilt
the following into his trousers:

Quote:
> >FOR I=0 TO 255
> >OUT &H3C8,I
> >OUT &H3C9,I
> >OUT &H3C9,I
> >OUT &H3C9,I
> >NEXT I

> Hey Alex, how does this work? I usually use the PALETTE command, I'm
> sure this is quicker.

The OUT statements send information to ports, and in the example above they send
info to the graphics card (I think). The first OUT statement sends the attribute
number and the next three send the red, green and blue values respectively. I'm
not sure if it's any faster than the PALETTE command though, but I find the
above way easier as I don't have to do any maths to send r/g/b values (but I do
need to remember silly hex numbers like &H3C8 :(  )

-EE
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
You see my name in lights everywhere...


to the email address above)



Thu, 30 Nov 2000 03:00:00 GMT  
 Fade to Black

It was Sat, 13 Jun 1998 22:34:03 -0400, and in front of the crowd at
comp.lang.basic.misc, Vincent Florio staggered up to the Chief Commander and
spilt the following into his trousers:

Quote:
> Oh, no, you didn't sound patronizing at all! I was asking forgiveness
> for coming off sounding dim-witted.

Ah, I thought you were complaining at me! "I am not as stupid as I sound, Mr
Warren" kinda sounded like you were having a moan.... :)

Quote:
> The way I phrased the question made
> it sound like I knew less than I actually do.

Well, did I manage to answer the question in the end?

-EE
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
You see my name in lights everywhere...


to the email address above)



Thu, 30 Nov 2000 03:00:00 GMT  
 Fade to Black


Quote:
>It was Sat, 13 Jun 1998 22:18:04 +0100, and in front of the crowd at
>comp.lang.basic.misc, Ali Afshar staggered up to the Chief Commander
and spilt
>the following into his trousers:

>> >FOR I=0 TO 255
>> >OUT &H3C8,I
>> >OUT &H3C9,I
>> >OUT &H3C9,I
>> >OUT &H3C9,I
>> >NEXT I

>> Hey Alex, how does this work? I usually use the PALETTE command,
I'm
>> sure this is quicker.

>The OUT statements send information to ports, and in the example
above they send
>info to the graphics card (I think). The first OUT statement sends
the attribute
>number and the next three send the red, green and blue values
respectively. I'm
>not sure if it's any faster than the PALETTE command though, but I
find the
>above way easier as I don't have to do any maths to send r/g/b values
(but I do
>need to remember silly hex numbers like &H3C8 :(  )

Thanks, I'll try it,

Cheers,

Ali



Thu, 30 Nov 2000 03:00:00 GMT  
 Fade to Black

Yeahm you answered it pin-point. Thanks. I was just reassuring you, in
case you had any misgivings =). No, I had no reason to complain and I
didn't mean to sound like I was venting.

Sincerely,
Vincent J. Florio



Thu, 30 Nov 2000 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Fade into black

2. Fade to Black?

3. Fade To black?

4. Help: Resized picture fades to black !!

5. HELP! Fade To Black...

6. Fading Blue to Black

7. Fading picture/image colors from black to color

8. Real Fade-in and Fade-out

9. Fade-in and Fade-out of button controls

10. Fade in and Fade out images???

11. Fade-in, Fade-out images???

12. Fade-in, Fade-out effect

 

 
Powered by phpBB® Forum Software