|
|
|
@ -260,10 +260,16 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
withPos: SemanticPosition & { setOffset: number, lineOffset: number },
|
|
|
|
|
withId: common.ExtendedDancerIdentity,
|
|
|
|
|
around: CircleSideOrCenter,
|
|
|
|
|
}) => LowLevelMove[]), meanwhileFunc?: ((arg: {
|
|
|
|
|
id: DancerIdentity,
|
|
|
|
|
startPos: SemanticPosition,
|
|
|
|
|
}) => LowLevelMove[])): Map<DancerIdentity, LowLevelMove[]> {
|
|
|
|
|
return handleMove(({ id, startPos }) => {
|
|
|
|
|
const withId = findPairOpposite(who, id);
|
|
|
|
|
if (!withId) {
|
|
|
|
|
if (meanwhileFunc) {
|
|
|
|
|
return meanwhileFunc({ id, startPos });
|
|
|
|
|
} else {
|
|
|
|
|
return combine([{
|
|
|
|
|
beats: move.beats,
|
|
|
|
|
startPosition: { ...startPos, hands: undefined },
|
|
|
|
@ -271,6 +277,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
movementPattern: { kind: SemanticAnimationKind.StandStill },
|
|
|
|
|
}]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const withPos = getPosFor(withId);
|
|
|
|
|
const setDifference = withPos.setOffset - (startPos.setOffset ?? 0);
|
|
|
|
|
let startPosAdjusted = startPos;
|
|
|
|
@ -450,20 +457,27 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
case "mad robin":
|
|
|
|
|
return handleCircleMove(({ startPos }) => {
|
|
|
|
|
// TODO Read who of mad robin to decide direction?
|
|
|
|
|
const startAndEndPos = {
|
|
|
|
|
...startPos,
|
|
|
|
|
facing: startPos.which.isLeft() ? Facing.Right : Facing.Left,
|
|
|
|
|
hands: undefined,
|
|
|
|
|
};
|
|
|
|
|
if (move.parameters.circling !== 360) {
|
|
|
|
|
throw new Error("mad robin circling not exactly once is unsupported.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return handleCircleMove(({ id, startPos }) => {
|
|
|
|
|
// Read who of mad robin to decide direction.
|
|
|
|
|
const madRobinClockwise: boolean = (findPairOpposite(move.parameters.who, id) !== null) === startPos.which.isOnLeftLookingAcross();
|
|
|
|
|
|
|
|
|
|
const startAndEndPos: SemanticPosition = {
|
|
|
|
|
kind: PositionKind.Circle,
|
|
|
|
|
which: startPos.which,
|
|
|
|
|
facing: startPos.which.facingAcross(),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return combine([{
|
|
|
|
|
beats: move.beats,
|
|
|
|
|
startPosition: startAndEndPos,
|
|
|
|
|
endPosition: startAndEndPos,
|
|
|
|
|
movementPattern: {
|
|
|
|
|
kind: SemanticAnimationKind.DoSiDo,
|
|
|
|
|
amount: move.parameters.circling,
|
|
|
|
|
amount: madRobinClockwise ? move.parameters.circling : -move.parameters.circling,
|
|
|
|
|
around: startPos.which.leftRightSide(),
|
|
|
|
|
},
|
|
|
|
|
}]);
|
|
|
|
@ -641,6 +655,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
minAmount: 360,
|
|
|
|
|
around,
|
|
|
|
|
byHand: undefined,
|
|
|
|
|
close: true,
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
swing,
|
|
|
|
@ -684,14 +699,17 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
case "allemande":
|
|
|
|
|
case "allemande orbit":
|
|
|
|
|
case "gyre":
|
|
|
|
|
const allemandeCircling = move.move === "allemande orbit" ? move.parameters.circling1 : move.parameters.circling;
|
|
|
|
|
const byHandOrShoulder = (move.move === "gyre" ? move.parameters.shoulder : move.parameters.hand) ? Hand.Right : Hand.Left;
|
|
|
|
|
|
|
|
|
|
return handlePairedMove(move.parameters.who, ({ startPos, around, withId }) => {
|
|
|
|
|
// TODO Not sure if this is right.
|
|
|
|
|
const byHandOrShoulder = (move.move === "allemande" ? move.parameters.hand : move.parameters.shoulder) ? Hand.Right : Hand.Left;
|
|
|
|
|
const swap = move.parameters.circling % 360 === 180;
|
|
|
|
|
if (!swap && move.parameters.circling % 360 !== 0) {
|
|
|
|
|
const swap = allemandeCircling % 360 === 180;
|
|
|
|
|
if (!swap && allemandeCircling % 360 !== 0) {
|
|
|
|
|
// TODO Support allemande that's not a swap or no-op.
|
|
|
|
|
throw "Unsupported allemande circle amount: " + move.parameters.circling;
|
|
|
|
|
throw "Unsupported allemande circle amount: " + allemandeCircling;
|
|
|
|
|
}
|
|
|
|
|
let endPosition: SemanticPosition = startPos;
|
|
|
|
|
if (swap) {
|
|
|
|
@ -706,12 +724,62 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
endPosition,
|
|
|
|
|
movementPattern: {
|
|
|
|
|
kind: SemanticAnimationKind.RotateAround,
|
|
|
|
|
minAmount: byHandOrShoulder === Hand.Right ? move.parameters.circling : -move.parameters.circling,
|
|
|
|
|
minAmount: byHandOrShoulder === Hand.Right ? allemandeCircling : -allemandeCircling,
|
|
|
|
|
around,
|
|
|
|
|
byHand: move.move === "allemande" ? byHandOrShoulder : undefined,
|
|
|
|
|
byHand: move.move === "allemande" || move.move === "allemande orbit" ? byHandOrShoulder : undefined,
|
|
|
|
|
close: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
], startPos);
|
|
|
|
|
}, move.move !== "allemande orbit" ? undefined : ({ id, startPos}) => {
|
|
|
|
|
const orbitAmount = move.parameters.circling2;
|
|
|
|
|
const swap = orbitAmount % 360 === 180;
|
|
|
|
|
if (!swap && orbitAmount % 360 !== 0) {
|
|
|
|
|
// TODO Support allemande that's not a swap or no-op.
|
|
|
|
|
throw "Unsupported allemande orbit amount: " + orbitAmount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const startingPos: SemanticPosition = {
|
|
|
|
|
...startPos,
|
|
|
|
|
hands: undefined,
|
|
|
|
|
balance: undefined,
|
|
|
|
|
dancerDistance: undefined,
|
|
|
|
|
}
|
|
|
|
|
let endPosition: SemanticPosition;
|
|
|
|
|
if (swap) {
|
|
|
|
|
if (startingPos.kind === PositionKind.Circle) {
|
|
|
|
|
endPosition =
|
|
|
|
|
{
|
|
|
|
|
...startingPos,
|
|
|
|
|
which: startingPos.which.swapDiagonal(),
|
|
|
|
|
facing: startingPos.which.isLeft() ? Facing.Left : Facing.Right,
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
endPosition =
|
|
|
|
|
{
|
|
|
|
|
...startingPos,
|
|
|
|
|
which: startingPos.which.swapSides(),
|
|
|
|
|
facing: startingPos.which.isLeft() ? Facing.Left : Facing.Right,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
endPosition = startingPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return combine([
|
|
|
|
|
{
|
|
|
|
|
beats: move.beats,
|
|
|
|
|
endPosition,
|
|
|
|
|
movementPattern: {
|
|
|
|
|
kind: SemanticAnimationKind.RotateAround,
|
|
|
|
|
// Orbit is opposite direction of allemande.
|
|
|
|
|
minAmount: byHandOrShoulder === Hand.Right ? -orbitAmount : +orbitAmount,
|
|
|
|
|
around: "Center",
|
|
|
|
|
byHand: undefined,
|
|
|
|
|
close: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
], startingPos);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
case "revolving door":
|
|
|
|
@ -738,6 +806,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
minAmount: byHand === Hand.Right ? 180 : -180,
|
|
|
|
|
around: "Center",
|
|
|
|
|
byHand,
|
|
|
|
|
close: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
prevEnd => ({
|
|
|
|
@ -756,6 +825,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
minAmount: byHand === Hand.Right ? 180 : -180,
|
|
|
|
|
around: "Center",
|
|
|
|
|
byHand,
|
|
|
|
|
close: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
], startPos);
|
|
|
|
@ -1385,12 +1455,31 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
|
|
|
|
|
case "pass through":
|
|
|
|
|
if (move.parameters.dir !== "along") {
|
|
|
|
|
throw new Error("Unsupport pass through direction: " + move.parameters.dir);
|
|
|
|
|
throw new Error("Unsupported pass through direction: " + move.parameters.dir);
|
|
|
|
|
}
|
|
|
|
|
const passShoulder = move.parameters.shoulder ? Hand.Right : Hand.Left;
|
|
|
|
|
return handleMove(({ startPos }) => {
|
|
|
|
|
if (startPos.kind !== PositionKind.ShortLines) {
|
|
|
|
|
throw new Error("pass through from circle is unsupported");
|
|
|
|
|
}
|
|
|
|
|
if (startPos.kind === PositionKind.Circle) {
|
|
|
|
|
const facing = startPos.which.facingUpOrDown();
|
|
|
|
|
const endPos: SemanticPosition = {
|
|
|
|
|
kind: PositionKind.Circle,
|
|
|
|
|
which: startPos.which,
|
|
|
|
|
facing,
|
|
|
|
|
setOffset: (startPos.setOffset ?? 0) + (facing === Facing.Up ? -0.5 : +0.5),
|
|
|
|
|
lineOffset: startPos.lineOffset,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return combine([{
|
|
|
|
|
beats: move.beats,
|
|
|
|
|
endPosition: endPos,
|
|
|
|
|
movementPattern: {
|
|
|
|
|
kind: SemanticAnimationKind.PassBy,
|
|
|
|
|
around: startPos.which.leftRightSide(),
|
|
|
|
|
side: passShoulder,
|
|
|
|
|
withHands: false,
|
|
|
|
|
},
|
|
|
|
|
}], startPos);
|
|
|
|
|
} else {
|
|
|
|
|
// TODO This assumes short *wavy* lines.
|
|
|
|
|
|
|
|
|
|
const endPos: SemanticPosition = {
|
|
|
|
@ -1405,6 +1494,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
|
|
|
|
endPosition: endPos,
|
|
|
|
|
movementPattern: { kind: SemanticAnimationKind.Linear },
|
|
|
|
|
}], startPos);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
case "hey":
|
|
|
|
|