Skip to content

Commit a7f8452

Browse files
authored
Merge pull request #40 from yoshi389111/fix_animation_settings_json
fix: growing animation of settings json
2 parents 4a13137 + 44bd1a1 commit a7f8452

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/create-pie-language.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const createPieLanguage = (
1212
width: number,
1313
height: number,
1414
settings: type.PieLangSettings,
15-
isAnimate: boolean
15+
isForcedAnimation: boolean
1616
): void => {
1717
if (userInfo.totalContributions === 0) {
1818
return;
@@ -31,6 +31,7 @@ export const createPieLanguage = (
3131
});
3232
}
3333

34+
const isAnimate = settings.growingAnimation || isForcedAnimation;
3435
const animeSteps = 5;
3536
const animateOpacity = (num: number) =>
3637
Array<string>(languages.length + animeSteps)

src/create-radar-contrib.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ export const createRadarContrib = (
2222
width: number,
2323
height: number,
2424
settings: type.RadarContribSettings,
25-
isAnimate: boolean
25+
isForcedAnimation: boolean
2626
): void => {
2727
const radius = (height / 2) * 0.8;
2828
const cx = width / 2;
2929
const cy = (height / 2) * 1.1;
3030

31+
const isAnimate = settings.growingAnimation || isForcedAnimation;
32+
3133
const commitLabel = settings.l10n ? settings.l10n.commit : 'Commit';
3234
const issueLabel = settings.l10n ? settings.l10n.issue : 'Issue';
3335
const pullReqLabel = settings.l10n ? settings.l10n.pullreq : 'PullReq';

src/type.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export interface RadarContribSettings {
3737
weakColor: string;
3838
radarColor: string;
3939

40+
growingAnimation?: boolean;
41+
4042
fileName?: string;
4143

4244
l10n?: {
@@ -52,6 +54,8 @@ export interface PieLangSettings {
5254
backgroundColor: string;
5355
foregroundColor: string;
5456

57+
growingAnimation?: boolean;
58+
5559
fileName?: string;
5660
}
5761

@@ -62,6 +66,8 @@ export interface BaseSettings extends RadarContribSettings, PieLangSettings {
6266
weakColor: string;
6367
radarColor: string;
6468

69+
growingAnimation?: boolean;
70+
6571
fileName?: string;
6672

6773
l10n?: {
@@ -76,14 +82,12 @@ export interface BaseSettings extends RadarContribSettings, PieLangSettings {
7682

7783
export interface NormalColorSettings extends BaseSettings {
7884
type: 'normal';
79-
growingAnimation?: boolean;
8085

8186
contribColors: [string, string, string, string, string];
8287
}
8388

8489
export interface SeasonColorSettings extends BaseSettings {
8590
type: 'season';
86-
growingAnimation?: boolean;
8791

8892
/** first season (Mar. - Jun.) */
8993
contribColors1: [string, string, string, string, string];
@@ -97,7 +101,6 @@ export interface SeasonColorSettings extends BaseSettings {
97101

98102
export interface RainbowColorSettings extends BaseSettings {
99103
type: 'rainbow';
100-
growingAnimation?: boolean;
101104

102105
saturation: string;
103106
contribLightness: [string, string, string, string, string];

0 commit comments

Comments
 (0)