Skip to content

Commit 76fe187

Browse files
committed
feat(settings): duration
1 parent c04ead9 commit 76fe187

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

public/settings.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@ window.settings = {
4040
* @type {Number}
4141
*/
4242
maxSize: 400,
43+
44+
/**
45+
* Duration, in seconds, the image will remain displayed.
46+
* @type {Number}
47+
*/
48+
duration: 8,
4349
};

src/components/App.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,24 @@ const App: FC = () => {
4646
opacity: 0,
4747
});
4848

49-
tl.to(pictureRef.current, { [propertyKey]: 0, opacity: 1, rotate: endAngle }, "+=1");
50-
tl.to(pictureRef.current, { [propertyKey]: propertyValue, opacity: 0 }, "+=8");
49+
tl.to(
50+
pictureRef.current,
51+
{
52+
[propertyKey]: 0,
53+
rotate: endAngle,
54+
opacity: 1,
55+
},
56+
"+=1"
57+
);
58+
59+
tl.to(
60+
pictureRef.current,
61+
{
62+
[propertyKey]: propertyValue,
63+
opacity: 0,
64+
},
65+
`+=${settings.duration}`
66+
);
5167

5268
mainTimeline.add(tl);
5369
};

src/types/settings.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export interface Settings {
2828
* Maximum size, in pixels, of the displayed image.
2929
*/
3030
maxSize: number;
31+
32+
/**
33+
* Duration, in seconds, the image will remain displayed.
34+
*/
35+
duration: number;
3136
}
3237

3338
declare global {

0 commit comments

Comments
 (0)