Display tags cloud from a specific category ID with a shortcode

I’ve finally found a working solution :

function tag_cloud_shortcode($atts) {

    extract(shortcode_atts(array(
        'cat' => ''
    ), $atts));

    $query_args = array( 'cat' => $atts, 'posts_per_page' => -1 );
    $custom_query = new WP_Query( $query_args );
    if ($custom_query->have_posts()) :
        while ($custom_query->have_posts()) : $custom_query->the_post();
            $posttags = get_the_tags();
            if ($posttags) {
                foreach($posttags as $tag) {
                    $all_tags[] = $tag->term_id;
                }
            }
        endwhile;
    endif;

    $tags_arr = array_unique($all_tags);
    $tags_str = implode(",", $tags_arr);

    $args = array(
    'echo'      => false,
    'smallest'  => 10,
    'largest'   => 10,
    'unit'      => 'px',
    'number'    => 0,
    'format'    => 'flat',
    'order'     => 'count',
    'include'   => $tags_str
    );
    return wp_tag_cloud($args);
}
add_shortcode( 'tagscloud', 'tag_cloud_shortcode' );

Now I can use this shortcode with multiple category ID

[tagscloud cat=3,5]

Thanks to Jon Yablonski’s post, Nate Beers’s answer and code.tutsplus.com