Compare commits

...

2 Commits

3 changed files with 82 additions and 39 deletions

View File

@ -4,46 +4,10 @@ import * as common from "./danceCommon.js";
import { Hand, setDistance, setHeight } from "./rendererConstants.js"; import { Hand, setDistance, setHeight } from "./rendererConstants.js";
import { nameLibFigureParameters, Move, LibFigureDance, chooser_pairz } from "./libfigureMapper.js"; import { nameLibFigureParameters, Move, LibFigureDance, chooser_pairz } from "./libfigureMapper.js";
import { LowLevelMove, SemanticAnimation, SemanticAnimationKind, animateFromLowLevelMoves } from "./lowLevelMove.js"; import { LowLevelMove, SemanticAnimation, SemanticAnimationKind, animateFromLowLevelMoves } from "./lowLevelMove.js";
import { BalanceWeight, CirclePosition, CircleSide, CircleSideOrCenter, DancerDistance, Facing, HandConnection, HandTo, LongLines, PositionKind, SemanticPosition, ShortLinesPosition, StarGrip, oppositeFacing } from "./interpreterCommon.js"; import { BalanceWeight, CirclePosition, CircleSide, CircleSideOrCenter, DancerDistance, Facing, HandConnection, HandTo, LongLines, PositionKind, SemanticPosition, ShortLinesPosition, StarGrip, handsFourImproper, handsInCircle, oppositeFacing } from "./interpreterCommon.js";
import { dancerIsPair } from "./libfigure/util.js"; import { dancerIsPair } from "./libfigure/util.js";
const handsInCircle = new Map<Hand, HandConnection>([
[Hand.Left, {
to: HandTo.LeftInCircle,
hand: Hand.Right,
}],
[Hand.Right, {
to: HandTo.RightInCircle,
hand: Hand.Left,
}],
]);
const handsFourImproper: Map<common.DancerIdentity, SemanticPosition> = new Map<common.DancerIdentity, SemanticPosition>([
[DancerIdentity.OnesLark, {
kind: PositionKind.Circle,
which: CirclePosition.TopLeft,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
[DancerIdentity.OnesRobin, {
kind: PositionKind.Circle,
which: CirclePosition.TopRight,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
[DancerIdentity.TwosLark, {
kind: PositionKind.Circle,
which: CirclePosition.BottomRight,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
[DancerIdentity.TwosRobin, {
kind: PositionKind.Circle,
which: CirclePosition.BottomLeft,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
]);
function handsInShortLine({ which, facing, wavy }: { which: ShortLinesPosition; facing: Facing.Up | Facing.Down; wavy: boolean; }): Map<Hand, HandConnection> { function handsInShortLine({ which, facing, wavy }: { which: ShortLinesPosition; facing: Facing.Up | Facing.Down; wavy: boolean; }): Map<Hand, HandConnection> {
return which.isMiddle() ? new Map<Hand, HandConnection>([ return which.isMiddle() ? new Map<Hand, HandConnection>([
[Hand.Left, { hand: wavy ? Hand.Right : Hand.Left, to: HandTo.DancerLeft }], [Hand.Left, { hand: wavy ? Hand.Right : Hand.Left, to: HandTo.DancerLeft }],
@ -1637,6 +1601,39 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
} }
}); });
case "right left through":
if (move.parameters.dir !== "across") {
throw new Error(move.move + " with dir " + move.parameters.dir + " is unsupported.");
}
return handleCircleMove(({startPos}) => {
const startingPos = { ...startPos, facing: startPos.which.facingAcross() };
return combine([
{
beats: move.beats / 2,
endPosition: {...startingPos, which: startingPos.which.swapAcross()},
movementPattern: {
kind: SemanticAnimationKind.PassBy,
side: Hand.Right,
withHands: true,
facing: "Start",
around: startingPos.which.topBottomSide(),
},
},
{
beats: move.beats / 2,
endPosition: {
...startingPos,
which: startingPos.which.swapDiagonal(),
facing: startingPos.which.facingOut()
},
movementPattern: {
kind: SemanticAnimationKind.CourtesyTurn,
},
}
], startingPos);
});
case "hey": case "hey":
if (move.parameters.dir !== "across") { if (move.parameters.dir !== "across") {
throw new Error("Unsupported hey direction: " + move.parameters.dir); throw new Error("Unsupported hey direction: " + move.parameters.dir);

View File

@ -1,4 +1,4 @@
import { Rotation } from "./danceCommon.js"; import { DancerIdentity, Rotation } from "./danceCommon.js";
import { Hand } from "./rendererConstants.js"; import { Hand } from "./rendererConstants.js";
export enum PositionKind { export enum PositionKind {
@ -326,3 +326,40 @@ export type SemanticPosition = {
balance?: BalanceWeight, balance?: BalanceWeight,
dancerDistance?: DancerDistance, dancerDistance?: DancerDistance,
}; };
export const handsInCircle = new Map<Hand, HandConnection>([
[Hand.Left, {
to: HandTo.LeftInCircle,
hand: Hand.Right,
}],
[Hand.Right, {
to: HandTo.RightInCircle,
hand: Hand.Left,
}],
]);
export const handsFourImproper: Map<DancerIdentity, SemanticPosition> = new Map<DancerIdentity, SemanticPosition>([
[DancerIdentity.OnesLark, {
kind: PositionKind.Circle,
which: CirclePosition.TopLeft,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
[DancerIdentity.OnesRobin, {
kind: PositionKind.Circle,
which: CirclePosition.TopRight,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
[DancerIdentity.TwosLark, {
kind: PositionKind.Circle,
which: CirclePosition.BottomRight,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
[DancerIdentity.TwosRobin, {
kind: PositionKind.Circle,
which: CirclePosition.BottomLeft,
facing: Facing.CenterOfCircle,
hands: handsInCircle,
}],
]);

View File

@ -1,7 +1,7 @@
import * as animation from "./animation.js"; import * as animation from "./animation.js";
import * as common from "./danceCommon.js"; import * as common from "./danceCommon.js";
import { DanceRole, DancerIdentity, Rotation } from "./danceCommon.js"; import { DanceRole, DancerIdentity, Rotation } from "./danceCommon.js";
import { BalanceWeight, CirclePosition, CircleSide, CircleSideOrCenter, DancerDistance, Facing, HandConnection, HandTo, LongLines, PositionKind, SemanticPosition, ShortLinesPosition, StarGrip } from "./interpreterCommon.js"; import { BalanceWeight, CirclePosition, CircleSide, CircleSideOrCenter, DancerDistance, Facing, HandConnection, HandTo, LongLines, PositionKind, SemanticPosition, ShortLinesPosition, StarGrip, handsInCircle } from "./interpreterCommon.js";
import { Move } from "./libfigureMapper.js"; import { Move } from "./libfigureMapper.js";
import { DancerSetPosition, Hand, Offset, OffsetPlus, OffsetRotate, OffsetTimes, OffsetTranspose, dancerHeightOffset, dancerWidth, lineDistance, offsetZero, setDistance, setHeight, setSpacing, setWidth } from "./rendererConstants.js"; import { DancerSetPosition, Hand, Offset, OffsetPlus, OffsetRotate, OffsetTimes, OffsetTranspose, dancerHeightOffset, dancerWidth, lineDistance, offsetZero, setDistance, setHeight, setSpacing, setWidth } from "./rendererConstants.js";
@ -532,6 +532,12 @@ function animateLowLevelMoveWithoutSlide(move: LowLevelMove): animation.Animatio
throw "Circle must start and end in a circle."; throw "Circle must start and end in a circle.";
} }
const posWithHands = SemanticToSetPosition({...move.endPosition, hands: handsInCircle})
const circleHands = new Map<Hand, Offset>([
[Hand.Left, posWithHands.leftArmEnd!],
[Hand.Right, posWithHands.rightArmEnd!],
]);
return [ return [
new animation.TransitionAnimationSegment({ new animation.TransitionAnimationSegment({
actualAnimation: new animation.RotationAnimationSegment({ actualAnimation: new animation.RotationAnimationSegment({
@ -553,6 +559,7 @@ function animateLowLevelMoveWithoutSlide(move: LowLevelMove): animation.Animatio
}), }),
flags: { flags: {
hands: true, hands: true,
handsDuring: circleHands,
}, },
startTransitionBeats: 1 startTransitionBeats: 1
}), }),
@ -581,6 +588,8 @@ function animateLowLevelMoveWithoutSlide(move: LowLevelMove): animation.Animatio
}), }),
flags: { flags: {
rotation: true, rotation: true,
hands: true,
handsDuring: "None",
}, },
startTransitionBeats: 0, startTransitionBeats: 0,
endTransitionBeats: 1, endTransitionBeats: 1,