Skip to content

Commit

Permalink
Added fadeout sequence.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Jul 4, 2024
1 parent 320fcdc commit b85f4e5
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 24 deletions.
2 changes: 2 additions & 0 deletions src/locale/OutputTexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ type OutputTexts = {
spin: NameAndDoc;
/** Fades in from purely transparent to purely opaque */
fadein: NameAndDoc;
/** Fades out from purely opaque to purely transprent */
fadeout: NameAndDoc;
/** Scales from 0 to larger than its size, then back to scale of 1 */
popup: NameAndDoc;
/** Offsets randomly in multiple directions */
Expand Down
4 changes: 4 additions & 0 deletions src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3861,6 +3861,10 @@
"doc": "I create a @Sequence that fades @Output in from invisible to visible.",
"names": ["fadein"]
},
"fadeout": {
"doc": "I create a @Sequence that fades @Output from visible to invisible. Try me in an exiting @Sequence!",
"names": ["fadeout"]
},
"popup": {
"doc": "I create a @Sequence that makes @Output scale in quickly than shrink to its normal size.",
"names": ["popup"]
Expand Down
59 changes: 39 additions & 20 deletions src/output/DefaultSequences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ export function createSway(locales: Locales) {
Bind.make(
getDocLocales(
locales,
(locale) => locale.output.sequence.sway.angle.doc
(locale) => locale.output.sequence.sway.angle.doc,
),
getNameLocales(
locales,
(locale) => locale.output.sequence.sway.angle.names
(locale) => locale.output.sequence.sway.angle.names,
),
NumberType.make(Unit.reuse(['°'])),
NumberLiteral.make(2, Unit.reuse(['°']))
NumberLiteral.make(2, Unit.reuse(['°'])),
),
],
parseExpression(
toTokens(`{
0%: Pose(rotation: -1 · angle)
50%: Pose(rotation: angle)
100%: Pose(rotation: -1 · angle)
}`)
)
}`),
),
);
}

Expand All @@ -43,21 +43,21 @@ export function createBounce(locales: Locales) {
getDocLocales(locales, (locale) => locale.output.sequence.bounce.doc),
getNameLocales(
locales,
(locale) => locale.output.sequence.bounce.names
(locale) => locale.output.sequence.bounce.names,
),
undefined,
[
Bind.make(
getDocLocales(
locales,
(locale) => locale.output.sequence.bounce.height.doc
(locale) => locale.output.sequence.bounce.height.doc,
),
getNameLocales(
locales,
(locale) => locale.output.sequence.bounce.height.names
(locale) => locale.output.sequence.bounce.height.names,
),
NumberType.make(Unit.reuse(['m'])),
NumberLiteral.make(2, Unit.reuse(['m']))
NumberLiteral.make(2, Unit.reuse(['m'])),
),
],
parseExpression(
Expand All @@ -69,8 +69,8 @@ export function createBounce(locales: Locales) {
57%: Pose(scale: 1 offset: Place(y: .1m))
64%: Pose(scale: 1 offset: Place(y: 0m))
100%: Pose(scale: 1 offset: Place(y: 0m))
}`)
)
}`),
),
);
}

Expand All @@ -84,8 +84,8 @@ export function createSpin(locales: Locales) {
toTokens(`{
0%: Pose(rotation: 360°)
100%: Pose(rotation: 0°)
}`)
)
}`),
),
);
}

Expand All @@ -94,16 +94,34 @@ export function createFadeIn(locales: Locales) {
getDocLocales(locales, (locale) => locale.output.sequence.fadein.doc),
getNameLocales(
locales,
(locale) => locale.output.sequence.fadein.names
(locale) => locale.output.sequence.fadein.names,
),
undefined,
[],
parseExpression(
toTokens(`{
0%: Pose(opacity: 0)
100%: Pose(opacity: 1)
}`)
)
}`),
),
);
}

export function createFadeOut(locales: Locales) {
return FunctionDefinition.make(
getDocLocales(locales, (locale) => locale.output.sequence.fadeout.doc),
getNameLocales(
locales,
(locale) => locale.output.sequence.fadeout.names,
),
undefined,
[],
parseExpression(
toTokens(`{
0%: Pose(opacity: 1)
100%: Pose(opacity: 0)
}`),
),
);
}

Expand All @@ -119,8 +137,8 @@ export function createPopup(locales: Locales) {
80%: Pose(scale: 1.1)
90%: Pose(scale: 0.9)
100%: Pose(scale: 1)
}`)
)
}`),
),
);
}

Expand All @@ -137,8 +155,8 @@ export function createShake(locales: Locales) {
50%: Pose(offset: Place(.1m 0m))
75%: Pose(offset: Place(-.1m 0.1m))
100%: Pose(offset: Place(0m 0m))
}`)
)
}`),
),
);
}

Expand All @@ -148,6 +166,7 @@ export function getDefaultSequences(locales: Locales) {
bounce: createBounce(locales),
spin: createSpin(locales),
fadein: createFadeIn(locales),
fadeout: createFadeOut(locales),
popup: createPopup(locales),
shake: createShake(locales),
};
Expand Down
12 changes: 8 additions & 4 deletions static/locales/es-MX/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -3877,19 +3877,23 @@
}
},
"spin": {
"doc": "Creo una @Sequence que rota un @Output alrededor de su centro.",
"doc": "Creo una @Sequence que rota un @Output alrededor de su centro.",
"names": ["girar"]
},
"fadein": {
"doc": "Creo una @Sequence que hace que un @Output aparezca gradualmente de invisible a visible.",
"doc": "Creo una @Sequence que hace que un @Output aparezca gradualmente de invisible a visible.",
"names": ["aparecer"]
},
"fadeout": {
"doc": "$?",
"names": ["$?"]
},
"popup": {
"doc": "Creo una @Sequence que hace que un @Output se agrande rápidamente y luego vuelva a su tamaño normal.",
"doc": "Creo una @Sequence que hace que un @Output se agrande rápidamente y luego vuelva a su tamaño normal.",
"names": ["aparecer"]
},
"shake": {
"doc": "Creo una @Sequence que hace que parezca que un @Output está asustado.",
"doc": "Creo una @Sequence que hace que parezca que un @Output está asustado.",
"names": ["temblor"]
}
},
Expand Down
4 changes: 4 additions & 0 deletions static/locales/ko-KR/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,10 @@
},
"spin": { "doc": "$?", "names": ["girar"] },
"fadein": { "doc": "$?", "names": ["revelar"] },
"fadeout": {
"doc": "$?",
"names": ["$?"]
},
"popup": { "doc": "$?", "names": ["surgir"] },
"shake": { "doc": "$?", "names": ["agitar"] }
},
Expand Down
4 changes: 4 additions & 0 deletions static/locales/zh-CN/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3714,6 +3714,10 @@
"doc": "我创建一个@Sequence, 将@Output从不可见状态淡入可见状态。",
"names": ["淡入"]
},
"fadeout": {
"doc": "$?",
"names": ["$?"]
},
"popup": {
"doc": "我创建一个@Sequence, 使@Output迅速放大然后缩小到正常尺寸。",
"names": ["弹出"]
Expand Down
4 changes: 4 additions & 0 deletions static/locales/zh-TW/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -3695,6 +3695,10 @@
"doc": "我建立一個@Sequence, 將@Output從不可見狀態淡入可見狀態。",
"names": ["淡入"]
},
"fadeout": {
"doc": "$?",
"names": ["$?"]
},
"popup": {
"doc": "我創建一個@Sequence, 使@Output迅速放大然後縮小到正常尺寸。",
"names": ["彈出"]
Expand Down
5 changes: 5 additions & 0 deletions static/schemas/Locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -7848,6 +7848,10 @@
"$ref": "#/definitions/NameAndDoc",
"description": "Fades in from purely transparent to purely opaque"
},
"fadeout": {
"$ref": "#/definitions/NameAndDoc",
"description": "Fades out from purely opaque to purely transprent"
},
"popup": {
"$ref": "#/definitions/NameAndDoc",
"description": "Scales from 0 to larger than its size, then back to scale of 1"
Expand Down Expand Up @@ -7890,6 +7894,7 @@
"bounce",
"spin",
"fadein",
"fadeout",
"popup",
"shake"
],
Expand Down

0 comments on commit b85f4e5

Please sign in to comment.