Skip to content

Spring 2014: Week 1

lmccart edited this page Oct 21, 2014 · 2 revisions

##Course intro / expectations

  • Where to find course materials
  • Overview / syllabus
  • Homework / final project
  • Attendance / participation
  • What is p5? (briefly)
    • A disclaimer / invitation: p5.js, like a lot of things on the web, is in active development and flux. This means: (1) If something isn’t working as expected you have to determine whether it’s a problem with your code or a bug in the library. (2) Not everything is documented. At times this can be frustrating, but ultimately, the lesson is a good one: question everything, never assume. Keep track of what you’re doing and practice systematic ways of breaking down problems to find solutions. Google is your friend, don’t be afraid of what you don’t know. **Later, we will talk about how to create an issue on github for tracking bugs.

##Intro to workflow with p5.js

##Processing > p5 conversion

  • Tutorial: Processing > p5 conversion
  • Variables do not specify a type. Use var instead of float, int, double, long, char, String, Array, etc.
  • A var can be anything -- any of the types mentioned, but also functions.
  • You do not specify a return type for functions.
  • Currently, not all Processing functionality is supported in p5.js, and the syntax for a few have changed slightly. See API and API progress for up-to-date documentation of all supported functions and future plans.

##Intro to JavaScript: basics

  • File setup, using <script>

  • Variables and data types

  • Operators

    • Arithmetic: +, -, *, /, %, ++, --
    • Equality: ==, ===, !=, !==
    • Relational: <, >, <=, >=
    • String: +, equality, relational
    • Logical: &&, ||, !
  • Logic

    • if, else if, else
    • switch, case
    • for(var i=0;...) vs for (var k in arr)
    • while, do...while
    • break, continue
  • Arrays

  • Objects

    • Setting and accessing properties and methods
  • Functions

    • Function definition
    • Passing in args
    • return
  • Scope

##Homework