踊ってない夜を知らない

踊ってない夜が気に入らない
https://shigusegubu.club/notice/B6Y2J5biTNp1VtN0pE
This commit is contained in:
Henry Jameson 2026-06-02 16:30:38 +03:00
commit 4934feb33e
2 changed files with 72 additions and 20 deletions

View file

@ -324,18 +324,18 @@ export default {
newAttrs['data-mfm-operator'] = mfmOperator newAttrs['data-mfm-operator'] = mfmOperator
switch(mfmOperator) { switch(mfmOperator) {
case 'position': { case 'position': {
const x = fullAttrs['data-mfm-x'] || 0 const x = fullAttrs['data-mfm-x'].replace(/\.+$/,'') || 0
const y = fullAttrs['data-mfm-y'] || 0 const y = fullAttrs['data-mfm-y'].replace(/\.+$/,'') || 0
newAttrs.style = [ newAttrs.style = [
'transform:', 'transform:',
`translateX(calc(${x} * (var(--emoji-size) / 2)))`, `translate(calc(${x} * (var(--emoji-size) / 2)), `,
`translateY(calc(${y} * (var(--emoji-size) / 2)))`, `calc(${y} * (var(--emoji-size) / 2)))`,
].join(' ') ].join(' ')
break break
} }
case 'scale': { case 'scale': {
const x = fullAttrs['data-mfm-x'] || 1 const x = fullAttrs['data-mfm-x'].replace(/\.+$/,'') || 1
const y = fullAttrs['data-mfm-y'] || 1 const y = fullAttrs['data-mfm-y'].replace(/\.+$/,'') || 1
newAttrs.style = [ newAttrs.style = [
'transform:', 'transform:',
`scale(${x}, ${y})`, `scale(${x}, ${y})`,
@ -345,11 +345,9 @@ export default {
case 'rotate': { case 'rotate': {
const deg = fullAttrs['data-mfm-deg'] || 0 const deg = fullAttrs['data-mfm-deg'] || 0
newAttrs.style = [ newAttrs.style = [
'transform:', `transform: rotate(${deg}deg)`,
`rotate(${deg}deg);`, 'transform-origin: center',
'transform-origin:', ].join(';')
'center',
].join(' ')
break break
} }
case 'bg': { case 'bg': {
@ -363,32 +361,79 @@ export default {
const color = fullAttrs['data-mfm-color'] || 0 const color = fullAttrs['data-mfm-color'] || 0
newAttrs.style = [ newAttrs.style = [
`color: #${color}`, `color: #${color}`,
].join(' ') ].join(';')
break break
} }
case 'spin': { case 'spin': {
const speed = fullAttrs['data-mfm-speed'] = '1s' const speed = fullAttrs['data-mfm-speed'] || '1s'
const delay = fullAttrs['data-mfm-delay'] = 0 const delay = fullAttrs['data-mfm-delay'] || 0
const left = fullAttrs['data-mfm-left'] != null
const alternate = fullAttrs['data-mfm-alternate'] != null
const y = fullAttrs['data-mfm-y'] != null const y = fullAttrs['data-mfm-y'] != null
const x = fullAttrs['data-mfm-x'] != null const x = fullAttrs['data-mfm-x'] != null
const anim = [ const anim = [
x ? 'mfm-spinX' : null, x ? 'mfm-spinX' : null,
y ? 'mfm-spinY' : null, y ? 'mfm-spinY' : null,
'mfm-spin' 'mfm-spin'
].filter(a => a)[0] ].filter(a => a)[0]
newAttrs.style = `animation: ${speed} linear ${delay} infinite normal none running ${anim}`
const direction = [
alternate ? 'alternate' : null,
left ? 'reverse' : null,
'normal',
].filter(a => a)[0]
newAttrs.style = [
`animation-name: ${anim}`,
`animation-duration: ${speed}`,
'animation-iteration-count: infinite',
`animation-delay: ${delay}`,
`animation-direction: ${direction}`,
'animation-fill-mode: none',
'animation-timing-function: linear',
].join(';')
break break
} }
case 'flip': { case 'flip': {
newAttrs.style = 'transform: scaleX(-1)' newAttrs.style = 'transform: scaleX(-1)'
break break
} }
case 'jump': case 'border': {
const width = fullAttrs['data-mfm-width'] || '0'
const style = fullAttrs['data-mfm-style'] || 'solid'
const color = fullAttrs['data-mfm-color'] || 'transparent'
const radius = fullAttrs['data-mfm-radius'] || '0'
const noclip = fullAttrs['data-mfm-noclip'] || false
newAttrs.style = [
`border: ${width} ${style} ${color}`,
`border-radius: ${radius}`,
`overflow: ${noclip ? 'visible' : 'clip'}`
].join(';')
break
}
case 'tada':
case 'jelly':
case 'twitch': case 'twitch':
case 'shake': case 'shake':
case 'bounce': case 'jump':
newAttrs.style = `animation: 0.75s linear 0s infinite normal none running mfm-${mfmOperator}` case 'bounce': {
const speed = fullAttrs['data-mfm-speed'] || '1s'
const delay = fullAttrs['data-mfm-delay'] || 0
const rules = [
`animation-name: mfm-${mfmOperator}`,
`animation-duration: ${speed}`,
'animation-iteration-count: infinite',
`animation-delay: ${delay}`,
'animation-direction: normal',
'animation-fill-mode: none',
'animation-timing-function: linear',
].join(';')
newAttrs.style = rules
break break
}
default: default:
console.log(mfmOperator, opener) console.log(mfmOperator, opener)
console.log(mfmOperator) console.log(mfmOperator)

View file

@ -1,9 +1,16 @@
.RichContent { .RichContent {
font-family: var(--font); font-family: var(--font);
text-align: center;
.mfm { .mfm {
display: inline-block; display: inline-block;
font-size: calc(var(--emoji-size) / 2); font-size: calc(var(--emoji-size) / 2);
.emoji {
/* Misskey's emoji width knows no bounds */
/* stylelint-disable-next-line declaration-no-important */
max-width: unset !important;
}
} }
&.-faint { &.-faint {
@ -148,7 +155,7 @@ a .RichContent {
} }
25% { 25% {
transform: translateY(-16px) transform: translateY(-1em)
} }
50% { 50% {
@ -156,7 +163,7 @@ a .RichContent {
} }
75% { 75% {
transform: translateY(-8px) transform: translateY(-0.5em)
} }
100% { 100% {