Skip to content

A lesson on variables, loops, if statements using the Khan Academy platform.

Notifications You must be signed in to change notification settings

CoderDojoGitHub/KhanAcademy-Animation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Khan Academy Animation

A lesson on variables, loops, if statements using the Khan Academy platform.

Get set up!

Go to Khan Academy's website:

https://www.khanacademy.org/cs

Click on new program

Drawing

Watch mentor demo the drawing commands

  • Play with lines and shapes
  • Play with size and positioning – drag it!

Code Reference

Note: capitalization matters! Semicolons too!

  • Draw a bezier curve

    bezier(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
    
  • Draw an ellipse

    ellipse(x, y, width, height);
    
  • Draw a line

    line(x1, y1, x2, y2);
    
  • Draw a point

    point(x, y);
    
  • Draw a rectangle

    rect(x, y, width, height);
    
  • Draw a triangle

    triangle(x1, y1, x2, y2, x3, y3);
    
  • Set the fill color for shapes

    fill(red, green, blue);
    
  • Turn off fill for shapes

    noFill();
    
  • Set outline color for shapes

    stroke(red, green, blue);
    
  • Turn off outlines for shapes

    noStroke();
    
  • Change the thickness of outline color

    strokeWeight(size);
    
  • Set a background color

    background(red, green, blue);
    
  • Store all 3 color components in one variable

    color(red, green, blue)
    

Play with overlapping of code to make some shapes come in front of each other

Challenge #1

Click here http://www.khanacademy.org/cs/drawing-demo-challenge-1-prompt/1541038466

Challenge is to make this look like http://www.khanacademy.org/cs/drawing-demo-challenge-1-solution/1541146483

Challenge #2

  • Make any character with shapes – Face, Eyes, Mouth.
  • Requirements – use three different shapes, use three different colors.
  • Color background

Examples

Hint: Use the documentation for help:

http://www.khanacademy.org/cs/docs

Introduction to Variables

http://www.khanacademy.org/cs/section-2-variables/1541110625

  • Names a Variable: var name = number
    • Change the size of eyes.
    • Change size of body
    • Change position

Challenge

Challenge

  • Randomize everything!

Other resources

Example: http://www.khanacademy.org/cs/winston-coderdojo-part-21/1355580688

Animation Step 1

Challenge

Animation Step 2

Challenges

  • Character stands still. Only move if you press a key.
  • Character move up and down as well as left and right.
  • Draw a floor and make character bounce left and right.

About

A lesson on variables, loops, if statements using the Khan Academy platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published