Quotes help make search much faster. Example: "Practice Makes Perfect"

Friday, November 16, 2012

Codecademy: "Create the Draw Sequence"


//sample solution to ui.js

// Skip down to drawSequence (or use ctrl-f), you shouldn't
// have to change anything in this part.
function drawHead () {
  $('.draw-area').append( $('<div/>').addClass("body-part head") );
}
function drawTorso () {
  $('.draw-area').append(
      $('<div/>').addClass("body-part armbox").append(
          $('<div/>').addClass("body-part torso")));
  $('.draw-area').append(
      $('<div/>').addClass("body-part legbox").append(
          $('<div/>').addClass("body-part pelvis")));
}
function drawLeftArm () {
 $('.armbox').prepend( $('<div/>').addClass("body-part leftarm") );
}
function drawRightArm () {
 $('.armbox').prepend( $('<div/>').addClass("body-part rightarm") );  
}
function drawLeftLeg () {
 $('.legbox').prepend( $('<div/>').addClass("body-part leftleg") );  
}
function drawRightLeg() {
 $('.legbox').prepend( $('<div/>').addClass("body-part rightleg") );  
}

/////
// START HERE (And use this variable)!
/////
var drawSequence = [drawHead(), drawTorso(), drawLeftArm(), drawRightArm(), drawLeftLeg(), drawRightLeg()];



/// You shouldn't have to change anything after this part:
for ( var i=0; i < drawSequence.length; i++ ){
    drawSequence[i]();
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts