Kinetic Text - Heart animation

This commit is contained in:
LoafyLemon 2024-05-28 16:54:01 +01:00
parent b7a0d19559
commit 2b1208bc7e

View File

@ -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,