I'm reading through the khan academy course on algorithms. I'm at https://www.khanacademy.org/computing/computer-science/algorithms/sorting-algorithms/p/project-selection-sort-visualizer .
The code is working and I can get it to print to the console but I need to be able to print to the canvas.
I've tried :
var displayArray = function(array) {
textFont(createFont("monospace"), 12);
println(array);
};
Bu this again just prints to the console. How can I print to the canvas with processingjs?
displayArray()
:textAlign(LEFT, TOP);
fill(0);
print(array);
text(array, 0, 0);
Or if you want it centered:
textAlign(CENTER, CENTER);
fill(0);
print(array);
text(array, 200, 200);