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.
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import { StarGrip, Facing } from "../interpreterCommon.js";
|
|
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"] = "star";
|
|
|
|
class StarSingleVariant extends SingleVariantMoveInterpreter<Star, typeof moveName> {
|
|
moveAsLowLevelMoves(): LowLevelMovesForAllDancers {
|
|
return this.handleCircleMove(({ startPos }) => {
|
|
const hand = this.move.parameters.hand ? Hand.Right : Hand.Left;
|
|
const grip = this.move.parameters.grip === "hands across"
|
|
? StarGrip.HandsAcross
|
|
: this.move.parameters.grip === "wrist grip"
|
|
? StarGrip.WristGrip
|
|
: undefined;
|
|
const facing = hand === Hand.Left ? Facing.LeftInCircle : Facing.RightInCircle;
|
|
|
|
const places = this.move.parameters.places / 90 * (hand === Hand.Right ? 1 : -1);
|
|
|
|
return this.combine([
|
|
{
|
|
beats: this.move.beats,
|
|
endPosition: {
|
|
...startPos,
|
|
facing,
|
|
hands: undefined,
|
|
which: startPos.which.circleLeft(places),
|
|
},
|
|
movementPattern: {
|
|
kind: SemanticAnimationKind.Star,
|
|
hand,
|
|
grip,
|
|
places,
|
|
}
|
|
},
|
|
], { ...startPos, facing });
|
|
});
|
|
}
|
|
}
|
|
|
|
class Star extends MoveInterpreter<typeof moveName> {
|
|
buildSingleVariantMoveInterpreter(startingPos: SemanticPositionsForAllDancers): ISingleVariantMoveInterpreter {
|
|
return new StarSingleVariant(this, startingPos);
|
|
}
|
|
}
|
|
|
|
moveInterpreters.set(moveName, Star); |