Compare commits

..

No commits in common. "5a42113764c1130cf4a1acb645a85d333c2fb40f" and "77d4ce2a8cc7a01f35d4cf92a5789b66ee01b47c" have entirely different histories.

2 changed files with 25 additions and 109 deletions

View File

@ -991,11 +991,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
endSet += startPos.which.isLeft() ? +1 : -1;
break;
}
const startPosition = {
...startPos,
hands: new Map<Hand, HandConnection>([[hand, { hand, to }]]),
facing: startPos.which.facingAcross(),
};
const startPosition = { ...startPos, hands: new Map<Hand, HandConnection>([[hand, { hand, to }]]) };
const turnTo = hand === Hand.Right ? HandTo.DancerRight : HandTo.DancerLeft;
@ -1034,11 +1030,10 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
})
], startPosition);
} else {
const startingPos = { ...startPos, facing: startPos.which.facingAcross() };
return combine([
{
beats: pullBeats,
endPosition: startingPos,
endPosition: startPos,
movementPattern: {
kind: SemanticAnimationKind.StandStill,
}
@ -1046,7 +1041,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
{
beats: turnBeats,
endPosition: {
...startingPos,
...startPos,
// TODO Does CourtesyTurn always end in same position?
which: startPos.which,
},
@ -1054,7 +1049,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
kind: SemanticAnimationKind.CourtesyTurn,
}
}
], startingPos);
], startPos);
}
});
@ -1431,22 +1426,17 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
const centerShoulder = firstPassInCenter === move.parameters.shoulder ? Hand.Right : Hand.Left;
const endsShoulder = centerShoulder.opposite();
return handleMove(({ id, startPos }) => {
const endsInCircle = startPos.kind === PositionKind.Circle;
type HeyStep = {
kind: "StandStill" | "Loop" | "CenterPass" | "EndsPassIn" | "EndsPassOut",
kind: "Loop" | "CenterPass" | "EndsPass",
endPosition: SemanticPosition,
}
function heyStepToPartialLowLevelMove(heyStep: HeyStep): PartialLowLevelMove & { heyStep: HeyStep } {
return {
beats: heyPartBeats,
// TODO use circle positions on ends? ... unless hey ends in a box the gnat or similar...
endPosition: heyStep.endPosition,
movementPattern: heyStep.kind === "StandStill" ? {
kind: SemanticAnimationKind.StandStill,
} : heyStep.kind === "Loop" ? {
movementPattern: heyStep.kind === "Loop" ? {
// TODO Loop should probably be its own kind? Or RotateAround?
kind: SemanticAnimationKind.Linear,
minRotation: endsShoulder === Hand.Right ? +180 : -180,
} : {
kind: SemanticAnimationKind.PassBy,
around: heyStep.kind === "CenterPass" ? "Center" : heyStep.endPosition.which.leftRightSide(),
@ -1456,18 +1446,12 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
heyStep,
};
}
function continueHey(prevStep: HeyStep, stepsLeft: number): HeyStep {
function continueHey(prevStep: HeyStep, isLast: boolean): HeyStep {
// Continuing hey so everyone is either passing (in center or on ends) or looping on ends.
if (prevStep.endPosition.kind === PositionKind.Circle) {
if (prevStep.endPosition.facing === prevStep.endPosition.which.facingAcross()) {
if (stepsLeft === 0) {
// Hasn't started hey yet, passing on ends to enter hey.
return {
kind: "StandStill",
endPosition: prevStep.endPosition,
}
}
return {
kind: "EndsPassIn",
kind: "EndsPass",
endPosition: {
kind: PositionKind.ShortLines,
which: prevStep.endPosition.which.isLeft() ? ShortLinesPosition.MiddleLeft : ShortLinesPosition.MiddleRight,
@ -1477,52 +1461,16 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
},
}
}
else {
if (stepsLeft === 1 && !endsInCircle) {
return {
kind: "Loop",
endPosition: {
kind: PositionKind.ShortLines,
which: prevStep.endPosition.which.isLeft() ? ShortLinesPosition.FarLeft : ShortLinesPosition.FarRight,
facing: prevStep.endPosition.which.facingAcross(),
setOffset: prevStep.endPosition.setOffset,
lineOffset: prevStep.endPosition.lineOffset,
},
}
}
return {
kind: "Loop",
endPosition: {
...prevStep.endPosition,
which: prevStep.endPosition.which.swapUpAndDown(),
facing: prevStep.endPosition.which.facingAcross()
},
}
}
}
else if (prevStep.endPosition.kind === PositionKind.ShortLines) {
const isFacingSide = prevStep.endPosition.facing === prevStep.endPosition.which.facingSide();
const inMiddle = prevStep.endPosition.which.isMiddle();
if (!inMiddle && !isFacingSide) {
if (!prevStep.endPosition.which.isMiddle() && !isFacingSide) {
return {
kind: "Loop",
endPosition: { ...prevStep.endPosition, facing: prevStep.endPosition.which.facingSide() },
}
} else if (inMiddle && isFacingSide) {
} else {
return {
kind: "EndsPassOut",
endPosition: {
...prevStep.endPosition,
kind: PositionKind.Circle,
which: prevStep.endPosition.which.isLeft()
? (endsShoulder === Hand.Right ? CirclePosition.TopLeft : CirclePosition.BottomLeft)
: (endsShoulder === Hand.Right ? CirclePosition.BottomRight : CirclePosition.TopRight),
},
}
}
else {
return {
kind: isFacingSide ? (inMiddle ? "EndsPassOut" : "EndsPassIn") : "CenterPass",
kind: isFacingSide ? "EndsPass" : "CenterPass",
endPosition: {
...prevStep.endPosition,
which: isFacingSide ? prevStep.endPosition.which.swapOnSide() : prevStep.endPosition.which.swapSides()
@ -1537,49 +1485,18 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
let firstHeyStep: HeyStep;
let startingPos: SemanticPosition;
if (firstPassInCenter) {
if (startPos.kind !== PositionKind.Circle) {
throw new Error("Hey starting in center not from circle is unsupported.");
}
const inCenterFirst = findPairOpposite(move.parameters.who, id) !== null;
startingPos = {
kind: startPos.kind,
which: startPos.which,
facing: startPos.which.isLeft() ? Facing.Right : Facing.Left,
setOffset: startPos.setOffset,
lineOffset: startPos.lineOffset,
};
if (inCenterFirst) {
firstHeyStep = {
kind: "CenterPass",
endPosition: {
kind: PositionKind.ShortLines,
which: startPos.which.isLeft() ? ShortLinesPosition.MiddleRight : ShortLinesPosition.MiddleLeft,
facing: startingPos.facing,
setOffset: startPos.setOffset,
lineOffset: startPos.lineOffset,
}
};
} else {
firstHeyStep = {
kind: "StandStill",
endPosition: startingPos,
}
}
// TODO This is probably the most common kind of hey, definitely top priority.
throw new Error("Hey starting passing in center is unsupported.");
} else {
if (startPos.kind !== PositionKind.ShortLines) {
throw new Error("Hey with first pass on ends must start approximately in short lines.");
}
const startFacing = startPos.which.facingSide();
startingPos = {
kind: startPos.kind,
which: startPos.which,
facing: startFacing,
setOffset: startPos.setOffset,
lineOffset: startPos.lineOffset,
};
startingPos = { ...startPos, facing: startFacing, hands: undefined };
firstHeyStep = {
kind: startingPos.which.isMiddle() ? "EndsPassOut" : "EndsPassIn",
kind: "EndsPass",
endPosition: { ...startingPos, which: startPos.which.swapOnSide() },
}
}
@ -1587,7 +1504,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
const heySteps: HeyStep[] = [firstHeyStep];
for(let i = 1; i < heyParts; i++) {
const isLast = i === heyParts - 1;
const nextHeyStep = continueHey(heySteps[i - 1], heyParts - i - 1);
const nextHeyStep = continueHey(heySteps[i - 1], isLast);
heySteps.push(nextHeyStep);
}
return combine(heySteps.map(heyStepToPartialLowLevelMove), { ...startingPos, hands: undefined });

View File

@ -92,7 +92,6 @@ updateCanvasSettings({});
const bpmSelector = document.createElement('input');
bpmSelector.type = 'number';
bpmSelector.value = '180';
bpmSelector.step = '20';
bpmSelector.id = 'bpm';
bpmSelector.style.width = '4em';
const bpmLabel = document.createElement('label');