#define FADE_COLOR_1 0xFFFF00FF // Colors to fade #define FADE_COLOR_2 0xFF00FFFF #define MAX_FADE_DRAWS 10 // Number of TextDraws // When creating: new r1, g1, b1, r2, g2, b2; r1 = (FADE_COLOR_1 >> 24) & 255; // Get R,G,B from COLOR_1 g1 = (FADE_COLOR_1 >> 16) & 255; b1 = (FADE_COLOR_1 >> 8) & 255; r2 = (FADE_COLOR_2 >> 24) & 255; // Get R,G,B from COLOR_2 g2 = (FADE_COLOR_2 >> 16) & 255; b2 = (FADE_COLOR_2 >> 8) & 255; new delta_r = (r2 - r1) / MAX_FADE_DRAWS, // Delta R,G,B (for every step, this is the color that we add to COLOR_1) delta_g = (g2 - g1) / MAX_FADE_DRAWS, delta_b = (b2 - b1) / MAX_FADE_DRAWS; for(new i = 0; i < MAX_FADE_DRAWS; i ++) { new rgba = 0x000000FF + ((r1 + delta_r*i) * 256 * 256 * 256) + ((g1 + delta_g*i) * 256 * 256) + ((b1 + delta_b*i) * 256); // Calculate HEX Color (including Alpha!) new Text:FadeText = TextDrawCreate(640.0 / MAX_FADE_DRAWS * i, 400.0, "..."); // Make this a TextDraw Sprite and save the IDs in an Array to be able to show them later TextDrawColor(FadeText, rgba); }
Those are lots of small textdraws next to each other (best use Sprites for precise squares).
The gradient can easily be calculated by taking Color 1 RGB values and Color 2 RBG values (ignore transparency) and then fade them from COLOR_1 to COLOR_2. Код:
#define FADE_COLOR_1 0xFFFF00FF // Colors to fade #define FADE_COLOR_2 0xFF00FFFF #define MAX_FADE_DRAWS 10 // Number of TextDraws // When creating: new r1, g1, b1, r2, g2, b2; r1 = (FADE_COLOR_1 >> 24) & 255; // Get R,G,B from COLOR_1 g1 = (FADE_COLOR_1 >> 16) & 255; b1 = (FADE_COLOR_1 >> 8) & 255; r2 = (FADE_COLOR_2 >> 24) & 255; // Get R,G,B from COLOR_2 g2 = (FADE_COLOR_2 >> 16) & 255; b2 = (FADE_COLOR_2 >> 8) & 255; new delta_r = (r2 - r1) / MAX_FADE_DRAWS, // Delta R,G,B (for every step, this is the color that we add to COLOR_1) delta_g = (g2 - g1) / MAX_FADE_DRAWS, delta_b = (b2 - b1) / MAX_FADE_DRAWS; for(new i = 0; i < MAX_FADE_DRAWS; i ++) { new rgba = 0x000000FF + ((r1 + delta_r*i) * 256 * 256 * 256) + ((g1 + delta_g*i) * 256 * 256) + ((b1 + delta_b*i) * 256); // Calculate HEX Color (including Alpha!) new Text:FadeText = TextDrawCreate(640.0 / MAX_FADE_DRAWS * i, 400.0, "..."); // Make this a TextDraw Sprite and save the IDs in an Array to be able to show them later TextDrawColor(FadeText, rgba); } |
Those are lots of small textdraws next to each other (best use Sprites for precise squares).
The gradient can easily be calculated by taking Color 1 RGB values and Color 2 RBG values (ignore transparency) and then fade them from COLOR_1 to COLOR_2. Код:
#define FADE_COLOR_1 0xFFFF00FF // Colors to fade #define FADE_COLOR_2 0xFF00FFFF #define MAX_FADE_DRAWS 10 // Number of TextDraws // When creating: new r1, g1, b1, r2, g2, b2; r1 = (FADE_COLOR_1 >> 24) & 255; // Get R,G,B from COLOR_1 g1 = (FADE_COLOR_1 >> 16) & 255; b1 = (FADE_COLOR_1 >> 8) & 255; r2 = (FADE_COLOR_2 >> 24) & 255; // Get R,G,B from COLOR_2 g2 = (FADE_COLOR_2 >> 16) & 255; b2 = (FADE_COLOR_2 >> 8) & 255; new delta_r = (r2 - r1) / MAX_FADE_DRAWS, // Delta R,G,B (for every step, this is the color that we add to COLOR_1) delta_g = (g2 - g1) / MAX_FADE_DRAWS, delta_b = (b2 - b1) / MAX_FADE_DRAWS; for(new i = 0; i < MAX_FADE_DRAWS; i ++) { new rgba = 0x000000FF + ((r1 + delta_r*i) * 256 * 256 * 256) + ((g1 + delta_g*i) * 256 * 256) + ((b1 + delta_b*i) * 256); // Calculate HEX Color (including Alpha!) new Text:FadeText = TextDrawCreate(640.0 / MAX_FADE_DRAWS * i, 400.0, "..."); // Make this a TextDraw Sprite and save the IDs in an Array to be able to show them later TextDrawColor(FadeText, rgba); } |