Graphics and Animation software recommendations

Click For Summary

Discussion Overview

The discussion revolves around recommendations for graphics and animation software suitable for creating animations of a knight's tour on a chessboard using Python. Participants explore various tools and libraries, discussing their capabilities and potential applications in both interactive and static visualizations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant suggests using Python's matplotlib to create individual frames for the animation and then using ffmpeg to compile them into a movie.
  • Another participant proposes using pygame for interactive graphics and games, referencing its capabilities for creating animations.
  • Some participants mention GlowScript as a tool for fancier interactive graphics and animation, providing links to examples.
  • Blender is mentioned as having a Python console, which could be useful for animation tasks.
  • Processing.org's Python mode is suggested as another option for utilizing graphics methods for animations.
  • One participant expresses interest in using the python chess and chess.svg libraries for rendering chessboards and pieces, questioning the need for Jupyter Notebooks for image rendering.
  • Another participant discusses using pyvips to convert SVG files to PNG, noting the need for software to control a window for displaying graphics.
  • There are inquiries about integrating web pages with Python scripts to display animations, reflecting uncertainty about how to connect various components of the project.
  • Some participants emphasize the importance of understanding how to stitch together PNG files into a movie and how to embed that movie in a web page.

Areas of Agreement / Disagreement

Participants present multiple competing views on the best software and methods for creating animations, with no clear consensus on a single approach. There is ongoing exploration of various tools and libraries, indicating a lack of agreement on the most effective solution.

Contextual Notes

Participants express uncertainty about the integration of different software components and the overall workflow needed to achieve their animation goals. There are mentions of dependencies on specific libraries and tools, but no resolutions to these uncertainties.

Who May Find This Useful

This discussion may be useful for individuals interested in creating animations using Python, particularly those looking for software recommendations and insights into integrating various tools for graphics and animation projects.

  • #31
Sorry no time to do something custom but here is an example of what can be easily achieved:
https://chessboardjs.com/examples/3004

Note that the only code that has been written to achieve that is what follows, everything else is in the libraries.
JavaScript:
var board = Chessboard('myBoard', 'start')

$('#move1Btn').on('click', function () {
  board.move('e2-e4')
})

$('#move2Btn').on('click', function () {
  board.move('d2-d4', 'g8-f6')
})

$('#startPositionBtn').on('click', board.start)
 
Computer science news on Phys.org
  • #32
PeroK said:
That's the plan: to learn HTML and JavaScript next. Started that today.

Excellent! The chessboard module I linked uses some modern concepts that you may not encounter for a while so I drafted something for you to crib as a head start below. Note that this is not going to work in Internet Explorer.



JavaScript:
// We are using ES6 imports so this needs to be inside script type="module" -
// this is handled automatically in CodePen.
import { Chessboard } from "https://cdn.jsdelivr.net/npm/cm-chessboard@3/src/cm-chessboard/Chessboard.js";
// Note we have also loaded the following module which creates the Chess global.
// https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.11.0/chess.min.js

// Set up a 'game' in FEN.
const game = new Chess("8/8/8/8/8/8/8/1N6 w - - 0 1");

// Some moves in PGN.
const moves = "b1-c3,c3-a2,a2-c1,c1-b3,b3-a1,a1-c2,c2-a3,a3-b2".split(",");

// Select DOM element as a target.
const el = document.querySelector("#board");
// Set the sprites to use for pieces (the default doesn't work when loading from a CDN).
const url =
  "https://cdn.jsdelivr.net/npm/cm-chessboard@3/assets/images/chessboard-sprite-staunty.svg";

// Create the board.
const board = new Chessboard(el, {
  sprite: { url },
  // Move more slowly (default 300ms).
  animationDuration: 1000
});

// Log a move into the DOM.
function logMove(move) {
  document.querySelector("#moves").innerHTML += ` ${move.slice(-2)}`;
}

// Mark a move on the board.
function markMove(move) {
  board.addMarker(move.slice(-2));
}

// This function is declared asynchronous so we can use 'await'.
async function play() {
  // Log the initial position;
  document.querySelector("#moves").innerHTML = moves[0].substring(0, 2);

  // Set up the board then mark the initial position.
  await board.setPosition(game.fen());
  board.addMarker(moves[0].substring(0, 2));

  // Iterate through the moves.
  for (let i = 0; i < moves.length; ++i) {
    const move = moves[i];
    logMove(move);

    // Try to execute the move.
    if (!game.move(move, { sloppy: true })) {
      // Log an illegal move and stop playing.
      document.querySelector("#moves").innerHTML += " Illegal move";
      break;
    }
    // The move was successful so execute the move on the board and mark the square.
    // Note that setPosition() returns a Promise that is resolved when the move is
    // complete, so wait for it before continuing.
    await board.setPosition(game.fen());
    markMove(move);

    // Reset the game from the displayed board otherwise it will be black's turn!
    game.load(board.getPosition() + " w - - 0 1");
  }
}

// Wait for a bit before we start moving things around.
const timer = setTimeout(play, 2000);
 
  • Like
Likes   Reactions: PeroK

Similar threads

Replies
4
Views
3K
Replies
2
Views
6K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
2
Views
3K
  • · Replies 70 ·
3
Replies
70
Views
5K
Replies
7
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 29 ·
Replies
29
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 22 ·
Replies
22
Views
4K