forked from perelman/contra-renderer
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.
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import { Move } from "../libfigureMapper.js";
|
|
import { SemanticAnimationKind } from "../lowLevelMove.js";
|
|
import { Hand } from "../rendererConstants.js";
|
|
import { ISingleVariantMoveInterpreter, LowLevelMovesForAllDancers, MoveInterpreter, SemanticPositionsForAllDancers, SingleVariantMoveInterpreter, moveInterpreters } from "./_moveInterpreter.js";
|
|
|
|
const moveName: Move["move"] = "right left through";
|
|
|
|
class RightLeftThroughSingleVariant extends SingleVariantMoveInterpreter<RightLeftThrough, typeof moveName> {
|
|
moveAsLowLevelMoves(): LowLevelMovesForAllDancers {
|
|
if (this.move.parameters.dir !== "across") {
|
|
throw new Error(this.move.move + " with dir " + this.move.parameters.dir + " is unsupported.");
|
|
}
|
|
|
|
return this.handleCircleMove(({ startPos }) => {
|
|
const startingPos = { ...startPos, facing: startPos.which.facingAcross() };
|
|
const swappedPos = { ...startingPos, which: startingPos.which.swapAcross() };
|
|
return this.combine([
|
|
{
|
|
beats: this.move.beats / 2,
|
|
endPosition: swappedPos,
|
|
movementPattern: {
|
|
kind: SemanticAnimationKind.PassBy,
|
|
side: Hand.Right,
|
|
withHands: true,
|
|
facing: "Start",
|
|
around: startingPos.which.topBottomSide(),
|
|
otherPath: "Swap",
|
|
},
|
|
},
|
|
{
|
|
beats: this.move.beats / 2,
|
|
endPosition: {
|
|
...startingPos,
|
|
which: startingPos.which.swapDiagonal(),
|
|
facing: startingPos.which.facingOut()
|
|
},
|
|
movementPattern: {
|
|
kind: SemanticAnimationKind.CourtesyTurn,
|
|
},
|
|
}
|
|
], startingPos);
|
|
});
|
|
}
|
|
}
|
|
|
|
class RightLeftThrough extends MoveInterpreter<typeof moveName> {
|
|
buildSingleVariantMoveInterpreter(startingPos: SemanticPositionsForAllDancers): ISingleVariantMoveInterpreter {
|
|
return new RightLeftThroughSingleVariant(this, startingPos);
|
|
}
|
|
}
|
|
|
|
moveInterpreters.set(moveName, RightLeftThrough); |