Compare commits

..

No commits in common. "835b4c6d03e799400d83698e6bc4a6f275925036" and "5a42113764c1130cf4a1acb645a85d333c2fb40f" have entirely different histories.

4 changed files with 39 additions and 138 deletions

View File

@ -260,23 +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 },
endPosition: { ...startPos, hands: undefined },
movementPattern: { kind: SemanticAnimationKind.StandStill },
}]);
}
return combine([{
beats: move.beats,
startPosition: { ...startPos, hands: undefined },
endPosition: { ...startPos, hands: undefined },
movementPattern: { kind: SemanticAnimationKind.StandStill },
}]);
}
const withPos = getPosFor(withId);
const setDifference = withPos.setOffset - (startPos.setOffset ?? 0);
@ -457,27 +450,20 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
});
case "mad robin":
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 handleCircleMove(({ startPos }) => {
// TODO Read who of mad robin to decide direction?
const startAndEndPos = {
...startPos,
facing: startPos.which.isLeft() ? Facing.Right : Facing.Left,
hands: undefined,
};
return combine([{
beats: move.beats,
startPosition: startAndEndPos,
endPosition: startAndEndPos,
movementPattern: {
kind: SemanticAnimationKind.DoSiDo,
amount: madRobinClockwise ? move.parameters.circling : -move.parameters.circling,
amount: move.parameters.circling,
around: startPos.which.leftRightSide(),
},
}]);
@ -655,7 +641,6 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
minAmount: 360,
around,
byHand: undefined,
close: true,
},
}),
swing,
@ -699,17 +684,14 @@ 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 swap = allemandeCircling % 360 === 180;
if (!swap && allemandeCircling % 360 !== 0) {
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) {
// TODO Support allemande that's not a swap or no-op.
throw "Unsupported allemande circle amount: " + allemandeCircling;
throw "Unsupported allemande circle amount: " + move.parameters.circling;
}
let endPosition: SemanticPosition = startPos;
if (swap) {
@ -724,62 +706,12 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
endPosition,
movementPattern: {
kind: SemanticAnimationKind.RotateAround,
minAmount: byHandOrShoulder === Hand.Right ? allemandeCircling : -allemandeCircling,
minAmount: byHandOrShoulder === Hand.Right ? move.parameters.circling : -move.parameters.circling,
around,
byHand: move.move === "allemande" || move.move === "allemande orbit" ? byHandOrShoulder : undefined,
close: true,
byHand: move.move === "allemande" ? byHandOrShoulder : undefined,
},
},
], 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":
@ -806,7 +738,6 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
minAmount: byHand === Hand.Right ? 180 : -180,
around: "Center",
byHand,
close: false,
},
},
prevEnd => ({
@ -825,7 +756,6 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
minAmount: byHand === Hand.Right ? 180 : -180,
around: "Center",
byHand,
close: true,
},
},
], startPos);
@ -1455,46 +1385,26 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
case "pass through":
if (move.parameters.dir !== "along") {
throw new Error("Unsupported pass through direction: " + move.parameters.dir);
throw new Error("Unsupport pass through direction: " + move.parameters.dir);
}
const passShoulder = move.parameters.shoulder ? Hand.Right : Hand.Left;
return handleMove(({ startPos }) => {
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 = {
...startPos,
balance: undefined,
which: startPos.which.swapOnSide(),
setOffset: (startPos.setOffset ?? 0) + (startPos.facing === Facing.Up ? -0.5 : +0.5),
};
return combine([{
beats: move.beats,
endPosition: endPos,
movementPattern: { kind: SemanticAnimationKind.Linear },
}], startPos);
if (startPos.kind !== PositionKind.ShortLines) {
throw new Error("pass through from circle is unsupported");
}
// TODO This assumes short *wavy* lines.
const endPos: SemanticPosition = {
...startPos,
balance: undefined,
which: startPos.which.swapOnSide(),
setOffset: (startPos.setOffset ?? 0) + (startPos.facing === Facing.Up ? -0.5 : +0.5),
};
return combine([{
beats: move.beats,
endPosition: endPos,
movementPattern: { kind: SemanticAnimationKind.Linear },
}], startPos);
});
case "hey":

View File

@ -139,10 +139,6 @@ export class CirclePosition {
return this.isLeft() ? Facing.Left : Facing.Right;
}
public facingUpOrDown() : Facing.Up | Facing.Down {
return this.isTop() ? Facing.Down : Facing.Up;
}
public toString() : string {
return this.enumValue.toString();
}

View File

@ -72,9 +72,6 @@ export type SemanticAnimation = {
around: CircleSideOrCenter,
byHand: Hand | undefined,
// If true, move in close while rotating.
close: boolean,
} | {
kind: SemanticAnimationKind.Swing,
@ -548,11 +545,10 @@ export function animateLowLevelMove(move: LowLevelMove): animation.AnimationSegm
width: setWidth / 5,
height: setHeight / 5,
},
facing: animation.RotationAnimationFacing.Center,
closer: move.movementPattern.close ? {
facing: animation.RotationAnimationFacing.Center, closer: {
transitionBeats: 1,
minDistance: setWidth,
} : undefined,
},
hands
}),
flags: {

View File

@ -520,7 +520,6 @@ function loadDance() {
cancelAnimationFrame(cancelAnim);
playButton.innerText = 'Play';
}
progressionSelector.value = '0';
beatSlider.value = '0';
beatSlider.max = r.animation.numBeats.toString();
beatDisplay.innerText = '0.0';