From 2b1208bc7e81cc96d0d4fa393d0a04517d606bc8 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Tue, 28 May 2024 16:54:01 +0100 Subject: [PATCH] Kinetic Text - Heart animation --- game/scripts/utility/text_tags.rpy | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/game/scripts/utility/text_tags.rpy b/game/scripts/utility/text_tags.rpy index 055158f0..d285cb3b 100644 --- a/game/scripts/utility/text_tags.rpy +++ b/game/scripts/utility/text_tags.rpy @@ -11,11 +11,7 @@ init python: @renpy.pure def text_tag_heart(tag, argument): """Insert a unicode heart symbol. Usage {heart}""" - return [ - (renpy.TEXT_TAG, "unicode"), (renpy.TEXT_TAG, "size=-2"), - (renpy.TEXT_TEXT, "❤"), - (renpy.TEXT_TAG, "/size"), (renpy.TEXT_TAG, "/unicode") - ] + return [(renpy.TEXT_DISPLAYABLE, At(Text("{unicode}❤{/unicode}", style="what", xsize=24, ysize=24), heart_text))] @renpy.pure def text_tag_number(tag, argument): @@ -67,8 +63,8 @@ init python: @renpy.pure def text_tag_love(tag, argument, contents): text = contents[0][1] - d = Fixed(love_heart((15, 0), 12, 0.1), love_heart((20, -10), 6, 0.5), love_heart((10, 10), 6, 1), fit_first=True) - d2 = Transform(Fixed(love_heart((15, 0), 12, 1), love_heart((20, -10), 6, 0.1), love_heart((10, 10), 6, 0.5), fit_first=True), xzoom=-1) + d = Fixed(love_heart((15, 0), 12, 0.1), love_heart((20, -10), 6, 0.5), love_heart((10, 10), 6, 1), fit_first=True, ysize=24) + d2 = Transform(Fixed(love_heart((15, 0), 12, 1), love_heart((20, -10), 6, 0.1), love_heart((10, 10), 6, 0.5), fit_first=True), xzoom=-1, ysize=24) return [(renpy.TEXT_DISPLAYABLE, d), (renpy.TEXT_TAG, "color=#ff69b4"), (renpy.TEXT_TEXT, text), (renpy.TEXT_TAG, "/color"), (renpy.TEXT_DISPLAYABLE, d2)] @renpy.pure @@ -158,6 +154,25 @@ transform love_heart(pos, size, pause): function renpy.partial(text_love_heart_func, pos, size) repeat +transform heart_text: + animation + subpixel True + anchor (0.5, 0.5) + yzoom 1 + xzoom 1 + pos (256, 14) # Workaround; Xpos seems to not account for text box offset and text outline? + easein 0.25 yzoom 1.05 xzoom 1.05 + easein 0.25 yzoom 1.0 xzoom 1.0 + easein 0.25 yzoom 1.05 xzoom 1.05 + easein 0.25 yzoom 1.0 xzoom 1.0 + choice: + pause 0.25 + choice: + pause 0.35 + choice: + pause 0.45 + repeat + define config.custom_text_tags = { "unicode": text_tag_unicode, "wave": text_tag_wave,