duckengine
Version:
A 2D Game Engine for the web.
14 lines (12 loc) • 407 B
text/typescript
import { Duck } from '../../index';
import randomFloat from '../../core/math/randomFloat';
import convertColorToRGBA from './convertColorToRGBA';
import randomColor from './randomColor';
export default function randomColorWithAlpha(
alpha?: Duck.Types.Helper.AlphaRange
) {
return convertColorToRGBA(
randomColor(),
alpha || (randomFloat(0.1, 0.9) as Duck.Types.Helper.AlphaRange)
);
}