Daniel Perelman
9fbf7d18ac
Currently just copied over the existing code and applied the quick fixes to get it to compile. Each move should be refactored to be handle its parameters earlier where applicable. But variants support should probably be added first so both refactors can happen together.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { SemanticAnimationKind } from "../lowLevelMove.js";
|
|
import { ISingleVariantMoveInterpreter, LowLevelMovesForAllDancers, MoveInterpreter, SemanticPositionsForAllDancers, SingleVariantMoveInterpreter, moveInterpreters } from "./_moveInterpreter.js";
|
|
|
|
class CustomSingleVariant extends SingleVariantMoveInterpreter<Custom, "custom"> {
|
|
moveAsLowLevelMoves(): LowLevelMovesForAllDancers {
|
|
// TODO refactor so this is in separate classes?
|
|
if (this.move.parameters.custom.includes("mirrored mad robin")) {
|
|
return this.handleCircleMove(({ id, startPos }) => {
|
|
// TODO Read custom to decide direction?
|
|
const startAndEndPos = {
|
|
...startPos,
|
|
facing: startPos.which.facingAcross(),
|
|
hands: undefined,
|
|
};
|
|
return this.combine([{
|
|
beats: this.move.beats,
|
|
startPosition: startAndEndPos,
|
|
endPosition: startAndEndPos,
|
|
movementPattern: {
|
|
kind: SemanticAnimationKind.DoSiDo,
|
|
amount: startPos.which.isLeft() ? -360 : 360,
|
|
around: startPos.which.leftRightSide(),
|
|
},
|
|
}]);
|
|
});
|
|
} else {
|
|
return this.errorStandStill();
|
|
}
|
|
}
|
|
}
|
|
|
|
class Custom extends MoveInterpreter<"custom"> {
|
|
buildSingleVariantMoveInterpreter(startingPos: SemanticPositionsForAllDancers): ISingleVariantMoveInterpreter {
|
|
return new CustomSingleVariant(this, startingPos);
|
|
}
|
|
}
|
|
|
|
moveInterpreters.set("custom", Custom); |