< Return to Video

1.0 p5.js: What is it?

  • 0:03 - 0:06
    Hello! I'm making a video!
  • 0:06 - 0:08
    You are watching a video, I think ...
  • 0:08 - 0:16
    The goal of this video is to
    talk about something called p5.js
  • 0:16 - 0:19
    What is p5.js?
  • 0:19 - 0:24
    Who should you or might
    you be thinking about learning
  • 0:24 - 0:28
    this thing called p5.js
    from the very, very beginner stage
  • 0:28 - 0:31
    without any experience with
    anything else whatsoever
  • 0:32 - 0:36
    and what might you use it for
    and what's going to happen?
  • 0:36 - 0:40
    Am I making more videos?
    less videos? That sort of thing.
  • 0:40 - 0:44
    So, first let me give you
    a little context.
  • 0:44 - 0:47
    There is this thing called Processing.
  • 0:49 - 0:53
    Processing is a project
    that started in 2001
  • 0:53 - 1:04
    by Casey Reas and Benjamin Fry
  • 1:04 - 1:07
    The two of them were students together
    at the MIT media lab -
  • 1:07 - 1:12
    designers, artists, programmers -
    trying to make a tool
  • 1:12 - 1:15
    that could help them
    with their own work.
  • 1:15 - 1:21
    Since then, since 2001, this idea of
    'creative coding' - it's a complex term,
  • 1:21 - 1:23
    but - 'creative applications
    through programming'
  • 1:23 - 1:25
    I like to think of it as 'creative
    expression through programming' -
  • 1:25 - 1:27
    how do you communicate and
    express your ideas
  • 1:27 - 1:32
    while making computational tools -
  • 1:32 - 1:35
    It's also like - if you know how to
    learn to program -
  • 1:35 - 1:37
    There's a lot of like, "Learn to program!
    Learn to program! Everyone's gotta
  • 1:37 - 1:40
    learn to program! Aah!" kind of stuff
    going on these days -
  • 1:40 - 1:45
    Take a deep breath, relax, you don't need
    to know how to program.
  • 1:45 - 1:47
    There's lots of great stuff
    in the world -
  • 1:47 - 1:49
    you could learn how to play the violin,
    that's a wonderful thing,
  • 1:49 - 1:54
    but there is an aspect of learning to
    program that is very powerful in that
  • 1:54 - 1:57
    that software is something that
    drives so much of what we use.
  • 1:57 - 2:02
    And if you want to not be stuck
    just, kind of using whatever software
  • 2:02 - 2:04
    other people - large corporations -
  • 2:04 - 2:07
    if you want to be able to express yourself
    in new and different ways,
  • 2:07 - 2:09
    learning to program is a great
    way to do that.
  • 2:09 - 2:14
    Also, and this is gonna kind of
    come around full circle here,
  • 2:14 - 2:20
    learning to program and have the results
    of what you program go in a browser
  • 2:20 - 2:24
    on the web, so that other people can
    see those things -
  • 2:24 - 2:29
    that you can share and distribute
    easily - this is a very powerful thing.
  • 2:29 - 2:35
    So, interestingly enough, when Processing
    was first created, it was built on top of
  • 2:36 - 2:40
    a programming language called 'Java',
    which was all the rage back in 2001
  • 2:40 - 2:47
    and one of the reasons why Processing
    used Java is that
  • 2:47 - 2:53
    you can make these things called applets
    and applets would run in the web browser!
  • 2:53 - 2:55
    So you could program your thing
    in Processing, upload it to the web,
  • 2:55 - 2:59
    distribute it, all the world would see it,
    you'd become rich and famous
  • 2:59 - 3:01
    or, even better, you don't become
    rich and famous
  • 3:01 - 3:05
    but you do something good for the world
    - or both, perhaps!
  • 3:05 - 3:08
    then, that made a lot of sense.
  • 3:08 - 3:12
    Fast-forward 14 years later, 2015,
  • 3:12 - 3:16
    when was the last time you saw
    a java applet on the web?
  • 3:16 - 3:19
    If you saw it, it was just basically an
    experience with a giant error message
  • 3:19 - 3:21
    that told that your browser crashed
    and nothing worked.
  • 3:21 - 3:27
    The language these days of the browser
    is something called JavaScript.
  • 3:27 - 3:29
    And I'll say a bit more about that
    in a minute
  • 3:29 - 3:33
    JavaScript allows you to program and
    create all sorts of exciting things
  • 3:33 - 3:37
    that happen in a web browser.
    If you're interested in creating unique
  • 3:37 - 3:43
    and animated and creative web content,
    learning JavaScript, learning p5.js, is
  • 3:43 - 3:44
    something you might be interested in.
  • 3:44 - 3:58
    Now, [...] some time in the last couple
    of years, a bunch of us were talking
  • 3:58 - 4:00
    and we asked the question:
  • 4:00 - 4:06
    "What language would you pick if
    Processing were being invented today?"
  • 4:06 - 4:12
    And somebody that answered that question
    in an interesting way,
  • 4:12 - 4:14
    her name is Lauren McCarthy.
  • 4:14 - 4:21
    So, Lauren McCarthy began a project,
    in collaboration with the Processing f...
  • 4:21 - 4:26
    Processing is a not for profit foundation,
    so I was about to say Processing foundation -
  • 4:26 - 4:33
    [...ramble...]
  • 4:33 - 4:37
    So Lauren said, "Ok, well, what if
    Processing was being invented today
  • 4:37 - 4:43
    and the language, instead of Java,
    was JavaScript?"
  • 4:43 - 4:47
    So this is what p5.js is, as a project.
  • 4:47 - 4:50
    I should just briefly mention, there's
    another wonderful project
  • 4:50 - 4:54
    called processing.js.
  • 4:54 - 4:58
    I know this is crazily confusing, I just
    want to briefly mention it.
  • 4:58 - 5:01
    processing.js is a project started by
    John Resig and many other people
  • 5:01 - 5:03
    have worked on it since then.
  • 5:03 - 5:08
    processing.js sort of tries to solve this
    other problem:
  • 5:08 - 5:11
    your java code can't run on the web
    as an applet anymore,
  • 5:11 - 5:16
    what if we could behind-the-scenes
    translate it to JavaScript
  • 5:16 - 5:18
    so that it ran there?
  • 5:18 - 5:24
    But this project, p5.js, is different
    in that it is a new project.
  • 5:24 - 5:28
    We can now think wonderfully and
    happily about
  • 5:28 - 5:31
    that thing called Processing
    that I briefly spoke about,
  • 5:31 - 5:34
    but mostly right now,
    for the purpose of these videos,
  • 5:34 - 5:35
    we can now ignore this.
  • 5:35 - 5:41
    p5.js is an environment, a simple -
    hopefully simple -
  • 5:41 - 5:43
    and beginner-friendly environment
  • 5:43 - 5:45
    to help you learn JavaScript,
  • 5:45 - 5:49
    to make applications, computational,
    creative, interesting -
  • 5:49 - 5:53
    hopefully interesting-
    things happen in the browser.
  • 5:53 - 5:55
    And eventually, you could go in a lot of
    routes with this.
  • 5:55 - 5:58
    You might make art,
    you might make data visualization,
  • 5:58 - 6:01
    you might make websites, as like
    a web designer,
  • 6:01 - 6:04
    there's lots of paths that you might take
  • 6:04 - 6:08
    from this basic set of videos
    that I hope to make.
  • 6:08 - 6:15
    I think that's just about the
    full context.
  • 6:15 - 6:17
    There's some other pieces to
  • 6:17 - 6:19
    "how do you make something happen
    in the web browser",
  • 6:19 - 6:22
    you need more than JavaScript, you need
    these other things called
  • 6:22 - 6:25
    HTML, CSS, and JavaScript,
  • 6:25 - 6:27
    but I think what I wanna do now,
    very briefly,
  • 6:27 - 6:29
    and I'm gonna pick this up in the
    next video,
  • 6:29 - 6:33
    is just look at, open p5.js and
    do a few things with it,
  • 6:33 - 6:36
    just so you get a sense of what kinds of
    things it can do.
  • 6:36 - 6:39
    What would be great is if I had a video
    that showed you like
  • 6:39 - 6:42
    "Here are a bunch of awesome projects
    that are made with these kinds of tools."
  • 6:42 - 6:47
    Don't get me wrong, there's a lot of
    really amazing JavaScript framework.
  • 6:47 - 6:49
    So I think a missing piece here --
  • 6:49 - 6:53
    Just like Processing was built
    on top of Java,
  • 6:53 - 6:54
    it's a little bit different here
  • 6:54 - 7:00
    p5.js is not really built on top of
    JavaScript, it is a set of...
  • 7:00 - 7:05
    boy, this is a hard one ...
    and I was doing so well! [...]
  • 7:09 - 7:16
    What I think is useful to think of here
    for a moment is p5.js is two things:
  • 7:16 - 7:19
    One of these things is it's
    a library of functions.
  • 7:19 - 7:21
    So, here's a great way
    of thinking about it.
  • 7:21 - 7:24
    Let's say you want to learn JavaScript.
    And you go to Google and you type,
  • 7:24 - 7:28
    "JavaScipt" - boom.
    Whoa! There's a lot of stuff out there.
  • 7:28 - 7:31
    There's like a million Stack Overflow
    posts, which is like
  • 7:31 - 7:32
    a place where people ask questions,
  • 7:32 - 7:36
    there's 15 million "this.js" things
    you could learn
  • 7:36 - 7:38
    and there's something called jQuery
    and there's so much.
  • 7:38 - 7:44
    So, one of the goals, I think, of p5.js
    is to give you a little bit of a sandbox,
  • 7:44 - 7:46
    a walled garden, to learn
    some of the basics, and for that,
  • 7:46 - 7:48
    you get a library of functions,
  • 7:48 - 7:51
    to draw a circle, or draw a rectangle,
    or set a color
  • 7:51 - 7:54
    so you can just use some basic drawing
    functions to learn some of these
  • 7:54 - 7:56
    beginner steps of programming.
  • 7:56 - 8:01
    The other thing it is, and I think I need
    to move over to the computer here,
  • 8:08 - 8:11
    The other thing it is is this thing here
  • 8:11 - 8:19
    Sam Lavigne has created something called
    the p5.js editor
  • 8:19 - 8:22
    What this means is an application,
    a program on your computer that
  • 8:22 - 8:26
    you can launch and just start typing
    some code in and get your feet wet
  • 8:26 - 8:30
    and start to experiment and learn a bit
    about code, without having to worry about
  • 8:31 - 8:35
    all of the larger pieces of things that
    you need in order to make something happen
  • 8:35 - 8:37
    on a web page. We're gonna do it very
    simply here.
  • 8:37 - 8:40
    So let's look at that for a second.
    So I'm going to launch this.
  • 8:40 - 8:44
    By the way, I just downloaded it.
    I haven't -- I've used it...
  • 8:46 - 8:50
    but, I haven't on this computer.
    So, look:
  • 8:50 - 8:55
    "p5 is an application downloaded from the
    internet. Are you sure you want to open it?"
  • 8:55 - 8:59
    So now's the time when you could say,
    "Eh, I'm just going to play the violin."
  • 8:59 - 9:04
    Or, "I'm going to go play frisbee
    - football - soccer."
  • 9:04 - 9:10
    But I'm going to open it.
    [...]
  • 9:10 - 9:12
    A newer version of p5 is available.
    I don't want to download it right now -
  • 9:12 - 9:17
    just hit ok. Oops, I do want to download
    it right now. Ok.
  • 9:17 - 9:35
    So this here ...
    [getting things opened]
  • 9:35 - 9:41
    this here is the
    p5.js editor.
  • 9:41 - 9:45
    And if you look at it, it's already
    filled in a little bit of code for you.
  • 9:45 - 9:48
    So you can start to see, "Ah, I have to
    learn to program, I have to learn
  • 9:48 - 9:51
    some strange new language and syntax."
  • 9:51 - 9:56
    function. draw. parentheses.
    curly bracket. curly bracket.
  • 9:56 - 10:00
    These are some things that will come
    to light if you're for the first time
  • 10:00 - 10:03
    watching this video and looking
    at programming.
  • 10:03 - 10:07
    So I'm gonna do a couple things here
    real quick.
  • 10:07 - 10:14
    One thing I'm gonna do is I'm gonna type
    in CreateCanvas and down here under draw
  • 10:14 - 10:20
    I'm gonna type rectangle and I'm gonna
    type some other numbers
  • 10:20 - 10:26
    and I'm going to zoom back out
    and hit play.
  • 10:26 - 10:28
    And we can see here,
  • 10:28 - 10:33
    look what's happened.
  • 10:33 - 10:36
    I wrote something that says,
    "createCanvas!"
  • 10:36 - 10:38
    and what did that do? It made a canvas.
  • 10:38 - 10:40
    That's the canvas.
  • 10:40 - 10:45
    Then, down here, I wrote something that
    said rect, short for rectangle.
  • 10:45 - 10:47
    What did it do? It made a rectangle.
  • 10:47 - 10:51
    So these are the first pieces, the first
    things, that I'm going to show you
  • 10:51 - 10:53
    in the next video.
  • 10:53 - 10:57
    What lines of code do you start to write,
    and what do those lines of code do?
  • 10:57 - 11:02
    With ps.js here, the first things we're gonna
    learn is how to, like, draw a picture.
  • 11:02 - 11:07
    And, by the way, this canvas is actually a
    little mini web browser that's opened.
  • 11:07 - 11:12
    So as more and more videos come to pass,
    we can peel back some of these layers
  • 11:12 - 11:15
    and see how you might take this and
    put it on the web somewhere,
  • 11:15 - 11:17
    share it, allow people to interact
    with it, that sort of thing.
  • 11:17 - 11:21
    So, this video's ok. B+.
  • 11:21 - 11:25
    I think I'm going to keep it though
    and upload it and
  • 11:25 - 11:28
    someday there will be a better one...
    probably never...
  • 11:28 - 11:33
    This is the end. I'm gonna make another
    video and then upload that too
  • 11:33 - 11:36
    and you can watch many of them.
  • 11:36 - 11:39
    And I'm keeping a list - maybe I'll try to
    put a link in the description or something
  • 11:39 - 11:41
    maybe a list of all the videos I'm going
    to make.
  • 11:41 - 11:46
    I'm gonna make a lot of intro ones and
    then some project-based ones like
  • 11:46 - 11:51
    how to take a Google Spreadsheet and
    visualize it as a graph in JavaScript and
  • 11:51 - 11:54
    try to do that in a short 10 minutes.
  • 11:54 - 11:56
    That's sort of my plan for this semester.
Title:
1.0 p5.js: What is it?
Description:

more » « less
Video Language:
English
Duration:
12:06

English subtitles

Revisions