Compare commits

..

No commits in common. "d8e7fbe12d329ee0aa17f17b2199bea9a2f7074a" and "4f64f045d37b5cada6b5c2fced9d4a6c6e9d70e1" have entirely different histories.

4 changed files with 21 additions and 49 deletions

View File

@ -99,7 +99,6 @@ export class LinearAnimationSegment extends AnimationSegment {
export interface AnimationTransitionFlags {
rotation?: boolean;
rotationDuring?: "Actual" | "Start" | "End";
rotationDirection?: Hand;
hands?: boolean;
handsDuring?: "Actual" | "None" | "Start" | "End" | Map<Hand, Offset>;
}
@ -127,30 +126,20 @@ export class TransitionAnimationSegment extends AnimationSegment {
this.startRotation = this.startPosition.rotation;
this.endRotation = this.endPosition.rotation;
if (this.flags.rotation) {
let rotationDirection = flags.rotationDirection;
if (!flags.rotationDirection) {
const actualStart = this.actualAnimation.interpolateRotation(0);
const actualEnd = this.actualAnimation.interpolateRotation(1);
if (actualEnd > actualStart) {
rotationDirection = Hand.Right;
} else if (actualEnd < actualStart) {
rotationDirection = Hand.Left;
}
}
const actualStart = this.actualAnimation.interpolateRotation(0);
const actualEnd = this.actualAnimation.interpolateRotation(1);
const transitionStart = this.actualAnimation.interpolateRotation(this.startTransitionProgress);
const transitionEnd = this.actualAnimation.interpolateRotation(1 - this.endTransitionProgress);
if (rotationDirection === Hand.Right) {
if (actualEnd > actualStart) {
while (transitionStart <= this.startRotation - 180) {
this.startRotation -= 360;
}
while (transitionEnd >= this.endRotation + 180) {
this.endRotation += 360;
}
} else if (rotationDirection === Hand.Left) {
} else if (actualEnd < actualStart) {
while (transitionStart >= this.startRotation + 180) {
this.startRotation += 360;
}
@ -159,21 +148,18 @@ export class TransitionAnimationSegment extends AnimationSegment {
}
}
if (!this.flags.rotationDirection) {
// Transitions should be short adjustments, not spins...
// ... unless a direction is explicitly specified.
while (transitionStart - this.startRotation < -180) {
this.startRotation -= 360;
}
while (transitionStart - this.startRotation > 180) {
this.startRotation += 360;
}
while (transitionEnd - this.endRotation < -180) {
this.endRotation -= 360;
}
while (transitionEnd - this.endRotation > 180) {
this.endRotation += 360;
}
// Transitions should be short adjustments, not spins.
while (transitionStart - this.startRotation < -180) {
this.startRotation -= 360;
}
while (transitionStart - this.startRotation > 180) {
this.startRotation += 360;
}
while (transitionEnd - this.endRotation < -180) {
this.endRotation -= 360;
}
while (transitionEnd - this.endRotation > 180) {
this.endRotation += 360;
}
}
}

View File

@ -884,20 +884,18 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
if (startPos.kind === PositionKind.ShortLines) {
if (around === CircleSide.Left || around === CircleSide.Right) {
// Fix startPos if necessary. Needed because pass through always swaps but sometimes shouldn't.
let startWhich = startPos.which;
if ((startPos.facing === Facing.Up || startPos.facing === Facing.Down) &&
((byHandOrShoulder === Hand.Right)
!== (startPos.facing === Facing.Up)
!== startPos.which.isLeftOfSide())) {
startWhich = startPos.which.swapOnSide()
!== (startPos.which === ShortLinesPosition.FarLeft || startPos.which === ShortLinesPosition.MiddleRight))) {
startingPos = {
...startPos,
which: startWhich,
which: startPos.which.swapOnSide()
};
}
const endWhich = CirclePosition.fromSides(startingPos.which.leftRightSide(),
startWhich.isLeftOfSide()
(startingPos.which === ShortLinesPosition.FarLeft || startingPos.which === ShortLinesPosition.MiddleRight)
!== (byHandOrShoulder === Hand.Right)
!== (intoWavePositions === 1)
? CircleSide.Top
@ -926,15 +924,9 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
setOffset: startPos.setOffset,
lineOffset: startPos.lineOffset,
}
} else {
const endWhich = startPos.which.toShortLines(intoWavePositions === 1 ? Hand.Right : Hand.Left);
endPosition = {
kind: PositionKind.ShortLines,
which: endWhich,
facing: endWhich.isLeftOfSide() === (byHandOrShoulder === Hand.Left) ? Facing.Up : Facing.Down,
setOffset: startPos.setOffset,
lineOffset: startPos.lineOffset,
}
throw new Error("Allemande from circle to short lines is unsupported.");
}
}
}

View File

@ -286,11 +286,6 @@ export class ShortLinesPosition {
return this.leftRightSide() === CircleSide.Left;
}
// Of the two positions on the same leftRightSide() is this the one further to the left?
public isLeftOfSide() : boolean {
return this.enumValue === ShortLinesPositionEnum.FarLeft || this.enumValue === ShortLinesPositionEnum.MiddleRight;
}
public facingSide() : Facing.Left | Facing.Right {
return this.isLeft() === this.isMiddle() ? Facing.Left : Facing.Right;
}

View File

@ -832,7 +832,6 @@ function animateLowLevelMoveWithoutSlide(move: LowLevelMove): animation.Animatio
flags: {
hands: true,
rotation: true,
rotationDirection: move.movementPattern.side,
},
startTransitionBeats: 0.5,
})