Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. color fade animation for grid cells in swing

color fade animation for grid cells in swing

Scheduled Pinned Locked Moved Java
helpagentic-aijavacsscom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amit ofer
    wrote on last edited by
    #1

    hi, I'm doing a path-finding project as part of my 4th year software engineering degree. we're suppose to give visual representation to a bunch of multi-agent pathfinding algorithm. the simplest one is A* adapted for multiagents. anyway our environment is a grid map where every cell can be either blocked or used as part of an agent's path. what i wanna do is use animation to give a good representation of the final movement of the agent, but animating color change in my grid. i.e paint every step in the path for a second or so with some color to show how the agent moves. and the other thing i wanna do is to represent the way the algorithm works by painting the changes in the open list and closed list of the A* algorithm while its doing its calculation. I'm using an adapted version of the observer design pattern to send events from my algorithm layer to my controller and gui layer. what i wanna do in the gui layer is everytime a tile is added to the open list, i want to have that cell painted in some color and then have it fade away according to a predefined timer or maybe later add a slider to control this timer. I looked at the code here: http://www.java2s.com/Code/Java/2D-Graphics-GUI/Colorfadinganimation.htm. it seems pretty simple, the problem is that every tile animation has to be independent of the others to allow the algorithm and everything to keep running and different animations to start. so whats the best way to achieve the results i'm looking for? should i just open a different thread for each animation or have a pre-made thread for each cell. would that be an over kill for the application, since there can be up to 1000 cells and therfore close to 1000 threads performing animation. another issue i think i might encounter is the fact that it might happen that a cell will start its color fading animation and then will have to restart and i don't want the two animations to go at the same time (only one thread performing animation for the same cell at the same time). I hope i was clear enough with what i'm trying to achieve, if someone has any ideas or thought it could really help me with my project. thanks in advanced Amit Ofer

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups