Enhance(MFM): Allow speed changes in all animated MFMs (#8551)
* MFM: Allow speed changes in all animated MFMs * Feature(MFM): Add speed property to cheat sheet * Use template literal Oops! * Remove unnecessary template string Co-authored-by: Johann150 <johann@qwertqwefsday.eu> Co-authored-by: Johann150 <johann@qwertqwefsday.eu>
This commit is contained in:
parent
f3628946af
commit
3ea351d8a2
|
@ -91,7 +91,8 @@ export default defineComponent({
|
|||
let style;
|
||||
switch (token.props.name) {
|
||||
case 'tada': {
|
||||
style = `font-size: 150%;` + (this.$store.state.animatedMfm ? 'animation: tada 1s linear infinite both;' : '');
|
||||
const speed = validTime(token.props.args.speed) || '1s';
|
||||
style = 'font-size: 150%;' + (this.$store.state.animatedMfm ? `animation: tada ${speed} linear infinite both;` : '');
|
||||
break;
|
||||
}
|
||||
case 'jelly': {
|
||||
|
@ -123,11 +124,13 @@ export default defineComponent({
|
|||
break;
|
||||
}
|
||||
case 'jump': {
|
||||
style = this.$store.state.animatedMfm ? 'animation: mfm-jump 0.75s linear infinite;' : '';
|
||||
const speed = validTime(token.props.args.speed) || '0.75s';
|
||||
style = this.$store.state.animatedMfm ? `animation: mfm-jump ${speed} linear infinite;` : '';
|
||||
break;
|
||||
}
|
||||
case 'bounce': {
|
||||
style = this.$store.state.animatedMfm ? 'animation: mfm-bounce 0.75s linear infinite; transform-origin: center bottom;' : '';
|
||||
const speed = validTime(token.props.args.speed) || '0.75s';
|
||||
style = this.$store.state.animatedMfm ? `animation: mfm-bounce ${speed} linear infinite; transform-origin: center bottom;` : '';
|
||||
break;
|
||||
}
|
||||
case 'flip': {
|
||||
|
@ -168,7 +171,8 @@ export default defineComponent({
|
|||
}, genEl(token.children));
|
||||
}
|
||||
case 'rainbow': {
|
||||
style = this.$store.state.animatedMfm ? 'animation: mfm-rainbow 1s linear infinite;' : '';
|
||||
const speed = validTime(token.props.args.speed) || '1s';
|
||||
style = this.$store.state.animatedMfm ? `animation: mfm-rainbow ${speed} linear infinite;` : '';
|
||||
break;
|
||||
}
|
||||
case 'sparkle': {
|
||||
|
|
|
@ -325,20 +325,20 @@ export default defineComponent({
|
|||
preview_inlineMath: '\\(x= \\frac{-b\' \\pm \\sqrt{(b\')^2-ac}}{a}\\)',
|
||||
preview_quote: `> ${this.$ts._mfm.dummy}`,
|
||||
preview_search: `${this.$ts._mfm.dummy} 検索`,
|
||||
preview_jelly: `$[jelly 🍮]`,
|
||||
preview_tada: `$[tada 🍮]`,
|
||||
preview_jump: `$[jump 🍮]`,
|
||||
preview_bounce: `$[bounce 🍮]`,
|
||||
preview_shake: `$[shake 🍮]`,
|
||||
preview_twitch: `$[twitch 🍮]`,
|
||||
preview_spin: `$[spin 🍮] $[spin.left 🍮] $[spin.alternate 🍮]\n$[spin.x 🍮] $[spin.x,left 🍮] $[spin.x,alternate 🍮]\n$[spin.y 🍮] $[spin.y,left 🍮] $[spin.y,alternate 🍮]`,
|
||||
preview_jelly: `$[jelly 🍮] $[jelly.speed=5s 🍮]`,
|
||||
preview_tada: `$[tada 🍮] $[tada.speed=5s 🍮]`,
|
||||
preview_jump: `$[jump 🍮] $[jump.speed=5s 🍮]`,
|
||||
preview_bounce: `$[bounce 🍮] $[bounce.speed=5s 🍮]`,
|
||||
preview_shake: `$[shake 🍮] $[shake.speed=5s 🍮]`,
|
||||
preview_twitch: `$[twitch 🍮] $[twitch.speed=5s 🍮]`,
|
||||
preview_spin: `$[spin 🍮] $[spin.left 🍮] $[spin.alternate 🍮]\n$[spin.x 🍮] $[spin.x,left 🍮] $[spin.x,alternate 🍮]\n$[spin.y 🍮] $[spin.y,left 🍮] $[spin.y,alternate 🍮]\n\n$[spin.speed=5s 🍮]`,
|
||||
preview_flip: `$[flip ${this.$ts._mfm.dummy}]\n$[flip.v ${this.$ts._mfm.dummy}]\n$[flip.h,v ${this.$ts._mfm.dummy}]`,
|
||||
preview_font: `$[font.serif ${this.$ts._mfm.dummy}]\n$[font.monospace ${this.$ts._mfm.dummy}]\n$[font.cursive ${this.$ts._mfm.dummy}]\n$[font.fantasy ${this.$ts._mfm.dummy}]`,
|
||||
preview_x2: `$[x2 🍮]`,
|
||||
preview_x3: `$[x3 🍮]`,
|
||||
preview_x4: `$[x4 🍮]`,
|
||||
preview_blur: `$[blur ${this.$ts._mfm.dummy}]`,
|
||||
preview_rainbow: `$[rainbow 🍮]`,
|
||||
preview_rainbow: `$[rainbow 🍮] $[rainbow.speed=5s 🍮]`,
|
||||
preview_sparkle: `$[sparkle 🍮]`,
|
||||
preview_rotate: `$[rotate 🍮]`,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue