How to create a control for css opacity in the Customizer

There is no such value of 'type' parameter in add_control() function. See the documentation.

What you can do is create a control e.x.:

$wp_customize->add_control(
   'my_control', 
    array(
        'label'    => __( 'Opacity Control', 'mytheme' ),
        'section'  => 'my_section',
        'settings' => 'my_setting',
        'type'     => 'text',
    )
);

And then in file which you have <head> tag in (I suppose it’s header.php file) add following code:

<head>
  <style>
    *{
      opacity: <?php echo get_theme_mod( 'my_control', '0' ); ?>
    }
  </style>
</head>

Now when you change value of the control, your opacity will change too and you should see the result. Note that value of your theme option must be in range from 0 to 1 so you have keep it in mind. I hope that’s what you are looking for.