Skip to content

Commit 8699c57

Browse files
committed
feat: capybara, dessertfox, rabbit emotion
1 parent fffdc29 commit 8699c57

41 files changed

Lines changed: 3038 additions & 38 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fox.svg

Loading

nohup.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Error: Unable to access jarfile build/libs/render.gitanimals-2.5.1.jar

skills/add-pet-emotion-animation.md

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ src/main/resources/persona/animal/
2121
2222
src/main/kotlin/org/gitanimals/core/
2323
├── PersonaType.kt # 펫 enum (loadSvg, act, addEmotions)
24-
├── PersonaEmotionType.kt # emotion 타입 enum (ERROR, HAPPY, IDLE_FOLLOW, NOTIFICATION, THINKING, TYPING)
2524
└── Svgs.kt # SVG 파일 로딩
2625
```
2726

@@ -147,20 +146,20 @@ base 콘텐츠 `</g>` 닫힘 태그 바로 뒤, `</svg>` 앞에 추가합니다.
147146
`buildEmotionAnimation()` 공통 메서드를 사용합니다.
148147

149148
```kotlin
150-
{PET_NAME}(weight) {
149+
{ PET_NAME }(weight) {
151150
override fun loadSvg(name: String, animationId: Long, level: Long, mode: Mode): String {
152151
val emotion = buildEmotionAnimation(
153152
idPrefix = "{pet-name}", // base SVG의 ID prefix와 동일해야 함
154153
animationId = animationId,
155154
totalDuration = 180.0, // 전체 애니메이션 사이클 (초)
156155
emotionDuration = 3.0, // 각 emotion 재생 시간 (초)
157156
emotionSvgs = listOf(
158-
{petName}ErrorEmotionSvg, // index 0
159-
{petName}HappyEmotionSvg, // index 1
160-
{petName}IdleFollowEmotionSvg, // index 2
161-
{petName}NotificationEmotionSvg, // index 3
162-
{petName}ThinkingEmotionSvg, // index 4
163-
{petName}TypingEmotionSvg, // index 5
157+
{ petName } ErrorEmotionSvg, // index 0
158+
{ petName } HappyEmotionSvg, // index 1
159+
{ petName } IdleFollowEmotionSvg, // index 2
160+
{ petName } NotificationEmotionSvg, // index 3
161+
{ petName } ThinkingEmotionSvg, // index 4
162+
{ petName } TypingEmotionSvg, // index 5
164163
),
165164
emotionYOffsets = listOf(
166165
5.0, // error (standing)
@@ -174,8 +173,8 @@ base 콘텐츠 `</g>` 닫힘 태그 바로 뒤, `</svg>` 앞에 추가합니다.
174173
maxGap = 30.0, // emotion 사이 최대 간격 (초)
175174
)
176175

177-
return {petName}Svg
178-
.replace("*{act}", act(animationId))
176+
return { petName } Svg
177+
.replace("*{act}", act(animationId))
179178
.replace("*{emotion-style}", emotion.css)
180179
.replace("*{emotions}", emotion.content)
181180
.replace("*{id}", animationId.toString())
@@ -184,17 +183,6 @@ base 콘텐츠 `</g>` 닫힘 태그 바로 뒤, `</svg>` 앞에 추가합니다.
184183
.replace("*{username}", name.toSvg(14.0, 25.0))
185184
.replace("*{usernamex}", (23 + (-3 * name.length)).toString())
186185
}
187-
188-
override fun addEmotions(emotionType: PersonaEmotionType): String {
189-
return when (emotionType) {
190-
ERROR -> {petName}ErrorEmotionSvg
191-
HAPPY -> {petName}HappyEmotionSvg
192-
IDLE_FOLLOW -> {petName}IdleFollowEmotionSvg
193-
NOTIFICATION -> {petName}NotificationEmotionSvg
194-
THINKING -> {petName}ThinkingEmotionSvg
195-
TYPING -> {petName}TypingEmotionSvg
196-
}
197-
}
198186
}
199187
```
200188

@@ -301,19 +289,6 @@ data object {PetClassName} : PersonaEmotionAssets {
301289
offsetX = -0.45,
302290
offsetY = -0.25
303291
)
304-
305-
// 실제 SVG 컨텐츠 반환 로직 구현
306-
override fun getAsset(emotion: String): String {
307-
return when (emotion) {
308-
"error" -> {petName}ErrorEmotionSvg
309-
"happy" -> {petName}HappyEmotionSvg
310-
"idleFollow" -> {petName}IdleFollowEmotionSvg
311-
"notification" -> {petName}NotificationEmotionSvg
312-
"thinking" -> {petName}ThinkingEmotionSvg
313-
"typing" -> {petName}TypingEmotionSvg
314-
else -> throw IllegalArgumentException("Invalid emotion: $emotion")
315-
}
316-
}
317292
}
318293
```
319294

src/main/kotlin/org/gitanimals/core/PersonaType.kt

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,29 @@ enum class PersonaType(
267267
.toString()
268268
},
269269

270-
LITTLE_CHICK(weight = 0.9, personaEvolution = PersonaEvolution(weight = 0.3, type = PersonaEvolutionType.LITTLE_CHICK)) {
270+
LITTLE_CHICK(weight = 0.9, haveAnimation = true, personaEvolution = PersonaEvolution(weight = 0.3, type = PersonaEvolutionType.LITTLE_CHICK)) {
271271
override fun loadSvg(name: String, animationId: Long, level: Long, mode: Mode): String {
272+
val emotion = buildEmotionAnimation(
273+
idPrefix = "little-chick",
274+
animationId = animationId,
275+
totalDuration = 180.0,
276+
emotionDuration = 3.0,
277+
emotionSvgs = listOf(
278+
littleChickErrorEmotionSvg,
279+
littleChickHappyEmotionSvg,
280+
littleChickIdleFollowEmotionSvg,
281+
littleChickNotificationEmotionSvg,
282+
littleChickThinkingEmotionSvg,
283+
littleChickTypingEmotionSvg,
284+
),
285+
emotionYOffsets = listOf(1.0, 1.0, 1.0, 1.0, 1.0, 1.0),
286+
minGap = 1.0,
287+
maxGap = 1.0,
288+
)
289+
272290
val littleChick = littleChickSvg.replace("*{act}", act(animationId))
291+
.replace("*{emotion-style}", emotion.css)
292+
.replace("*{emotions}", emotion.content)
273293
.replace("*{id}", animationId.toString())
274294
.replace("*{leg-iteration-count}", "360")
275295
.replace("*{level}", level.toSvg(14.0, 2.0))
@@ -1690,9 +1710,29 @@ enum class PersonaType(
16901710
StringBuilder().moveRandomly("mole", id, 40, "180s", 5, 14.0)
16911711
.toString()
16921712
},
1693-
RABBIT(weight = 0.9) {
1713+
RABBIT(weight = 0.9, haveAnimation = true) {
16941714
override fun loadSvg(name: String, animationId: Long, level: Long, mode: Mode): String {
1715+
val emotion = buildEmotionAnimation(
1716+
idPrefix = "rabbit",
1717+
animationId = animationId,
1718+
totalDuration = 180.0,
1719+
emotionDuration = 3.0,
1720+
emotionSvgs = listOf(
1721+
rabbitErrorEmotionSvg,
1722+
rabbitHappyEmotionSvg,
1723+
rabbitIdleFollowEmotionSvg,
1724+
rabbitNotificationEmotionSvg,
1725+
rabbitThinkingEmotionSvg,
1726+
rabbitTypingEmotionSvg,
1727+
),
1728+
emotionYOffsets = listOf(1.0, 1.0, 1.0, 1.0, 1.0, 1.0),
1729+
minGap = 1.0,
1730+
maxGap = 1.0,
1731+
)
1732+
16951733
return rabbitSvg.replace("*{act}", act(animationId))
1734+
.replace("*{emotion-style}", emotion.css)
1735+
.replace("*{emotions}", emotion.content)
16961736
.replace("*{id}", animationId.toString())
16971737
.replace("*{level}", level.toSvg(14.0, 2.0))
16981738
.replace(
@@ -2459,9 +2499,29 @@ enum class PersonaType(
24592499
.toString()
24602500
},
24612501

2462-
CAPYBARA_CARROT(0.6) {
2502+
CAPYBARA_CARROT(0.6, haveAnimation = true) {
24632503
override fun loadSvg(name: String, animationId: Long, level: Long, mode: Mode): String {
2504+
val emotion = buildEmotionAnimation(
2505+
idPrefix = "capybara-carrot",
2506+
animationId = animationId,
2507+
totalDuration = 180.0,
2508+
emotionDuration = 3.0,
2509+
emotionSvgs = listOf(
2510+
capybaraCarrotErrorEmotionSvg,
2511+
capybaraCarrotHappyEmotionSvg,
2512+
capybaraCarrotIdleFollowEmotionSvg,
2513+
capybaraCarrotNotificationEmotionSvg,
2514+
capybaraCarrotThinkingEmotionSvg,
2515+
capybaraCarrotTypingEmotionSvg,
2516+
),
2517+
emotionYOffsets = listOf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
2518+
minGap = 1.0,
2519+
maxGap = 1.0,
2520+
)
2521+
24642522
return capybaraCarrotSvg.replace("*{act}", act(animationId))
2523+
.replace("*{emotion-style}", emotion.css)
2524+
.replace("*{emotions}", emotion.content)
24652525
.replace("*{id}", animationId.toString())
24662526
.replace("*{leg-iteration-count}", "360")
24672527
.replace("*{level}", level.toSvg(14.0, 2.0))

src/main/kotlin/org/gitanimals/core/Svgs.kt

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,84 @@ val dessertFoxThinkingEmotionSvg: String = ClassPathResource("persona/animal/emo
419419
val dessertFoxTypingEmotionSvg: String = ClassPathResource("persona/animal/emotion/fox/typing.svg")
420420
.getContentAsString(Charset.defaultCharset())
421421

422+
val dessertFoxMiniIdleEmotionSvg: String = ClassPathResource("persona/animal/emotion/fox/mini-idle.svg")
423+
.getContentAsString(Charset.defaultCharset())
424+
425+
val dessertFoxMiniSleepEmotionSvg: String = ClassPathResource("persona/animal/emotion/fox/mini-sleep.svg")
426+
.getContentAsString(Charset.defaultCharset())
427+
428+
val capybaraCarrotErrorEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/error.svg")
429+
.getContentAsString(Charset.defaultCharset())
430+
431+
val capybaraCarrotHappyEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/happy.svg")
432+
.getContentAsString(Charset.defaultCharset())
433+
434+
val capybaraCarrotIdleFollowEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/idle-follow.svg")
435+
.getContentAsString(Charset.defaultCharset())
436+
437+
val capybaraCarrotNotificationEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/notification.svg")
438+
.getContentAsString(Charset.defaultCharset())
439+
440+
val capybaraCarrotThinkingEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/thinking.svg")
441+
.getContentAsString(Charset.defaultCharset())
442+
443+
val capybaraCarrotTypingEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/typing.svg")
444+
.getContentAsString(Charset.defaultCharset())
445+
446+
val capybaraCarrotMiniIdleEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/mini-idle.svg")
447+
.getContentAsString(Charset.defaultCharset())
448+
449+
val capybaraCarrotMiniSleepEmotionSvg: String = ClassPathResource("persona/animal/emotion/capybara-carrot/mini-sleep.svg")
450+
.getContentAsString(Charset.defaultCharset())
451+
452+
val littleChickErrorEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/error.svg")
453+
.getContentAsString(Charset.defaultCharset())
454+
455+
val littleChickHappyEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/happy.svg")
456+
.getContentAsString(Charset.defaultCharset())
457+
458+
val littleChickIdleFollowEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/idle-follow.svg")
459+
.getContentAsString(Charset.defaultCharset())
460+
461+
val littleChickNotificationEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/notification.svg")
462+
.getContentAsString(Charset.defaultCharset())
463+
464+
val littleChickThinkingEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/thinking.svg")
465+
.getContentAsString(Charset.defaultCharset())
466+
467+
val littleChickTypingEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/typing.svg")
468+
.getContentAsString(Charset.defaultCharset())
469+
470+
val littleChickMiniIdleEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/mini-idle.svg")
471+
.getContentAsString(Charset.defaultCharset())
472+
473+
val littleChickMiniSleepEmotionSvg: String = ClassPathResource("persona/animal/emotion/little-chick/mini-sleep.svg")
474+
.getContentAsString(Charset.defaultCharset())
475+
476+
val rabbitErrorEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/error.svg")
477+
.getContentAsString(Charset.defaultCharset())
478+
479+
val rabbitHappyEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/happy.svg")
480+
.getContentAsString(Charset.defaultCharset())
481+
482+
val rabbitIdleFollowEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/idle-follow.svg")
483+
.getContentAsString(Charset.defaultCharset())
484+
485+
val rabbitNotificationEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/notification.svg")
486+
.getContentAsString(Charset.defaultCharset())
487+
488+
val rabbitThinkingEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/thinking.svg")
489+
.getContentAsString(Charset.defaultCharset())
490+
491+
val rabbitTypingEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/typing.svg")
492+
.getContentAsString(Charset.defaultCharset())
493+
494+
val rabbitMiniIdleEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/mini-idle.svg")
495+
.getContentAsString(Charset.defaultCharset())
496+
497+
val rabbitMiniSleepEmotionSvg: String = ClassPathResource("persona/animal/emotion/rabbit/mini-sleep.svg")
498+
.getContentAsString(Charset.defaultCharset())
499+
422500
val largeTextSvgs = lazy {
423501
val map = mutableMapOf<String, String>()
424502
for (i in 'A'..'Z') {

0 commit comments

Comments
 (0)