Skip to content

Commit 8539aae

Browse files
committed
refactor(Rotate): rename enterAngle to angle
1 parent 83630e3 commit 8539aae

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

packages/react-components/react-motion-components-preview/library/src/atoms/rotate-atom.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface RotateAtomParams {
77
duration: number;
88
easing?: string;
99
axis?: Axis3D;
10-
enterAngle?: number;
10+
angle?: number;
1111
exitAngle?: number;
1212
}
1313

@@ -21,19 +21,19 @@ const createRotateValue = (axis: Axis3D, angle: number): string => {
2121
* @param duration - The duration of the motion in milliseconds.
2222
* @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
2323
* @param axis - The axis of rotation: 'X', 'Y', or 'Z'. Defaults to 'Y'.
24-
* @param enterAngle - The starting rotation angle in degrees. Defaults to -90.
25-
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `enterAngle`.
24+
* @param angle - The starting rotation angle in degrees. Defaults to -90.
25+
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.
2626
* @returns A motion atom object with rotate keyframes and the supplied duration and easing.
2727
*/
2828
export const rotateAtom = ({
2929
direction,
3030
duration,
3131
easing = motionTokens.curveLinear,
3232
axis = 'y',
33-
enterAngle = -90,
34-
exitAngle = -enterAngle,
33+
angle = -90,
34+
exitAngle = -angle,
3535
}: RotateAtomParams): AtomMotion => {
36-
let fromAngle = enterAngle;
36+
let fromAngle = angle;
3737
let toAngle = 0;
3838

3939
if (direction === 'exit') {

packages/react-components/react-motion-components-preview/library/src/components/Rotate/Rotate.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import { RotateParams } from './rotate-types';
1111
* @param exitDuration - Time (ms) for the exit transition (rotate-out). Defaults to the `duration` param for symmetry.
1212
* @param exitEasing - Easing curve for the exit transition (rotate-out). Defaults to the `curveAccelerateMax` value.
1313
* @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.
14-
* @param enterAngle - The starting rotation angle in degrees. Defaults to -90.
15-
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `enterAngle`.
14+
* @param angle - The starting rotation angle in degrees. Defaults to -90.
15+
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.
1616
* @param animateOpacity - Whether to animate the opacity during the rotation. Defaults to `true`.
1717
*/
1818
const rotatePresenceFn: PresenceMotionFn<RotateParams> = ({
1919
axis = 'y',
20-
enterAngle = -90,
21-
exitAngle = -enterAngle,
20+
angle = -90,
21+
exitAngle = -angle,
2222
duration = motionTokens.durationGentle,
2323
exitDuration = duration,
2424
easing = motionTokens.curveDecelerateMax,
@@ -31,7 +31,7 @@ const rotatePresenceFn: PresenceMotionFn<RotateParams> = ({
3131
duration,
3232
easing,
3333
axis,
34-
enterAngle,
34+
angle,
3535
exitAngle,
3636
}),
3737
];
@@ -42,7 +42,7 @@ const rotatePresenceFn: PresenceMotionFn<RotateParams> = ({
4242
duration: exitDuration,
4343
easing: exitEasing,
4444
axis,
45-
enterAngle,
45+
angle,
4646
exitAngle,
4747
}),
4848
];

packages/react-components/react-motion-components-preview/library/src/components/Rotate/rotate-types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export type RotateParams = PresenceDuration &
1414
* The starting rotation angle in degrees.
1515
* Defaults to -90.
1616
*/
17-
enterAngle?: number;
17+
angle?: number;
1818

1919
/**
2020
* The ending rotation angle in degrees.
21-
* Defaults to the negation of `enterAngle`.
21+
* Defaults to the negation of `angle`.
2222
*/
2323
exitAngle?: number;
2424
};

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateCardFlip.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const CardFlip = () => {
158158
<Rotate
159159
visible={!flippedCards.has(card.id)}
160160
axis="Y"
161-
enterAngle={0}
161+
angle={0}
162162
exitAngle={180}
163163
duration={600}
164164
easing="cubic-bezier(0.4, 0, 0.2, 1)"
@@ -174,7 +174,7 @@ export const CardFlip = () => {
174174
<Rotate
175175
visible={flippedCards.has(card.id)}
176176
axis="Y"
177-
enterAngle={-180}
177+
angle={-180}
178178
exitAngle={0}
179179
duration={600}
180180
easing="cubic-bezier(0.4, 0, 0.2, 1)"

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateCommonPatterns.stories.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const patterns = [
6565
icon: '↔️',
6666
color: tokens.colorPaletteBlueForeground2,
6767
axis: 'Y' as const,
68-
enterAngle: 180,
68+
angle: 180,
6969
easing: 'ease-out',
7070
duration: 600,
7171
},
@@ -76,7 +76,7 @@ const patterns = [
7676
icon: '↕️',
7777
color: tokens.colorPaletteGreenForeground2,
7878
axis: 'X' as const,
79-
enterAngle: 180,
79+
angle: 180,
8080
easing: 'ease-out',
8181
duration: 600,
8282
},
@@ -87,7 +87,7 @@ const patterns = [
8787
icon: '🔄',
8888
color: tokens.colorPaletteRedForeground2,
8989
axis: 'Z' as const,
90-
enterAngle: 360,
90+
angle: 360,
9191
easing: 'ease-in-out',
9292
duration: 800,
9393
},
@@ -98,7 +98,7 @@ const patterns = [
9898
icon: '〰️',
9999
color: tokens.colorPaletteYellowForeground2,
100100
axis: 'X' as const,
101-
enterAngle: 15,
101+
angle: 15,
102102
easing: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
103103
duration: 400,
104104
},
@@ -109,7 +109,7 @@ const patterns = [
109109
icon: '👀',
110110
color: tokens.colorPaletteTealForeground2,
111111
axis: 'Y' as const,
112-
enterAngle: -15,
112+
angle: -15,
113113
easing: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
114114
duration: 400,
115115
},
@@ -120,7 +120,7 @@ const patterns = [
120120
icon: '📄',
121121
color: tokens.colorPaletteDarkOrangeForeground2,
122122
axis: 'X' as const,
123-
enterAngle: -90,
123+
angle: -90,
124124
easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
125125
duration: 500,
126126
},
@@ -186,7 +186,7 @@ export const CommonPatterns = () => {
186186
<Rotate
187187
visible={activePatterns.has(pattern.id)}
188188
axis={pattern.axis}
189-
enterAngle={pattern.enterAngle}
189+
angle={pattern.angle}
190190
duration={pattern.duration}
191191
easing={pattern.easing}
192192
>

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateDefault.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const Default = (props: React.ComponentProps<typeof Rotate>) => {
5151
const [perspective, setPerspective] = React.useState<string>('1000px');
5252
const [duration, setDuration] = React.useState<number>(500);
5353
const [axis, setAxis] = React.useState<Axis3D>('y');
54-
const [enterAngle, setEnterAngle] = React.useState<number>(-90);
54+
const [angle, setEnterAngle] = React.useState<number>(-90);
5555

5656
const perspectiveSliderId = useId();
5757
const durationSliderId = useId();
@@ -100,13 +100,13 @@ export const Default = (props: React.ComponentProps<typeof Rotate>) => {
100100
</RadioGroup>
101101
</Field>
102102

103-
<label htmlFor={enterAngleSliderId}>Enter Angle: {enterAngle}°</label>
103+
<label htmlFor={enterAngleSliderId}>Enter Angle: {angle}°</label>
104104
<div className={classes.sliderWrapper}>
105105
<Label aria-hidden>{angleMin}</Label>
106106
<Slider
107107
min={angleMin}
108108
max={angleMax}
109-
defaultValue={enterAngle}
109+
defaultValue={angle}
110110
id={enterAngleSliderId}
111111
onChange={(_, data) => {
112112
setEnterAngle(data.value);
@@ -149,7 +149,7 @@ export const Default = (props: React.ComponentProps<typeof Rotate>) => {
149149
<Rotate
150150
visible={visible}
151151
axis={axis}
152-
enterAngle={enterAngle}
152+
angle={angle}
153153
duration={duration}
154154
easing={curveSpringRelaxed}
155155
onMotionFinish={() => autoplay && setVisible(v => !v)}

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateDescription.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Rotate } from '@fluentui/react-motion-components-preview';
77

88
function Component({ visible }) {
99
return (
10-
<Rotate visible={visible} fromY={-90} duration={600}>
10+
<Rotate visible={visible} axis="x" angle={45}>
1111
<div>Content</div>
1212
</Rotate>
1313
);

0 commit comments

Comments
 (0)