Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 fade out
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rollerdude




PostPosted: Thu May 03, 2007 8:42 am   Post subject: fade out

basically what i'm trying to do is make the screen appear to fade out. problam, is have an object that isn't white, so simply telling it to draw it the color of one of the pre-define colors that previous to the one its at now won't work so.. heres my code, i want the box to disappear.

code:

var newcolor : int := 255
RGB.SetColor (newcolor, 0, 0, 17)
proc fadeout
    for decreasing i : 31 .. 16
        drawfillbox (0, 0, maxx, maxy, i)
        newcolor -= RGB.AddColor (0, 0, 2)
        drawfillbox (330, 11, 350, 199, newcolor)
        drawfillbox (330, 199, 350, 179, i)
        delay (100)
    end for
end fadeout
fadeout
Sponsor
Sponsor
Sponsor
sponsor
rollerdude




PostPosted: Thu May 03, 2007 8:44 am   Post subject: Re: fade out

grrr... *smacks himself in forhead* i have some wrong code there

newcolor -= RGB.AddColor (0, 0, 2)

is supposed to be

newcolor -= RGB.AddColor (0, 0, i-17)

so... its not working... any help would be nice...
Drakain Zeil




PostPosted: Thu May 03, 2007 3:03 pm   Post subject: RE:fade out

I haven't used turing in years, but all I can think of is that using max_ and 0 drawn part of the box offscreen, try using 1 insetad of 0.
rollerdude




PostPosted: Fri May 25, 2007 10:17 am   Post subject: Re: fade out

new algorithym...still not working,maybe this ones a bit better?

code:

var x, y, clr : int
for i : 1 .. maxx
    for j : 1 .. maxy
        x := Rand.Int (1, maxx)
        y := Rand.Int (1, maxy)
        clr := Rand.Int (1, 255)
        drawdot (x, y, clr)
    end for
end for
delay (1000)
for i : 1 .. maxx
    for j : 1 .. maxy
        var coloratplace : int := whatdotcolor (i, j)
        var redc, greenc, bluec : real
        var newr, newg, newb : real
        RGB.GetColor (coloratplace, redc, greenc, bluec)
        if redc not= 0 then
            newr := redc - 1
        else
            newr := redc
        end if
        if bluec not= 0 then
            newb := bluec - 1
        else
            newb := bluec
        end if
        if greenc not= 0 then
            newg := greenc - 1
        else
            newg := greenc
        end if
        coloratplace := RGB.AddColor (newr, newg, newb)
        drawdot (i, j, coloratplace)
    end for
end for
Cervantes




PostPosted: Fri May 25, 2007 4:53 pm   Post subject: RE:fade out

If you want to fade the entire screen out, you won't be able to just cycle through the colours in the standard pallete that they give you. Instead, you're probably going to have to whatdotcolour each pixel, then use the RGB module to get the RGB components of that colour, then modify them all by a bit (subtract a constant from each of them, but make sure that constant is scaled for each of them so that you reach black all at once), then draw that new coloured pixel there, then move to the next pixel. This will probably be very slow, but I can't really think of any other way to do it.

Also note that whatdotcolour matches to the current colour palette, so if you modify it, then whatdotcolour will produce different results.
DIIST




PostPosted: Sun May 27, 2007 9:08 am   Post subject: Re: fade out

look into takepic and drawpic. I know for sure you can create a realistic fade effect by just decreasing the r,g,b values in the buffer by 1 and displaying the picture each time. Im not much of a pro with takepic and drawpic, but if you have any question, you should probably ask someone like zylum, hes pretty good at this stuff! Wink
rollerdude




PostPosted: Mon May 28, 2007 8:08 am   Post subject: Re: fade out

thnx... i'll pm zylum, but thats what i was doing with my second code, but as it went through the screen, everthing that was white, it turned black, and everything thas wasn't white, it turned white, so....
Tallguy




PostPosted: Mon May 28, 2007 8:16 am   Post subject: RE:fade out

cool, really hard
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue May 29, 2007 3:44 pm   Post subject: RE:fade out

In the shoutbox, you said you still needed help here. What is there left to help you with? I gave you one option and thuvs gave you another option (assuming you've got Turing 4.1).

You said something kinda incomprehensible about white turning into black and white turning white... We can't debug your code if you don't give us the code, and we can't tell you what's wrong if all you give us is a vague and muffled description of your problem.
rollerdude




PostPosted: Wed May 30, 2007 1:00 pm   Post subject: Re: fade out

i still need help because my code is not working...

the rgb routine is truning everthing thats not white, white, and everything thats was white, black...


so....
Cervantes




PostPosted: Wed May 30, 2007 6:46 pm   Post subject: RE:fade out

So....

So you expect me to fix your code? How am I supposed to do that if I can't see it? I'm not telepathic.

So you expect me to tell you what's wrong with your code and how you should fix it? I can't do that if you don't give me a clearer description of your problem.

How strange--it feels like I made essentially this exact same post already.
DIIST




PostPosted: Wed May 30, 2007 7:32 pm   Post subject: Re: RE:fade out

Cervantes @ Wed May 30, 2007 6:46 pm wrote:

How strange--it feels like I made essentially this exact same post already.
DeJaVu...
Feel the same way over here. RollerDude you might want to post your code if you want our help. We cant always play mind games, regardless of how we are good at it. I guessing your using RGB.SetColor in your code. If you are, then you need to be aware that changing that standard pallet will effect turing drawn object, changing there color as well. If you have turing 4.05 then just picscreen and do the fade effect which is included in that version.
rollerdude




PostPosted: Thu May 31, 2007 9:27 am   Post subject: Re: fade out

*smacks his head*... its the second code i posted.. i think its the third reply...

that code isn't working

does this help?

you dont have to be telepathic to scroll up...

*sigh*.. i guess ill post it again

i said...

new algorithym...still not working,maybe this ones a bit better?


code:

var x, y, clr : int
for i : 1 .. maxx
    for j : 1 .. maxy
        x := Rand.Int (1, maxx)
        y := Rand.Int (1, maxy)
        clr := Rand.Int (1, 255)
        drawdot (x, y, clr)
    end for
end for
delay (1000)
for i : 1 .. maxx
    for j : 1 .. maxy
        var coloratplace : int := whatdotcolor (i, j)
        var redc, greenc, bluec : real
        var newr, newg, newb : real
        RGB.GetColor (coloratplace, redc, greenc, bluec)
        if redc not= 0 then
            newr := redc - 1
        else
            newr := redc
        end if
        if bluec not= 0 then
            newb := bluec - 1
        else
            newb := bluec
        end if
        if greenc not= 0 then
            newg := greenc - 1
        else
            newg := greenc
        end if
        coloratplace := RGB.AddColor (newr, newg, newb)
        drawdot (i, j, coloratplace)
    end for
end for
Cervantes




PostPosted: Thu May 31, 2007 9:58 pm   Post subject: RE:fade out

Yeah, if you read the documentation for anything in the RGB module, you'll find that the red green and blue components are real numbers between 0 and 1. So when you subtract 1 from each component, you're doing a heck of a colour shift.

If you want an approach that works, you'll have to do a little bit of algebra.
DIIST




PostPosted: Thu May 31, 2007 10:26 pm   Post subject: Re: RE:fade out

Cervantes @ Thu May 31, 2007 9:58 pm wrote:
If you want an approach that works, you'll have to do a little bit of algebra.
Ive done it two ways. You can either decrease the r,g,b component as real values by 1/255 or you can try to preserve the r,g,b, ratio and try to decrease them all at once by decreasing one and decreasing the others with respect to the original ratio. The second method is what they do in real life, but the first one is a quick way to do it. The second method however looks a bit nicer and would provide the same effect as if you are using the yuv color space and just decreasing the luminance component. Wink
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: