Example #1
0
  animCursorChanged(cursor: Cursor<Puzzle>) {
    var pos = cursor.currentPosition();
    if (pos.moves.length > 0) {

      var move = (pos.moves[0].move as BlockMove);

      var def = this.definition;
      var partialMove = new BlockMove(move.outerLayer, move.innerLayer, move.family, move.amount * pos.moves[0].direction)
      var newState = Combine(
        def,
        pos.state as Transformation,
        stateForBlockMove(def, partialMove)
      );
      this.svg.draw(this.definition, pos.state as Transformation, newState, pos.moves[0].fraction);
    } else {
      this.svg.draw(this.definition, pos.state as Transformation);
    }
  }
Example #2
0
 stateFromMove(blockMove: BlockMove): KSolvePuzzleState {
   return stateForBlockMove(this.definition, blockMove);
 }