Skip to content

Instantly share code, notes, and snippets.

// initialize x and y as 0
int x=0;
int y=0;
void setup(){
size(800,600);
background(255); // set background color to white
}
void draw(){
int x = 0;
void setup(){
}
void draw(){
x += 1;
print(x+" ");
}
void setup(){
}
void draw(){
int x = 0;
x += 1;
print(x+" ");
}
public void setup() {
// Size of our sketch will be 800x600,
// and use the P2D rendering engine.
size(800, 600, P2D);
// We could have used this function instead of size()
// fullScreen(P2D);
// The background color of our sketch will be black
// by default, unless specified otherwise
@oguzgelal
oguzgelal / toptal-p5-sample1.java
Last active November 14, 2015 13:12
Processing code when converted into Java
public class ExampleFrame extends Frame {
public ExampleFrame() {
super("Embedded PApplet");
setLayout(new BorderLayout());
PApplet embed = new Embedded();
add(embed, BorderLayout.CENTER);
embed.init();
@oguzgelal
oguzgelal / toptal-p5-sample1.pde
Last active November 14, 2015 13:12
Simple Processing code block
public void setup() {
// setup codes goes here
}
public void draw() {
// draw codes goes here
}