mp_puzzle
Perplexing Puzzles
PuzzleAnimation Class Reference

Puzzle animation utility class. More...

#include <PuzzleAnimation.h>

Public Member Functions

 PuzzleAnimation (std::vector< PuzzleState > const &transitions)
 Constructs an animated puzzle with numeric board. More...
 
 PuzzleAnimation (std::string const &img_path, std::vector< PuzzleState > const &transitions)
 Constructs an animated puzzle with an image board. More...
 
void writeToFile (std::string fname)
 Writes the animation to an SVG file, you can open any modern browser, or use an SVG VSCode extension to view the SVG. More...
 

Public Attributes

double width = 200
 width of the svg More...
 
double height = 200
 height of the svg More...
 
double tileSize = std::min(width, height) / 4
 size of each tile More...
 
double stepDuration = 0.3
 duration of each animation step in seconds More...
 

Detailed Description

Puzzle animation utility class.

Constructor & Destructor Documentation

◆ PuzzleAnimation() [1/2]

PuzzleAnimation::PuzzleAnimation ( std::vector< PuzzleState > const &  transitions)
inline

Constructs an animated puzzle with numeric board.

Parameters
transitionssame as the results from solveAstar/solveBFS

◆ PuzzleAnimation() [2/2]

PuzzleAnimation::PuzzleAnimation ( std::string const &  img_path,
std::vector< PuzzleState > const &  transitions 
)
inline

Constructs an animated puzzle with an image board.

Parameters
img_pathpath the image used for animation
transitionssame as the results from solveAstar/solveBFS

Member Function Documentation

◆ writeToFile()

void PuzzleAnimation::writeToFile ( std::string  fname)

Writes the animation to an SVG file, you can open any modern browser, or use an SVG VSCode extension to view the SVG.

Parameters
fnamename of the file

Member Data Documentation

◆ height

double PuzzleAnimation::height = 200

height of the svg

◆ stepDuration

double PuzzleAnimation::stepDuration = 0.3

duration of each animation step in seconds

◆ tileSize

double PuzzleAnimation::tileSize = std::min(width, height) / 4

size of each tile

◆ width

double PuzzleAnimation::width = 200

width of the svg


The documentation for this class was generated from the following files: