Skip to content

Commit f0b6c21

Browse files
committed
first commit
0 parents  commit f0b6c21

File tree

1,956 files changed

+175573
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,956 files changed

+175573
-0
lines changed

LESSON.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# tools
2+
3+
Chrome, Terminal, Node.js/npm, VSCode, canvas-sketch
4+
5+
# install canvas-sketch
6+
7+
Before starting, install the generative art toolkit with node/npm commands:
8+
9+
```sh
10+
npm install canvas-sketch-cli -g
11+
```
12+
13+
> Notice the `-cli` at the end! This is the 'command line interface' for the canvas-sketch toolkit.
14+
15+
The `-g` flag will install it globally. Once installed, it should provide you with a `canvas-sketch` command that you can enter into terminal. Let's test it to be sure:
16+
17+
```sh
18+
canvas-sketch --version
19+
```
20+
21+
It will give an error because you haven't passed any JavaScript files — so now we can
22+
23+
# make a folder
24+
25+
Open Terminal and navigate to a folder of your choice, like `~/Documents` or your desktop.
26+
27+
Then, createa a new folder and move into it:
28+
29+
```sh
30+
mkdir generative-sketches
31+
cd generative-sketches
32+
```
33+
34+
Now let's create a new folder within that, it will hold all our JavaScript:
35+
36+
```sh
37+
mkdir src
38+
```
39+
40+
# make a sketch
41+
42+
Now that we have a `src` folder, let's make a new sketch that draws a grid.
43+
44+
We use the `canvas-sketch` command-line tool to stub out a new file and run a local development server.
45+
46+
```sh
47+
canvas-sketch src/simple-grid.js --new --open
48+
```
49+
50+
The `--new` flag tells the tool to write a new file from a basic template. The `src/simple-grid.js` is the path to the new file we wish to create. The `--open` flag will launch the browser to our development server's URL.
51+
52+
# development server
53+
54+
Now we're running a development server on your local IP. You can access it with [http://localhost:9966/](http://localhost:9966/) or by hitting the IP directly that is logged from the `canvas-sketch` tool. You can also access this URL from your mobile phone if you're on the same WiFi network.
55+
56+
# `canvas-sketch` concepts
57+
58+
## renderer
59+
60+
## settings
61+
62+
## "pure functions"
63+
64+
## exporting
65+
66+
# EXAMPLE: make a grid of points
67+
68+
- create UV coordinates
69+
70+
# EXAMPLE: shift the grid in with a margin
71+
72+
## SLIDES: `lerp`
73+
74+
- use `lerp` for linear interpolation
75+
76+
# EXAMPLE: remove some random % of squares
77+
78+
- use `Math.random()`

README.md

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Creative Coding & Generative Art with JavaScript
2+
3+
This repository includes code & resources for students attending my *Generative Art & Creative Coding with JavaScript* workshops in 2018.
4+
5+
# Contents
6+
7+
- [Prerequisites](#Prerequisites)
8+
9+
- [Using the Command-Line](#using-the-command-line)
10+
11+
- [Installing Node.js & npm](#installing-nodejs--npm)
12+
13+
- [Libraries & Docs](#libraries--docs)
14+
15+
- [Running the Code Examples](#running-the-code-examples)
16+
17+
- [Installing `canvas-sketch-cli`](#installing-canvas-sketch-cli)
18+
19+
- [Running & Editing a Sketch](#running--editing-a-sketch)
20+
21+
- [Creating New Sketches](#creating-new-sketches)
22+
23+
- [Bundling to a Static Website](#bundling-to-a-static-website)
24+
25+
- [Tips for Using the Command-Line](#tips-for-using-the-command-line)
26+
27+
- [Further Reading](#further-reading)
28+
29+
# Prerequisites
30+
31+
Before starting the workshop, please make sure you've installed the latest version of [Node.js](https://nodejs.org/en/) and [npm](https://npmjs.com/) and that you can use these tools directly from your command-line interface. In macOS, you can use the Terminal app, and in Windows you can use cmd.exe or [cmder.net](http://cmder.net/). For writing JavaScript, I recommend [VSCode](https://code.visualstudio.com/) as a code editor.
32+
33+
If you already have these tools installed, you can use the `--version` flag to make sure you have above `node@8` and `npm@5`:
34+
35+
```sh
36+
npm --version
37+
node --version
38+
```
39+
40+
Some further instructions below:
41+
42+
#### Using the Command-Line
43+
44+
In macOS, you can go to *Applications > Utilities > Terminal.app*. In Windows, you can click *Start* and search for `cmd.exe`, or download [cmder.net](http://cmder.net/) for a more powerful experience.
45+
46+
If you are new to the command-line, you can see some [Tips for using the Command-Line](#tips-for-using-the-command-line).
47+
48+
#### Installing Node.js & npm
49+
50+
You can download and install the latest version of [Node.js](https://nodejs.org/en/) (version 8.x or higher) from its website. This will come included with a recent version of npm (5.x or higher).
51+
52+
Once installed, you should be able to run `node --version` and `npm --version` from your command-line.
53+
54+
# Libraries & Docs
55+
56+
In addition to the core Node/npm tools, this workshop will also use a few libraries and frameworks. Below is a link to each of their doc pages:
57+
58+
- [Canvas API](https://developer.mozilla.org/kab/docs/Web/API/Canvas_API) — 2D and WebGL features on the `<canvas>` tag
59+
- [canvas-sketch](https://github.com/mattdesl/canvas-sketch/tree/master/docs) — A development tool for Generative Art
60+
- [canvas-sketch-util](https://github.com/mattdesl/canvas-sketch-util/tree/master/docs) — Utilities for Math & Random Number Generation
61+
- [ThreeJS](https://threejs.org/docs/) — A Rendering Engine for WebGL
62+
63+
# Running the Code Examples
64+
65+
This repository contains some code examples in the [src](./src) folder similar to the artworks we will be creating during the workshop.
66+
67+
Each artwork in [src](./src) is contained in a single JavaScript file, and can be run locally with the [canvas-sketch-cli](https://github.com/mattdesl/canvas-sketch-cli) tool.
68+
69+
#### Installing `canvas-sketch-cli`
70+
71+
Before starting, you must install the command-line tool like so:
72+
73+
```sh
74+
npm install canvas-sketch-cli --global
75+
```
76+
77+
Once installed, you won't need to run this again unless you want to update to a new version of `canvas-sketch-cli`.
78+
79+
#### Running & Editing a Sketch
80+
81+
Once you've installed the CLI tool globally, `cd` into this repository folder and you can run each individual sketch like so:
82+
83+
```sh
84+
canvas-sketch src/grid-basic.js --open
85+
```
86+
87+
The optional `--open` flag will open your default browser to the development server's URL, which is the same as [http://localhost:9966](http://localhost:9966).
88+
89+
Now, edit your JavaScript files and the browser will reload automatically.
90+
91+
#### Creating New Sketches
92+
93+
You can create a new sketch with the `--new` flag, which will write out a plain sketch file and start a development server so you can then edit it:
94+
95+
```sh
96+
canvas-sketch src/my-new-sketch.js --new --open
97+
```
98+
99+
#### Bundling to a Static Website
100+
101+
Once you are happy with your sketch, you can create a static website by bundling it up to a single HTML file. You can use the `--build` command, and `--inline` which will wrap all the JavaScript into an inline script tag so that you end up with just a single file for your site.
102+
103+
```sh
104+
canvas-sketch src/my-new-sketch.js --build --inline
105+
```
106+
107+
Try double-clicking the exported HTML file to see your website. This file can be shared on your favourite website host, like [Neocities](https://neocities.org/).
108+
109+
You can also turn on debugging (source maps) with the `--no-compress` option.
110+
111+
# Tips for Using the Command-Line
112+
113+
In this class we will only use a few operations from the command-line:
114+
115+
#### `cd`
116+
117+
To change directory, you can use the `cd` command:
118+
119+
```sh
120+
# Set directory to './some-folder/'
121+
cd some-folder/
122+
123+
# Set directory up one
124+
cd ../
125+
126+
# Set directory up one and into foobar/
127+
cd ../foobar
128+
```
129+
130+
#### `mkdir`
131+
132+
To make a new directory, you can use `mkdir` command. The following will create a new folder in your current working directory called `foo-bar`:
133+
134+
```sh
135+
mkdir foo-bar
136+
```
137+
138+
#### `npm`
139+
140+
We will use the `npm` command to install and use third-party dependencies. This command only exists after you install Node.js and npm.
141+
142+
To install a code dependency, like [`three`](http://npmjs.com/package/three) (ThreeJS), you can use `npm install` like so:
143+
144+
```sh
145+
# To install ThreeJS
146+
npm install three
147+
148+
# To uninstall ThreeJS
149+
npm uninstall three
150+
151+
# To install multiple dependencies, just list all of them
152+
npm install three canvas-sketch-util
153+
```
154+
155+
To install a global command-line tool, like `canvas-sketch-cli`, you can use the `--global` (or `-g`) flag:
156+
157+
```sh
158+
npm install canvas-sketch-cli --global
159+
```
160+
161+
#### Keyboard Shortcuts
162+
163+
- *Tab Completion* — Many terminal applications (macOS Terminal and cmder.exe) will support Tab Completion. Start typing a folder name and hit the Tab key, and it will auto-complete to a matched folder name that already exists. Hit it twice to display all matches.
164+
- *Previous/Next Command* — You can use the Up and Down arrow keys to repeat previous commands
165+
166+
# Further Reading
167+
168+
More links to generative art & creative coding.
169+
170+
- Generative Art
171+
172+
- [Generative Artistry](https://generativeartistry.com/)
173+
174+
- [Anders Hoff — Writing on Generative Art](https://inconvergent.net/#writing)
175+
176+
- [Tyler Hobbs — Writing on Generative Art](http://www.tylerlhobbs.com/writings)
177+
178+
- [My Blog — Writing on Creative Coding & Generative Art](https://mattdesl.svbtle.com/)
179+
180+
- GLSL & Shaders
181+
182+
- [The Book of Shaders](https://thebookofshaders.com/)
183+
184+
- [Lesson: GLSL Shader Basics](https://github.com/Jam3/jam3-lesson-webgl-shader-intro)
185+
186+
- [Lesson: Custom Shaders in ThreeJS](https://github.com/Jam3/jam3-lesson-webgl-shader-threejs)
187+
188+
- Math
189+
190+
- [Linear Interpolation — intro to `lerp`](https://mattdesl.svbtle.com/linear-interpolation)
191+
192+
- [math-as-code — A cheat sheet for mathematical notation in code form](https://github.com/Jam3/math-as-code)
193+
194+
- More Resources
195+
196+
- [awesome-creative-coding — a large list of resources](https://github.com/terkelg/awesome-creative-coding)
197+
198+
- [graphics-resources — a large list of papers & study material](https://github.com/mattdesl/graphics-resources)

TIMING.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
9:30 AM
2+
3+
- Intro
4+
- "Has anyone used X?"
5+
- Who Am I?
6+
- Class structure: Morning / Afternoon
7+
- What is Creative Coding?
8+
- Examples of Creative Coding
9+
- What is Generative Art?
10+
- Examples of Generative Art
11+
- Practical/Work Opportunities?
12+
13+
10:00 AM
14+
15+
- Show Repository
16+
- Tools & Prerequisites:
17+
- ES6, JavaScript, Node.js, npm, Chrome, VSCode
18+
- Libraries & Frameworks
19+
- Canvas API
20+
- Docs
21+
- `canvas-sketch` and `canvas-sketch-cli`
22+
- Docs
23+
- Installing `canvas-sketch-cli`
24+
- Creating a new sketch
25+
- Sketch Structure: sketch function, renderer function
26+
- Canvas2D API Basics
27+
- Fills, Strokes, rectangles, circles, shapes
28+
- Canvas-Sketch basics
29+
- Dimensions, Physical Artwork
30+
31+
10:30 AM
32+
33+
- Let's Create our First Artwork!
34+
- How do we start?
35+
- Grid of Circles
36+
- Pure Renderer Function
37+
- Exporting as PNG, Giclée Print
38+
- Utilities & Modules: canvas-sketch-util
39+
- Installation
40+
- Linear Interpolation: margins
41+
- Random number generation: chance, range, gaussian
42+
43+
11:00 AM
44+
45+
- Instruction-Based Artwork
46+
- Sol LeWitt, Vera Molnar, Manfred Mohr
47+
- Working with Algorithms
48+
- Sketching by Hand
49+
50+
11:30 AM
51+
52+
- Explore Themes: Grid, Lines, ???
53+
- Open Code
54+
55+
- LUNCH
56+
57+
1:00 PM
58+
59+
- Intro to WebGL & ThreeJS
60+
- Installing `three` module
61+
- Using canvas-sketch with builtin ThreeJS template
62+
- Introduce new topics:
63+
- { animate }
64+
- resize() and render() events
65+
- Components of a ThreeJS Scene:
66+
- Renderer
67+
- Camera
68+
- Scene
69+
- Geometry
70+
- Mesh
71+
- Material
72+
73+
1:30 PM
74+
75+
- 3D Coordinates & Math Basics
76+
- Triangulation, Particles?
77+
- Animation?
78+
- Parametric?
79+
80+
2:00 PM
81+
82+
2:30 PM
83+
84+
3:00 PM
85+
86+
3:30 PM
87+
88+
4:00 PM
89+
90+
4:30 PM
91+

assets/fonts/SpaceGrotesk-Bold.woff

37.1 KB
Binary file not shown.

assets/fonts/SpaceGrotesk-Light.woff

35.9 KB
Binary file not shown.

assets/fonts/SpaceGrotesk-Medium.woff

36.4 KB
Binary file not shown.
37.1 KB
Binary file not shown.
37.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)