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

              
                <html>

  

<head>
<meta name="description" content="CROCKYfinal saved to code pen">
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>

</head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.1/TweenMax.min.js"></script>
<body>
  
  
  
  
 
  
  
  
  
  
  
  
  <svg id="one" width="1000" height='600'>
    <image width="1600"   y="-200"  xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/tropical-river.png"  /> 
 <g id="croc" >   
<image width="500" x="50" y="50" xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/crokyUp.png"/>
<image width="500" x="50" y="50" xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/crokyDown.png" /></g>
    <text id="btn1" x="10" y="50" cursor="pointer" >NEXT</text>
    <text id="txt1" x="100" y="530">Crocky is very hungry today!</text>    
 </svg>
  
  
  <svg id="two" width="1000" height="600">
    
    <rect width="1000" height='290' style="fill:skyblue"/>
     <image width="1600"   y="-200"  xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/tropical-river.png"  />
  <image width="300" x="150" y="250" xlink:href=" http://www.changunn.com/blog/wp-content/uploads/2018/08/boat-w-people.png" />
   
    <text id="btn2" x="10" y="50" cursor="pointer">NEXT</text>
    <text id="txt2" x="100" y="530">Kids want to have fun with their boat in the river...</text>    
 </svg>
  
  
  
  
  <svg id="three" width="1000" height="600">
  <image width="1600"   y="-200"  xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/tropical-river.png"  /> 
 <image id="imCh" width="250" x="20" y="300" xlink:href=" http://www.changunn.com/blog/wp-content/uploads/2018/08/boat-w-people.png" />
   <g id='cro2'>
   <image id="croUp" width="500" x="0" y="0" xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/crokyUp.png"/>
<image id="croDown" width="500" x="0" y="0" xlink:href="http://www.changunn.com/blog/wp-content/uploads/2018/08/crokyDown.png" /></g> 
    <text id="helloCro" x="20" y="100">Look, its Crocky! Let's see if he has cleened his teeth!</text>
    <rect class="btn" x="87" y="135" width="100" height="40"/>
    <rect class="btn" x="87" y="207" width="100" height="40"/>
    <text class="answer" id="yes" x="100"  y="170" cursor="pointer">Yes!</text>
    <text class="answer" id="no" x="100"  y="240"cursor="pointer" >No!</text>
   <text x="20" y="100" id="wellDone">Well Done my Friend!</text>

    <g id="gSave" style="visibility:hidden">
     <text id="saveThem" x="20" y="100">Ooops! They are in danger. Save them???</text>
    <rect class="btn2" x="87" y="135" width="100" height="40"/>
    <rect class="btn2" x="87" y="207" width="100" height="40"/>
    <text class="answer" id="yes2" x="100"  y="170" cursor="pointer">Yes!</text>
      <text class="answer" id="no2" x="100"  y="240"cursor="pointer" >No!</text></g>
    <text x="20" y="100" id="mayHis">May their memory live forever...</text>
 </svg>
  
  <div>Click NEXT  then click yes or no!</div>
  </body>
</html>
              
            
!

CSS

              
                #one {
  background-color:indigo;
}

#two {
  background-color:blue;
}

#three {
  background-color:gray;
}

div{
  width:84%;
  padding-left:40px;
  font-size:40px;
  color:navy;
  background-color:lime
}




text {
  fill:white;
  font-size:40px
  
}

.answer {
  fill:red;
  font-weight: bold;
}

rect.btn{
  fill:yellow
}

rect.btn2{
  fill:yellow
}

#wellDone{
  visibility:hidden;
  font-size:50px;
  fill:skyblue;
}

#mayHis {
   visibility:hidden;
  font-size:50px;
  fill:skyblue;
}




              
            
!

JS

              
                $(document).ready(function(){

  //first page
croc=$("#croc");//select <g>with cro up and down firs scene
cro2=  $("#cro2");//select <g>with cro up and down 2nd scene
croUp=$("#croUp");
boat=$("#imCh"); 
yesBtn=$("#yes");
noBtn=$("#no");
$("#one").show();
$("#two").hide();
$("#three").hide();  
tlCroc=new TimelineMax();
tlCroc.set(croc,{transformOrigin:'50% 50%',x:"50%",y:'50%'});

$("#btn1").on("click",function(){
  $("#one").hide();
$("#two").show();
 $("#three").hide();
});

//second page

$("#btn2").on("click",function(){
  $("#one").hide();
$("#two").hide();
 $("#three").show();
});

//third page

tlCro2 = new TimelineMax();
tlCro2.set(cro2,{x:570,y:300,scale:'0.9'});

tlBoat = new TimelineMax();
$("#no").on("click",noCro)
function noCro(){
tlCro2.to(croUp,2,{transformOrigin:'80% 30%',rotation:40})
       .to(croUp,2,{transformOrigin:'80% 30%',rotation:0});
tlBoat.add("mouth")
tlBoat.to(boat,2,{transformOrigin:'10% 80%',rotation:-20},"mouth+=1.2")
      .to(boat,2,{rotation:0})
};

$("#yes").on("click",yesCro);

function yesCro(){
  tlCro2.to(croUp,2,{transformOrigin:'80% 30%',rotation:40})
       .to(croUp,2,{transformOrigin:'80% 30%',rotation:0})
       .to(croUp,2,{transformOrigin:'80% 30%',rotation:40});
  tlBoat.to(boat,13,{x:580,ease:Quad.easeOut})
  .to($("#gSave"),0.01,{visibility:'visible'},'-=2')
        
  $("#helloCro").remove();
  $("#no").remove();
  $("#yes").remove();
  $(".btn").remove();
 };
  
  $("#yes2").on("click",saveThemAll);
  function saveThemAll(){
    $("#gSave").hide();
    tl=new TimelineMax();
    tl.to(boat,1,{x:0,ease:Elastic.easeOut})
      .to(croUp,0.1,{rotation:0},'-=1')
      .to($("#wellDone"),0.1,{visibility:'visible'});
  }

$("#no2").on("click",notSaveThemAll);
function notSaveThemAll(){
  $("#gSave").hide();
    tl=new TimelineMax();
    tl.to(boat,0.1,{autoAlpha:0})
      .to(croUp,0.1,{rotation:0},'-=0.1')
    .to($("#mayHis"),0.1,{visibility:'visible'},'+=0.5');
}




});


              
            
!
999px

Console