Compare commits
No commits in common. "d8e7fbe12d329ee0aa17f17b2199bea9a2f7074a" and "4f64f045d37b5cada6b5c2fced9d4a6c6e9d70e1" have entirely different histories.
d8e7fbe12d
...
4f64f045d3
|
@ -99,7 +99,6 @@ export class LinearAnimationSegment extends AnimationSegment {
|
||||||
export interface AnimationTransitionFlags {
|
export interface AnimationTransitionFlags {
|
||||||
rotation?: boolean;
|
rotation?: boolean;
|
||||||
rotationDuring?: "Actual" | "Start" | "End";
|
rotationDuring?: "Actual" | "Start" | "End";
|
||||||
rotationDirection?: Hand;
|
|
||||||
hands?: boolean;
|
hands?: boolean;
|
||||||
handsDuring?: "Actual" | "None" | "Start" | "End" | Map<Hand, Offset>;
|
handsDuring?: "Actual" | "None" | "Start" | "End" | Map<Hand, Offset>;
|
||||||
}
|
}
|
||||||
|
@ -127,30 +126,20 @@ export class TransitionAnimationSegment extends AnimationSegment {
|
||||||
this.startRotation = this.startPosition.rotation;
|
this.startRotation = this.startPosition.rotation;
|
||||||
this.endRotation = this.endPosition.rotation;
|
this.endRotation = this.endPosition.rotation;
|
||||||
if (this.flags.rotation) {
|
if (this.flags.rotation) {
|
||||||
let rotationDirection = flags.rotationDirection;
|
|
||||||
|
|
||||||
if (!flags.rotationDirection) {
|
|
||||||
const actualStart = this.actualAnimation.interpolateRotation(0);
|
const actualStart = this.actualAnimation.interpolateRotation(0);
|
||||||
const actualEnd = this.actualAnimation.interpolateRotation(1);
|
const actualEnd = this.actualAnimation.interpolateRotation(1);
|
||||||
|
|
||||||
if (actualEnd > actualStart) {
|
|
||||||
rotationDirection = Hand.Right;
|
|
||||||
} else if (actualEnd < actualStart) {
|
|
||||||
rotationDirection = Hand.Left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const transitionStart = this.actualAnimation.interpolateRotation(this.startTransitionProgress);
|
const transitionStart = this.actualAnimation.interpolateRotation(this.startTransitionProgress);
|
||||||
const transitionEnd = this.actualAnimation.interpolateRotation(1 - this.endTransitionProgress);
|
const transitionEnd = this.actualAnimation.interpolateRotation(1 - this.endTransitionProgress);
|
||||||
|
|
||||||
if (rotationDirection === Hand.Right) {
|
if (actualEnd > actualStart) {
|
||||||
while (transitionStart <= this.startRotation - 180) {
|
while (transitionStart <= this.startRotation - 180) {
|
||||||
this.startRotation -= 360;
|
this.startRotation -= 360;
|
||||||
}
|
}
|
||||||
while (transitionEnd >= this.endRotation + 180) {
|
while (transitionEnd >= this.endRotation + 180) {
|
||||||
this.endRotation += 360;
|
this.endRotation += 360;
|
||||||
}
|
}
|
||||||
} else if (rotationDirection === Hand.Left) {
|
} else if (actualEnd < actualStart) {
|
||||||
while (transitionStart >= this.startRotation + 180) {
|
while (transitionStart >= this.startRotation + 180) {
|
||||||
this.startRotation += 360;
|
this.startRotation += 360;
|
||||||
}
|
}
|
||||||
|
@ -159,9 +148,7 @@ export class TransitionAnimationSegment extends AnimationSegment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.flags.rotationDirection) {
|
// Transitions should be short adjustments, not spins.
|
||||||
// Transitions should be short adjustments, not spins...
|
|
||||||
// ... unless a direction is explicitly specified.
|
|
||||||
while (transitionStart - this.startRotation < -180) {
|
while (transitionStart - this.startRotation < -180) {
|
||||||
this.startRotation -= 360;
|
this.startRotation -= 360;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +163,6 @@ export class TransitionAnimationSegment extends AnimationSegment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override interpolateOffset(progress: number): Offset {
|
override interpolateOffset(progress: number): Offset {
|
||||||
return this.actualAnimation.interpolateOffset(progress);
|
return this.actualAnimation.interpolateOffset(progress);
|
||||||
|
|
|
@ -884,20 +884,18 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
if (startPos.kind === PositionKind.ShortLines) {
|
if (startPos.kind === PositionKind.ShortLines) {
|
||||||
if (around === CircleSide.Left || around === CircleSide.Right) {
|
if (around === CircleSide.Left || around === CircleSide.Right) {
|
||||||
// Fix startPos if necessary. Needed because pass through always swaps but sometimes shouldn't.
|
// 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) &&
|
if ((startPos.facing === Facing.Up || startPos.facing === Facing.Down) &&
|
||||||
((byHandOrShoulder === Hand.Right)
|
((byHandOrShoulder === Hand.Right)
|
||||||
!== (startPos.facing === Facing.Up)
|
!== (startPos.facing === Facing.Up)
|
||||||
!== startPos.which.isLeftOfSide())) {
|
!== (startPos.which === ShortLinesPosition.FarLeft || startPos.which === ShortLinesPosition.MiddleRight))) {
|
||||||
startWhich = startPos.which.swapOnSide()
|
|
||||||
startingPos = {
|
startingPos = {
|
||||||
...startPos,
|
...startPos,
|
||||||
which: startWhich,
|
which: startPos.which.swapOnSide()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const endWhich = CirclePosition.fromSides(startingPos.which.leftRightSide(),
|
const endWhich = CirclePosition.fromSides(startingPos.which.leftRightSide(),
|
||||||
startWhich.isLeftOfSide()
|
(startingPos.which === ShortLinesPosition.FarLeft || startingPos.which === ShortLinesPosition.MiddleRight)
|
||||||
!== (byHandOrShoulder === Hand.Right)
|
!== (byHandOrShoulder === Hand.Right)
|
||||||
!== (intoWavePositions === 1)
|
!== (intoWavePositions === 1)
|
||||||
? CircleSide.Top
|
? CircleSide.Top
|
||||||
|
@ -926,15 +924,9 @@ function moveAsLowLevelMoves({ move, nextMove, startingPos, numProgessions }: {
|
||||||
setOffset: startPos.setOffset,
|
setOffset: startPos.setOffset,
|
||||||
lineOffset: startPos.lineOffset,
|
lineOffset: startPos.lineOffset,
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const endWhich = startPos.which.toShortLines(intoWavePositions === 1 ? Hand.Right : Hand.Left);
|
throw new Error("Allemande from circle to short lines is unsupported.");
|
||||||
endPosition = {
|
|
||||||
kind: PositionKind.ShortLines,
|
|
||||||
which: endWhich,
|
|
||||||
facing: endWhich.isLeftOfSide() === (byHandOrShoulder === Hand.Left) ? Facing.Up : Facing.Down,
|
|
||||||
setOffset: startPos.setOffset,
|
|
||||||
lineOffset: startPos.lineOffset,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,11 +286,6 @@ export class ShortLinesPosition {
|
||||||
return this.leftRightSide() === CircleSide.Left;
|
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 {
|
public facingSide() : Facing.Left | Facing.Right {
|
||||||
return this.isLeft() === this.isMiddle() ? Facing.Left : Facing.Right;
|
return this.isLeft() === this.isMiddle() ? Facing.Left : Facing.Right;
|
||||||
}
|
}
|
||||||
|
|
|
@ -832,7 +832,6 @@ function animateLowLevelMoveWithoutSlide(move: LowLevelMove): animation.Animatio
|
||||||
flags: {
|
flags: {
|
||||||
hands: true,
|
hands: true,
|
||||||
rotation: true,
|
rotation: true,
|
||||||
rotationDirection: move.movementPattern.side,
|
|
||||||
},
|
},
|
||||||
startTransitionBeats: 0.5,
|
startTransitionBeats: 0.5,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user