Auto slideshow for my post slider in php

Hi I have this php code for creating a slider with my posts, I want it to auto slideshow for atleast 2 secs intervals or so. below is the code I manage to have but it is not automatically moving to next slide.

<?php
        $slider_query = array(
        'post_type' => 'slider',
        'posts_per_page' => -1);

        $slider_posts = new WP_Query( $slider_query );
        if ($slider_posts->have_posts()):
        while ( $slider_posts->have_posts() ) : $slider_posts->the_post();
?>

//my html code for slider images and text here //

<?php
        endwhile;
        endif;
         wp_reset_postdata();
?>

Hope someone can help me.