SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/03/2013, 01:26 AM   #1
Glad2BeHere
Gangsta
 
Glad2BeHere's Avatar
 
Join Date: Oct 2012
Posts: 771
Reputation: 136
Default Fading Colors

Is There a way to get a color code 4 3 like Red White Blue...... and the color code fades so likeeee its red and then the color white fades in to the blue..... u know ......
Glad2BeHere is offline   Reply With Quote
Old 23/03/2013, 01:35 AM   #2
HurtLocker
Gangsta
 
HurtLocker's Avatar
 
Join Date: Dec 2012
Location: Hellas, Thessaloniki
Posts: 570
Reputation: 29
Default Re: Fading Colors

Reading your post I think you want a smooth, gradual transition from color1 to color2. Well, I tried to make transition from white to red but in the end I get an undescribeable constant mix of all colors, don't try this at home:
pawn Code:
#define COLOR_LIGHTPINK 0xFFB6C1FF
#define COLOR_HOTPINK 0xFF69B4FF
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_TOMATO 0xFF6347AA
#define COLOR_RED 0xFF0000FF

public OnPlayerDeath(playerid, killerid, reason)
{
    FadePlayerScreen(playerid, 0xFFFFFFCC, 6, 192);
    FadePlayerScreen(playerid, 0xFFB6C1FF, 6, 192);
    FadePlayerScreen(playerid, 0xFF69B4FF, 6, 192);
    FadePlayerScreen(playerid, 0xFF7F50AA, 6, 192);
    FadePlayerScreen(playerid, 0xFF0000FF, 6, 192);
}

Last edited by HurtLocker; 23/03/2013 at 02:15 AM.
HurtLocker is offline   Reply With Quote
Old 23/03/2013, 02:39 AM   #3
faff
Gangsta
 
Join Date: Mar 2012
Location: Belgium
Posts: 762
Reputation: 16
Default Re: Fading Colors

Hmm.. Something like this?
pawn Code:
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E

SendNearbyMessage(playerid, 3.0, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
__________________
Code:
faff is offline   Reply With Quote
Old 23/03/2013, 02:40 AM   #4
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,846
Reputation: 251
Default Re: Fading Colors

colors range from 0 upto 255. those 256 different color tones (per channel) can be split into neat fragments by dividing them by 2, 3, 4, or 5. a transition from 0 to 255, split into 3 steps, or 4 colors (starting at 00=bblack), can be done by incremental inserting values:
Code:
0,255
0,127,255
0,85,170,255
0,63,127,191,255
0,51,102,153,204,255
for 2 to 6 colors accordingly. btw, you may wabt to write/combine the color values as hexadecimal:
Code:
0x 00,ff
0x 00,7f,ff
0x 00,55,aa,ff
0x 00,3f,7f,bf,ff
0x 00,33,66,99,cc,ff
...so to make a transition red>white, leave the red channel at 0xff, and increase green+blue - here with 6 colors:
Code:
0xff0000
0xff3333
0xff6666
0xff9999
0xffcccc
0xffffff
...and now white>blue:
Code:
0xffffff
0xccccff
0x9999ff
0x6666ff
0x3333ff
0x0000ff
so the whole array of colors could be initialized as:
pawn Code:
new RedWhiteBlue[]={0xff0000,0xff3333,0xff6666,0xff9999,0xffcccc,0xffffff,0xffffff,0xccccff,0x9999ff,0x6666ff,0x3333ff,0x0000ff};
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Old 23/03/2013, 03:02 AM   #5
Glad2BeHere
Gangsta
 
Glad2BeHere's Avatar
 
Join Date: Oct 2012
Posts: 771
Reputation: 136
Default Re: Fading Colors

pawn Code:
SendClientMessage(playerid, RedWhiteBlue[1], "hi");
That gives me green alone.... i wonder if i should strcat it or something any advice ?
Glad2BeHere is offline   Reply With Quote
Old 23/03/2013, 05:22 PM   #6
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,846
Reputation: 251
Default Re: Fading Colors

oops, i forgot to mention that you need to add the alpha values ><
long story short: add a 00 to each color value, like 0xff3333 becomes 0xff333300.
the color array from above again:
pawn Code:
new RedWhiteBlue[]={0xff000000,0xff333300,0xff666600,0xff999900,0xffcccc00,0xffffff00,0xffffff00,0xccccff00,0x9999ff00,0x6666ff00,0x3333ff00,0x0000ff00};
the format is RRGGBBAA, the added 2 digits "00" left-shift the value, so the color channels are ok now ^^
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Screen Fading 2KY Tutorials 20 10/11/2012 01:51 AM
Fading screen on /enter and /exit. Syntax Scripting Help 1 09/08/2012 12:56 PM
How to do a fading textdraw? PCheriyan007 Help Archive 5 10/06/2011 07:19 PM
Help With Fading a Textdraw RyDeR` Help Archive 4 30/06/2009 07:50 PM


All times are GMT. The time now is 09:10 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.