in lowp vec2 tc;
in lowp float selected;
out vec4 fragColor;
in float velocity;
uniform float velocityAmt;
in lowp float alpha;
//											 uniform lowp vec2 pixelsPerCell;
in lowp float aspectRatio;
in lowp float chance;

void main() {
	// initial colour
	vec3 col			 = vec3(0.996f, 0.18f, 0.353f);
	const vec3 chanceCol = vec3(0.f, 0.835f, 1.f);
	// brighten for selected
	col	   = col + vec3(selected * 0.1);
	vec2 d = abs(vec2(0.5f) - tc);
	col += vec3(0.3f + selected * 0.2f) * step(0.5, max(d.x, d.y));

	// col.r *=  velocity * (1.f - velocityAmt) + (velocity + (1.f - velocity) * step(1.f - tc.y, velocity))*velocityAmt;
	// tint for velocity
	col.r *= velocity + velocityAmt * (1.f - velocity) * step(1.f - tc.y, velocity);
	fragColor.rgb = col;
	fragColor.a	  = 0.71f * alpha;

	// this will be the chance
	// decide whether chance is on
	float chanceIsOn = step(chance, 0.99f);
	float wing		 = 1.f - step((1.f - tc.x) * aspectRatio + tc.y, 0.2f);
	fragColor.rgb	 = mix(chanceCol * chance, fragColor.rgb, max(1.0 - chanceIsOn, wing)); //wing;
}