Last active
March 14, 2018 16:44
-
-
Save wanbinkimoon/0771fea9b199ce5ac32edc8f6d815584 to your computer and use it in GitHub Desktop.
p5 multiple graphics in es6
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
import p5 from 'p5'; | |
import 'p5/lib/addons/p5.sound'; | |
const sketch = p => { | |
let canvas; | |
let scene1; | |
let scene2; | |
p.setup = () => { | |
p.createCanvas(p.windowWidth, p.windowHeight); | |
// p.colorMode(p.HSB) | |
scene1 = p.createGraphics(400, 400); | |
scene2 = p.createGraphics(400, 400); | |
p.background(100) | |
}; | |
const drawScene1 = () => { | |
console.log(p.createGraphics) | |
} | |
const drawScene2 = () => { | |
scene2.background(125, 255, 125) | |
} | |
p.draw = () => { | |
drawScene1() | |
drawScene2() | |
}; | |
p.windowResized = () => { | |
p.resizeCanvas(p.windowWidth, p.windowHeight); | |
}; | |
p.mousePressed = () => {}; | |
}; | |
new p5(sketch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i fixed the issue, I forgot to reference the graphic in
p.Image(scene2, 0, 0 )