Skip to content

Commit

Permalink
feat(settings): duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldszar committed Jun 10, 2021
1 parent c04ead9 commit 76fe187
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions public/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ window.settings = {
* @type {Number}
*/
maxSize: 400,

/**
* Duration, in seconds, the image will remain displayed.
* @type {Number}
*/
duration: 8,
};
20 changes: 18 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,24 @@ const App: FC = () => {
opacity: 0,
});

tl.to(pictureRef.current, { [propertyKey]: 0, opacity: 1, rotate: endAngle }, "+=1");
tl.to(pictureRef.current, { [propertyKey]: propertyValue, opacity: 0 }, "+=8");
tl.to(
pictureRef.current,
{
[propertyKey]: 0,
rotate: endAngle,
opacity: 1,
},
"+=1"
);

tl.to(
pictureRef.current,
{
[propertyKey]: propertyValue,
opacity: 0,
},
`+=${settings.duration}`
);

mainTimeline.add(tl);
};
Expand Down
5 changes: 5 additions & 0 deletions src/types/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export interface Settings {
* Maximum size, in pixels, of the displayed image.
*/
maxSize: number;

/**
* Duration, in seconds, the image will remain displayed.
*/
duration: number;
}

declare global {
Expand Down

0 comments on commit 76fe187

Please sign in to comment.