Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
<div class="characters">
	
<div id="character_1" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Alfred.png" alt="">
	<h1 class="name">Alfred</h1>
	<p class="description">This dude just woke up after pounding pre-prohibition cocktails.</p>
</div>
<div id="character_2" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Anita.png" alt="">
	<h1 class="name">Anita</h1>
	<p class="description">This Golden Girl looks ready to do an experiment by the Kinsey Institute.</p>
</div>
<div id="character_3" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Anne.png" alt="">
	<h1 class="name">Anne</h1>
	<p class="description">Nobody clips coupons better than this sassy mama.</p>
</div>
<div id="character_4" class="character character_visible">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Bernard.png" alt="">
	<h1 class="name">Bernard</h1>
	<p class="description">No one can rival his joy in finding someone his age at the porn theater.</p>
</div>
<div id="character_5" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Bill.png" alt="">
	<h1 class="name">Bill</h1>
	<p class="description">He’s got a profile pic of himself as a court jester at a local Renaissance fair.</p>
</div>
<div id="character_6" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Charles.png" alt="">
	<h1 class="name">Charles</h1>
	<p class="description">Just discovered the shower wall mount attachment for the Fleshlight.</p>
</div>
<div id="character_7" class="character character_visible">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Claire.png" alt="">
	<h1 class="name">Claire</h1>
	<p class="description">Her collection of hand-knitted sweaters are only rivaled by her cats.</p>
</div>
<div id="character_8" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/David.png" alt="">
	<h1 class="name">David</h1>
	<p class="description">He uses his music composition degree to make sick Cock Hero videos.</p>
</div>
<div id="character_9" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Eric.png" alt="">
	<h1 class="name">Eric</h1>
	<p class="description">His 15 minutes so fame came from cutting Styrofoam cups with his face.</p>
</div>
<div id="character_10" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Frans.png" alt="">
	<h1 class="name">Frans</h1>
	<p class="description">A nice guy but unable to look you in the eye when shaking your hand.</p>
</div>
<div id="character_11" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/George.png" alt="">
	<h1 class="name">George</h1>
	<p class="description">This Caddyshack villian just finished a cool 18 holes at the country club.</p>
</div>
<div id="character_12" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Herman.png" alt="">
	<h1 class="name">Herman</h1>
	<p class="description">He love alphabetizing deck registration sheets as much as he loves foils.</p>
</div>
<div id="character_13" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Joe.png" alt="">
	<h1 class="name">Joe</h1>
	<p class="description">Every year he reprises his role as Flattop in a local production of Dick Tracy.</p>
</div>
<div id="character_14" class="character character_visible">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Maria.png" alt="">
	<h1 class="name">Maria</h1>
	<p class="description">She corrects your grammar while wishing she was actually French.</p>
</div>
<div id="character_15" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Max.png" alt="">
	<h1 class="name">Max</h1>
	<p class="description">He’s short order cook, but on the weekend gives people cement shoes.</p>
</div>
<div id="character_16" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Paul.png" alt="">
	<h1 class="name">Paul</h1>
	<p class="description">If the Holiday Yule Log could be a person, it would be this pop-pop.</p>
</div>
<div id="character_17" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Peter.png" alt="">
	<h1 class="name">Peter</h1>
	<p class="description">The movie Shampoo with Warren Beatty was based on this guy’s life.</p>
</div>
<div id="character_18" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Phillip.png" alt="">
	<h1 class="name">Philip</h1>
	<p class="description">As a civil war reenactor, he takes on the prestigious role of Abe Lincoln.</p>
</div>
<div id="character_19" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Richard.png" alt="">
	<h1 class="name">Richard</h1>
	<p class="description">His knowledge is impressive, but the fact that he works at the cafe is sad.</p>
</div>
<div id="character_20" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Robert.png" alt="">
	<h1 class="name">Robert</h1>
	<p class="description">He just got done dropping his daughters off at soccer practice.</p>
</div>
<div id="character_21" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Sam.png" alt="">
	<h1 class="name">Sam</h1>
	<p class="description">He looks like Bernie Sanders because he is the disappearing middle class.</p>
</div>
<div id="character_22" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Susan.png" alt="">
	<h1 class="name">Susan</h1>
	<p class="description">She works the make-up counter at Macy’s, and loves Real Housewives.</p>
</div>
<div id="character_23" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Tom.png" alt="">
	<h1 class="name">Tom</h1>
	<p class="description">He has a secret cave in a field where he chills with Saorise Ronan.</p>
</div>
<div id="character_24" class="character">
	<img src="https://fullbellylaughs.com/uploads/landingpageimages/Alex.png" alt="">
	<h1 class="name">Alex</h1>
	<p class="description">A beacon of diversity on the board, Alex is arguably the only trans character.</p>
</div>
</div>
              
            
!

CSS

              
                body {
  background: #1d438c;
  display:block;
  text-align:center;
  color:white;
  width:100%;
}
.characters{
width: 100%;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: auto;
}
.character {

  width:100%;
  max-width:200px;
  background: #1d438c;
  display: block;

  
 
}
.character_visible:first-child{
  left:0;
}

.character_visible:nth-child(2){
  left:210px;
}
.character h1{
  color:#ba1019;
}

.character img{
  width: 200px;
  height:auto;

  display: block;
 
}
              
            
!

JS

              
                console.clear();
gsap.set('.character', {
  autoAlpha: 0, 
  scaleX:0,
  scaleY:0,
  width:"0px"
});

var initialcharacters= [];
var character_length=document.querySelectorAll('.character').length;
 while(initialcharacters.length < 5){
    
    var r = Math.floor(Math.random() * character_length) + 1;
    if(initialcharacters.indexOf(r) === -1) initialcharacters.push(r);
  var showCharacter="#character_"+r;
  gsap.fromTo(showCharacter, {
    autoAlpha: 0, 
  scaleX:0,
  scaleY:0,
    width:"0px"
  },{
    autoAlpha: 1, 
  scaleX:1,
  scaleY:1,
    width:"200px"
  });
    
    }

function loop() { 
    //I remove on character from the array
    let remove=initialcharacters.splice(Math.floor(Math.random()*initialcharacters.length), 1);
      var removeCharacter="#character_"+remove;
      console.log("remove "+removeCharacter);
  //then adding a new character
  var r = Math.floor(Math.random() * character_length) + 1;
    if(initialcharacters.indexOf(r) === -1) initialcharacters.push(r);
  var showCharacter="#character_"+r;
  console.log("add "+showCharacter);
  
  var tl = gsap.timeline();
  
  
 tl.fromTo(removeCharacter, {
  autoAlpha: 1, 
  scaleX:1,
  scaleY:1,
   width:"200px"
  },{
       autoAlpha: 0, 
  scaleX:0,
  scaleY:0,
 width:"0px"
  });

  tl.fromTo(showCharacter, {
    autoAlpha: 0,
  scaleX:0,
  scaleY:0,

    width:"0px"
  },{
    autoAlpha: 1, 
  scaleX:1,
  scaleY:1,
    
    width:"200px"
  },0);
    
  }

setInterval(function() {
loop(); 
}, 2500);

              
            
!
999px

Console