This document outlines an introductory workshop on building Instagram-like photo filters using JavaScript. It provides instructions on downloading necessary software, connecting to WiFi, and an overview of the workshop content which includes introductions, goals, a demo of starter code, explanations of HTML, JavaScript basics, using third-party libraries, and challenges to create custom filters. The document instructs participants to follow along and code examples demonstrated to build a basic photo filtering application.
Build Your Own Instagram Filters with JavaScript in 40 Steps
1. Build Your Own Instagram-like Filters
with JavaScript
Please download Sublime Text & Firefox:
bit.ly/instagram-la
WIFI: CrossCamp.us Events
October 2017
2. Note
Sublime Text is the text editor we'll be using. We'll
be opening our HTML files in Firefox. Please make
sure you have both downloaded and installed.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
4. About you
Your name
What brought you to the workshop tonight?
What is your programming experience?
If you had a million dollars, What would you
do?
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
5. About us
Thinkful prepares students for web development and
data science jobs with 1-on-1 mentorship programs
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
6. Goals
Set up static website using JavaScript
HTML + JavaScript basics
Access third-party library in JavaScript
Build v1 of Instagram app
Advanced challenges
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
7. The starter code
Download and unzip the starter files into a folder
on your Desktop (four files total). Open index.html
and index.js in Sublime Text.
http://bit.ly/tf-instagram-starter
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
11. HTML Overview
HTML is the content and structure of a webpage
It's the skeleton of your website.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
12. HTML tags
Every tag starts with a "less than" sign and ends
with a "greater than" sign
<html> #an HTML opening tag
<body> #a body opening tag
<h1>Hello, World!</h1>
#a set of h1 tags with content
</body> #a body closing tag
</html> #an HTML closing tag
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
13. More about HTML tags
There are opening tags and closing tags - closing
tags have a backslash before the tag name
(</html>)
Tags instruct a browser about the structure of
our website
There are hundreds of built-in tags but you'll
use the same few a lot
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
14. HTML attributes
HTML attributes set properties on an element -
they are set in the opening tag
href is an attribute that sets the destination of a link
<a href="https://somewhere.com">This is
a link</a>
id is another attribute that identifies elements
(for CSS & JavaScript)
<h1 id="headline">This is a headline</h1>
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
15. Basic functions
A function lets you separate your code into bite-
sized pieces which you can use over and over again.
When you write a function to use later, you are
"declaring" it. When you use (or run) that function
you are "calling" it.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
16. Example
Declaring a function
Calling a function
function doSomething(){
alert("Done!");
}
doSomething();
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
17. More about basic functions
Functions can save us time because we use them
over and over in code. They are building blocks.
Make your code more organized and easier to read
JavaScript has many built-in functions
You'll write many, many functions in your
programs
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
18. Let's work through the rest of the HTML
<body>
<img id="my-image" src="test-image.png">
<br>
<button onClick="revertFilter()">Revert Filter</button>
<button onClick="applyFilter()">Apply Filter</button>
</body>
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
19. JavaScript overview
<script type="text/javascript" src="index.js"></script>
If HTML is the skeleton of a website, JavaScript is the
brains. JavaScript controls the behavior of our app.
We'll write our JavaScript in the index.js file.
We'll then import the file using similar syntax.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
20. Adding our functions to index.js
function revertFilter(){
//add code here
}
function applyFilter(){
//add code here
}
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
21. What is a third-party library?
In Javascript, we use third-party libraries to do cool
things. A third-party library is a JavaScript file that
contains a bunch of functions that someone else wrote
for us. There are a ton of these in every language.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
22. The CamanJS library
We'll be using the CamanJS library. ( )camanjs.com
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
23. Importing the CamanJS library
The CamanJS library is included in your starter code.
Import it at the top of your index.html file using the
syntax above.
<script type="text/javascript" src="caman.full.min.js"></script>
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
24. Documentation
How do we know what functions we can use? We could
look at the library source file, if it's short, or better, we
could look at the documentation.
All common libraries will have documentation with a list
of available functions and/or real-world examples.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
25. Note
A core part of being a developer is constantly learning
new languages, tools, libraries, and frameworks. They
will all be documented and you should get used to
finding answers through these resources.
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
27. Our functions
The correct function is "called" when a button is clicked
function revertFilter(){
Caman('#my-image', function() {
this.revert();
});
}
function applyFilter(){
Caman('#my-image', function() {
this.brightness(10);
this.contrast(30);
this.sepia(60);
this.saturation(-30);
this.render();
});
}
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
28. Challenge #1
Change out the example image with your own
image
Adjust the filter values in the example code to
update the filter
Make your own filter with at least one new
property (hint: look at built-in functionality)
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
29. Challenge #2
Instead of making your own, use a built-in filter.
Here's a full list:
vintage, lomo, clarity, sinCity, sunrise,
crossProcess, orangePeel, love, grungy,
barques, pinhole, oldBoot, glowingSun,
hazyDays, herMajest, nostalgia,
hemingway, concentrate
function applyFilter() {
Caman('#my-image', function() {
this['vintage']();
this.render();
});
}
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
30. Challenge #3 (Advanced)
Add more buttons, each one should add only one filter
Try cropping your pictures to different sized frames
Wi-Fi: Cross Camp.us Events bit.ly/instagram-la
33. 91%job-placement rate + job guarantee
Link for the third party audit jobs report:
https://www.thinkful.com/bootcamp-jobs-stats
Thinkful's track record of getting students jobs
34. Our results
80%as full-time developers
Kaeside Iwuagwu
Link for the third party audit jobs report:
https://www.thinkful.com/bootcamp-jobs-
stats
Frontend Developer
Sierra Gregg
Software Engineer
JP Earnest
Web Developer
92%placed in tech careers
35. Our students receive unprecedented support
1-on-1 Learning Mentor
1-on-1 Career MentorProgram Manager
Local Community
You
36. 1-on-1 mentorship enables flexible learning
Learn anywhere,
anytime, and at your
own schedule
You don't have to quit
your job to start career
transition
37. Thinkful Two-Week Trial
Talk to one of us and email benjy@thinkful.com to learn more
Two-week course with 6 mentor
sessions for $50 ($750 value)
Start with HTML, CSS and JavaScript
Option to continue with full bootcamp
Financing & scholarships available
Offer valid for one week after event
Benjy Schechner
Education Advisor