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.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { Facing, handsInCircle } from "../interpreterCommon.js";
|
|
import { Move } from "../libfigureMapper.js";
|
|
import { SemanticAnimationKind } from "../lowLevelMove.js";
|
|
import { ISingleVariantMoveInterpreter, LowLevelMovesForAllDancers, MoveInterpreter, SemanticPositionsForAllDancers, SingleVariantMoveInterpreter, moveInterpreters } from "./_moveInterpreter.js";
|
|
|
|
const moveName: Move["move"] = "circle";
|
|
|
|
class CircleSingleVariant extends SingleVariantMoveInterpreter<Circle, typeof moveName> {
|
|
moveAsLowLevelMoves(): LowLevelMovesForAllDancers {
|
|
return this.handleCircleMove(({ startPos }) => {
|
|
const places = this.move.parameters.places / 90 * (this.move.parameters.turn ? 1 : -1);
|
|
|
|
return this.combine([
|
|
{
|
|
beats: this.move.beats,
|
|
endPosition: {
|
|
...startPos,
|
|
facing: Facing.CenterOfCircle,
|
|
hands: handsInCircle,
|
|
which: startPos.which.circleLeft(places),
|
|
},
|
|
movementPattern: {
|
|
kind: SemanticAnimationKind.Circle,
|
|
places,
|
|
}
|
|
},
|
|
], { ...startPos, facing: Facing.CenterOfCircle });
|
|
});
|
|
}
|
|
}
|
|
|
|
class Circle extends MoveInterpreter<typeof moveName> {
|
|
buildSingleVariantMoveInterpreter(startingPos: SemanticPositionsForAllDancers): ISingleVariantMoveInterpreter {
|
|
return new CircleSingleVariant(this, startingPos);
|
|
}
|
|
}
|
|
|
|
moveInterpreters.set(moveName, Circle); |