I apologize if this question has already been asked, but I haven't been able to locate it.
I am working on a project that involves a canvas displaying approximately 400-500 rectangles, each ranging in height and width from 20-30 pixels. The goal is to have each rectangle move one pixel to the left and up upon mouseover, and return to its original position on mouseout to create a selected effect. While my code functions well with a small number of shapes, it experiences significant slowdown when dealing with 500 of them. I came across an example online that suggested creating an "animation layer" to move the objects that need to be animated. However, this approach still requires redrawing the main layer to erase the previously moved item... Below is the code snippet:
// Insert KineticJS code here
And this is the code responsible for rendering the canvas:
// Insert HTML and script code for rendering the canvas here
I have a feeling that I am missing something crucial here, but my knowledge of KineticJS is limited. Could someone provide guidance on the correct approach?
Thank you in advance, Danny