xxxxxxxxxx
40
let p52dGraph, x, y, r = 2, t = 0,
graphConfig = {
basicConfig: {
x:50,
y:50,
w:500,
h:300
}
}
function setup() {
createCanvas(640, 400);
p52dGraph = new P52dGraph(graphConfig);
}
// Try dragging and scrolling in the graph !!!
function draw() {
background(20);
drawGraph();
drawRevolvingCircle();
}
function drawGraph() {
p52dGraph.display();
p52dGraph.drawSubGrid();
p52dGraph.drawMainGrid();
p52dGraph.pan();
p52dGraph.zoom();
p52dGraph.markCoords();
}
function drawRevolvingCircle () {
fill(255)
const graphX = p52dGraph.getXPixel(r*cos(t))
const graphY = p52dGraph.getYPixel(r*sin(t))
circle(graphX, graphY, 10)
t+=0.02;
p52dGraph.clip()
}