BrandonArmand / Binari

Interactive code editor with a live binary tree visual designed to teach new developers the fundamentals of Data Structures.
https://binari.dev
MIT License
181 stars 113 forks source link

Optimize the p5.js #11

Closed BrandonArmand closed 4 years ago

BrandonArmand commented 4 years ago

What needs to be done.

As of now, the calculations for the Binary tree positioning happens in the render code for the canvas. This is very poor design on my part, but I was aiming for an MVP. If the code gets improved, then we can include animations!

Why

If we attempt to animate the canvas, the visuals flicker.

How

First, the p5 code will need to be calculated once and the result added to an array or object with the cords stored inside. Then during the render, just display the array/obj items per frame, rather than constantly doing the calculations.

georgeCog commented 4 years ago

Had a quick look at the code and I'm pretty sure I can handle this, would it be alright if I took it on?