Transparency not working

Hi,

The transparency somehow isn’t working on my code, anything I have missed? -

App.h

class ofApp : public ofBaseApp{

public :

void setup();

void update();

void draw();

void keyPressed( int key);

void keyReleased( int key);

void mouseMoved( int x, int y );

void mouseDragged( int x, int y, int button);

void mousePressed( int x, int y, int button);

void mouseReleased( int x, int y, int button);

void mouseEntered( int x, int y);

void mouseExited( int x, int y);

void windowResized( int w, int h);

void dragEvent(ofDragInfo dragInfo);

void gotMessage(ofMessage msg);

bool random = false ;

float r;

float b;

float g;

int alpha = 40 ;

bool drawIsOn;

float angle;

float angleSpeed;

int shapelength;

int x;

int y;

bool MousePressed;

};

void ofApp::setup(){
ofNoFill();
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
angleSpeed = 0.5;
shapelength = 30;
ofEnableAlphaBlending();

}

//--------------------------------------------------------------
void ofApp::update(){

if (drawIsOn == true){
    angle = angle + angleSpeed;
}

}

//--------------------------------------------------------------
void ofApp::draw(){

if (random == true){
     r = ofRandom(255);
  g = ofRandom(255);
   b = ofRandom(255);
}



if (drawIsOn == true) {
ofSetColor(r,g,b);
ofTranslate(mouseX, mouseY);
ofRotate (angle);
ofLine (0, 0,shapelength, shapelength);

}

}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){

x = 63;
y = 2;
if (key == OF_KEY_DOWN)
{
    shapelength = shapelength - x;
}

else if (key == OF_KEY_UP)
{
    shapelength = shapelength + x;
}

if (key == OF_KEY_RIGHT){
    angleSpeed = angleSpeed + y;
}
else if (key == OF_KEY_LEFT){
    angleSpeed = angleSpeed - y;
}


if (key == 'r'){
    ofBackground(255);
}

if (key == 'y'){
    random = false;
    r = 0;
    g = 0;
    b = 255;
    ofSetColor(r,g,b);
}

if (key =='u'){
    random = true;
}
if (key == '1'){
    random == false;
    r = 82;
    g =178;
    b=242;
    ofSetColor (r,g,b,alpha);
}
if (key == '2'){
    random == false;
    r = 66;
    g =244;
    b=235;
    ofSetColor (r,g,b, alpha);
}
if (key == '3'){
    random == false;
    r = 244;
    g =199;
    b=65;
    ofSetColor (r,g,b, alpha);
}
if (key == '4'){
    random == false;
    r = 244;
    g =134;
    b=65;
    ofSetColor (r,g,b, alpha);
}
if (key == 's') {
    
    ofSaveScreen("savedScreenshot_"+ofGetTimestampString()+".png");
}

}

ofSetColor(r,g,b);

When you are setting the color, you are not setting the alpha channel. It should be something like ofSetColor(r,g,b, 40);