This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"profiles": [ | |
{ | |
"complex_modifications": { | |
"rules": [ | |
{ | |
"description": "Navigate using Left Control + hjkl", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "h", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sketch = function(p){ | |
p.setup = function(){ | |
p.createCanvas(p.windowWidth*0.8, 100); | |
} | |
p.draw = function(){ | |
p.background(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src = "{{site.baseurl}}/assets/js/instance-mode-example-one.js"></script> | |
<script src = "{{site.baseurl}}/assets/js/instance-mode-example-two.js"></script> | |
<script src = "https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.min.js"></script> | |
<div class = "p5js-script-div" id = "script-1"></div> | |
<div class = "p5js-script-div" id = "script-2"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//instance mode | |
//map and random functions | |
var sketch = function(p){ | |
var bcol = 0; | |
//objects | |
//in c++ this would be a struct | |
var spot = { | |
x : 100, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bubble1, bubble2; //global variables | |
function setup(){ | |
createCanvas(640, 200); | |
bubble1 = new Bubble(320, 50, 20, 'red', 2); //start at the center of the canvas | |
bubble2 = new Bubble(160, 50, 10, 'blue', 1); //new bubble2 to the left of bubble1 | |
//print(bubble.x, bubble.y); | |
} | |
function draw(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//instance mode | |
//template for creating a p5 sketch (kind of) | |
var sketch = function(p){ | |
//RGB rainbow colors | |
p.rainbowR = [248, 255, 255, 254, 208, 105, 18, 68, 59]; | |
p.rainbowG = [12, 51, 102, 174, 195, 208, 189, 68, 12]; | |
p.rainbowB = [18, 17, 68, 45, 16, 37, 185, 221, 189]; | |
var i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//RGB rainbow colors | |
var rainbowR = [248, 255, 255, 254, 208, 105, 18, 68, 59]; | |
var rainbowG = [12, 51, 102, 174, 195, 208, 189, 68, 12]; | |
var rainbowB = [18, 17, 68, 45, 16, 37, 185, 221, 189]; | |
var i; | |
var canvas; | |
var t = rainbowR.length; | |
function setup() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src = "https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.min.js"></script> | |
<script src = "https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/addons/p5.dom.min.js"></script> | |
<div id = "script-holder"> | |
<script src = "{{site.baseurl}}/js/this-is-a-test.js"></script> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PWM signal through pin 3 | |
// what's a PWM signal? read here: https://en.wikipedia.org/wiki/Pulse-width_modulation | |
// 8 bits PWM: 0 (0% or GND) to 255 (100% or VCC) | |
// PWM signal is controlled by a potentiometer connected to pin A2 | |
// the potentiometer have 3 leads: 1 (or 3) connects to GND, 2 to A2 and 3 (or 1) to VCC | |
// the potentiometer input signal is an analog signal | |
// the microcontroller converts this analog signal into digital using a 10 bits ADC | |
// ADC: analog to digital converter | |
// a 10 bits ADC signal ranges between 0 - 1023 | |
// the ADC signal is equivalent to the input analog voltage where 0 is GND and 1023 is VCC (5V) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PWM signal through pin 3 | |
// 8 bits PWM: 0 (0% or GND) to 255 (100% or VCC) | |
// what's a PWM signal? read here: https://en.wikipedia.org/wiki/Pulse-width_modulation | |
// pin 3 will source current to the LED | |
// refer to source_current.ino file to see how to connect the LED | |
// code executed on Arduino Leonardo | |
void setup(){ | |
pinMode(3, OUTPUT); // observe that only pins preceded by ~ in the board can output a PWM signal | |
} |
NewerOlder