-
Color - radial gradient tint?
Hi!
I have a function for setting a background radial-gradient color. The function takes a color as a parameter.
It's working fine, but instead of using white as the "radial gradient" color - I want to have a "whiter/tinted" version of the color that comes as a parameter.
Let's say we send dark-red to the function, then I want a light-red "radial gradient" color.
Do I need to use a ColorTransform or?
Here is the function:
Code:
public function setRadialBgColor(color1:uint, xPos:Number, yPos:Number):void{
var colors:Array = [0xffffff, color1]; //instead of 0xffffff ??????
var alphas:Array = [1, 1];
var ratios:Array = [0, 0xFF];
var matrix:Matrix = new Matrix();
matrix.createGradientBox(600, 600, (3 * Math.PI / 2));
matrix.tx = xPos;
matrix.ty = yPos;
var focalPoint:Number = 0.5;
with (bgSprite.graphics){
clear();
beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, focalPoint);
drawRect(0, 0, Main.maxRight, Main.maxBottom);
endFill;
}
}
It's probably easy to solve this, but I tried to google but havent found any helpful topics.
-- thanks in advance
/s-fish
-
Maybe you can adapt this to work for you...
Code:
import fl.motion.*;
function setRadialBgColor(color1:uint, xPos:Number, yPos:Number):void {
var color2:Color = new Color();
color2.tintColor = color1;
color2.tintMultiplier = 0.3;
var colors:Array = [color1,color2];
var alphas:Array = [1,1];
var ratios:Array = [0,0xFF];
var matrix:Matrix = new Matrix();
matrix.createGradientBox(600, 600, (3 * Math.PI / 2));
matrix.tx = xPos;
matrix.ty = yPos;
var focalPoint:Number = 0.5;
with (bgSprite.graphics) {
clear();
beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix, SpreadMethod.PAD, InterpolationMethod.RGB, focalPoint);
//drawRect(0, 0, Main.maxRight, Main.maxBottom);
drawRect(0,0,600,600);
endFill;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|