Compare commits
No commits in common. "5a42113764c1130cf4a1acb645a85d333c2fb40f" and "77d4ce2a8cc7a01f35d4cf92a5789b66ee01b47c" have entirely different histories.
5a42113764
...
77d4ce2a8c
|
@ -991,11 +991,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
endSet += startPos.which.isLeft() ? +1 : -1;
|
endSet += startPos.which.isLeft() ? +1 : -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const startPosition = {
|
const startPosition = { ...startPos, hands: new Map<Hand, HandConnection>([[hand, { hand, to }]]) };
|
||||||
...startPos,
|
|
||||||
hands: new Map<Hand, HandConnection>([[hand, { hand, to }]]),
|
|
||||||
facing: startPos.which.facingAcross(),
|
|
||||||
};
|
|
||||||
|
|
||||||
const turnTo = hand === Hand.Right ? HandTo.DancerRight : HandTo.DancerLeft;
|
const turnTo = hand === Hand.Right ? HandTo.DancerRight : HandTo.DancerLeft;
|
||||||
|
|
||||||
|
@ -1034,11 +1030,10 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
})
|
})
|
||||||
], startPosition);
|
], startPosition);
|
||||||
} else {
|
} else {
|
||||||
const startingPos = { ...startPos, facing: startPos.which.facingAcross() };
|
|
||||||
return combine([
|
return combine([
|
||||||
{
|
{
|
||||||
beats: pullBeats,
|
beats: pullBeats,
|
||||||
endPosition: startingPos,
|
endPosition: startPos,
|
||||||
movementPattern: {
|
movementPattern: {
|
||||||
kind: SemanticAnimationKind.StandStill,
|
kind: SemanticAnimationKind.StandStill,
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1041,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
{
|
{
|
||||||
beats: turnBeats,
|
beats: turnBeats,
|
||||||
endPosition: {
|
endPosition: {
|
||||||
...startingPos,
|
...startPos,
|
||||||
// TODO Does CourtesyTurn always end in same position?
|
// TODO Does CourtesyTurn always end in same position?
|
||||||
which: startPos.which,
|
which: startPos.which,
|
||||||
},
|
},
|
||||||
|
@ -1054,7 +1049,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
kind: SemanticAnimationKind.CourtesyTurn,
|
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 centerShoulder = firstPassInCenter === move.parameters.shoulder ? Hand.Right : Hand.Left;
|
||||||
const endsShoulder = centerShoulder.opposite();
|
const endsShoulder = centerShoulder.opposite();
|
||||||
return handleMove(({ id, startPos }) => {
|
return handleMove(({ id, startPos }) => {
|
||||||
const endsInCircle = startPos.kind === PositionKind.Circle;
|
|
||||||
type HeyStep = {
|
type HeyStep = {
|
||||||
kind: "StandStill" | "Loop" | "CenterPass" | "EndsPassIn" | "EndsPassOut",
|
kind: "Loop" | "CenterPass" | "EndsPass",
|
||||||
endPosition: SemanticPosition,
|
endPosition: SemanticPosition,
|
||||||
}
|
}
|
||||||
function heyStepToPartialLowLevelMove(heyStep: HeyStep): PartialLowLevelMove & { heyStep: HeyStep } {
|
function heyStepToPartialLowLevelMove(heyStep: HeyStep): PartialLowLevelMove & { heyStep: HeyStep } {
|
||||||
return {
|
return {
|
||||||
beats: heyPartBeats,
|
beats: heyPartBeats,
|
||||||
// TODO use circle positions on ends? ... unless hey ends in a box the gnat or similar...
|
|
||||||
endPosition: heyStep.endPosition,
|
endPosition: heyStep.endPosition,
|
||||||
movementPattern: heyStep.kind === "StandStill" ? {
|
movementPattern: heyStep.kind === "Loop" ? {
|
||||||
kind: SemanticAnimationKind.StandStill,
|
|
||||||
} : heyStep.kind === "Loop" ? {
|
|
||||||
// TODO Loop should probably be its own kind? Or RotateAround?
|
// TODO Loop should probably be its own kind? Or RotateAround?
|
||||||
kind: SemanticAnimationKind.Linear,
|
kind: SemanticAnimationKind.Linear,
|
||||||
minRotation: endsShoulder === Hand.Right ? +180 : -180,
|
|
||||||
} : {
|
} : {
|
||||||
kind: SemanticAnimationKind.PassBy,
|
kind: SemanticAnimationKind.PassBy,
|
||||||
around: heyStep.kind === "CenterPass" ? "Center" : heyStep.endPosition.which.leftRightSide(),
|
around: heyStep.kind === "CenterPass" ? "Center" : heyStep.endPosition.which.leftRightSide(),
|
||||||
|
@ -1456,18 +1446,12 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
heyStep,
|
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.
|
// 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.kind === PositionKind.Circle) {
|
||||||
if (prevStep.endPosition.facing === prevStep.endPosition.which.facingAcross()) {
|
// Hasn't started hey yet, passing on ends to enter hey.
|
||||||
if (stepsLeft === 0) {
|
|
||||||
return {
|
return {
|
||||||
kind: "StandStill",
|
kind: "EndsPass",
|
||||||
endPosition: prevStep.endPosition,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
kind: "EndsPassIn",
|
|
||||||
endPosition: {
|
endPosition: {
|
||||||
kind: PositionKind.ShortLines,
|
kind: PositionKind.ShortLines,
|
||||||
which: prevStep.endPosition.which.isLeft() ? ShortLinesPosition.MiddleLeft : ShortLinesPosition.MiddleRight,
|
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) {
|
else if (prevStep.endPosition.kind === PositionKind.ShortLines) {
|
||||||
const isFacingSide = prevStep.endPosition.facing === prevStep.endPosition.which.facingSide();
|
const isFacingSide = prevStep.endPosition.facing === prevStep.endPosition.which.facingSide();
|
||||||
const inMiddle = prevStep.endPosition.which.isMiddle();
|
if (!prevStep.endPosition.which.isMiddle() && !isFacingSide) {
|
||||||
if (!inMiddle && !isFacingSide) {
|
|
||||||
return {
|
return {
|
||||||
kind: "Loop",
|
kind: "Loop",
|
||||||
endPosition: { ...prevStep.endPosition, facing: prevStep.endPosition.which.facingSide() },
|
endPosition: { ...prevStep.endPosition, facing: prevStep.endPosition.which.facingSide() },
|
||||||
}
|
}
|
||||||
} else if (inMiddle && isFacingSide) {
|
} else {
|
||||||
return {
|
return {
|
||||||
kind: "EndsPassOut",
|
kind: isFacingSide ? "EndsPass" : "CenterPass",
|
||||||
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",
|
|
||||||
endPosition: {
|
endPosition: {
|
||||||
...prevStep.endPosition,
|
...prevStep.endPosition,
|
||||||
which: isFacingSide ? prevStep.endPosition.which.swapOnSide() : prevStep.endPosition.which.swapSides()
|
which: isFacingSide ? prevStep.endPosition.which.swapOnSide() : prevStep.endPosition.which.swapSides()
|
||||||
|
@ -1537,49 +1485,18 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
let firstHeyStep: HeyStep;
|
let firstHeyStep: HeyStep;
|
||||||
let startingPos: SemanticPosition;
|
let startingPos: SemanticPosition;
|
||||||
if (firstPassInCenter) {
|
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;
|
const inCenterFirst = findPairOpposite(move.parameters.who, id) !== null;
|
||||||
startingPos = {
|
// TODO This is probably the most common kind of hey, definitely top priority.
|
||||||
kind: startPos.kind,
|
throw new Error("Hey starting passing in center is unsupported.");
|
||||||
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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (startPos.kind !== PositionKind.ShortLines) {
|
if (startPos.kind !== PositionKind.ShortLines) {
|
||||||
throw new Error("Hey with first pass on ends must start approximately in short lines.");
|
throw new Error("Hey with first pass on ends must start approximately in short lines.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const startFacing = startPos.which.facingSide();
|
const startFacing = startPos.which.facingSide();
|
||||||
startingPos = {
|
startingPos = { ...startPos, facing: startFacing, hands: undefined };
|
||||||
kind: startPos.kind,
|
|
||||||
which: startPos.which,
|
|
||||||
facing: startFacing,
|
|
||||||
setOffset: startPos.setOffset,
|
|
||||||
lineOffset: startPos.lineOffset,
|
|
||||||
};
|
|
||||||
firstHeyStep = {
|
firstHeyStep = {
|
||||||
kind: startingPos.which.isMiddle() ? "EndsPassOut" : "EndsPassIn",
|
kind: "EndsPass",
|
||||||
endPosition: { ...startingPos, which: startPos.which.swapOnSide() },
|
endPosition: { ...startingPos, which: startPos.which.swapOnSide() },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1587,7 +1504,7 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
const heySteps: HeyStep[] = [firstHeyStep];
|
const heySteps: HeyStep[] = [firstHeyStep];
|
||||||
for(let i = 1; i < heyParts; i++) {
|
for(let i = 1; i < heyParts; i++) {
|
||||||
const isLast = i === heyParts - 1;
|
const isLast = i === heyParts - 1;
|
||||||
const nextHeyStep = continueHey(heySteps[i - 1], heyParts - i - 1);
|
const nextHeyStep = continueHey(heySteps[i - 1], isLast);
|
||||||
heySteps.push(nextHeyStep);
|
heySteps.push(nextHeyStep);
|
||||||
}
|
}
|
||||||
return combine(heySteps.map(heyStepToPartialLowLevelMove), { ...startingPos, hands: undefined });
|
return combine(heySteps.map(heyStepToPartialLowLevelMove), { ...startingPos, hands: undefined });
|
||||||
|
|
|
@ -92,7 +92,6 @@ updateCanvasSettings({});
|
||||||
const bpmSelector = document.createElement('input');
|
const bpmSelector = document.createElement('input');
|
||||||
bpmSelector.type = 'number';
|
bpmSelector.type = 'number';
|
||||||
bpmSelector.value = '180';
|
bpmSelector.value = '180';
|
||||||
bpmSelector.step = '20';
|
|
||||||
bpmSelector.id = 'bpm';
|
bpmSelector.id = 'bpm';
|
||||||
bpmSelector.style.width = '4em';
|
bpmSelector.style.width = '4em';
|
||||||
const bpmLabel = document.createElement('label');
|
const bpmLabel = document.createElement('label');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user