Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
69f600f
Rotation
Blounard Dec 11, 2023
4617d83
Rotation + Rotation speed
Blounard Dec 12, 2023
6ee3cce
Bugfix
Blounard Dec 12, 2023
379a4e4
info_display timediff
Blounard Dec 16, 2023
5059268
TimeDiff Update + AGC + Bruteforcer
Blounard Dec 23, 2023
d13686a
Added doc and removed personal files
Blounard Dec 24, 2023
dcc7f4c
Remove compiled code from PR.
ximk Dec 26, 2023
3215e26
Appease linter
ximk Dec 26, 2023
5eea673
Update scripts/RMC/Adv. Ghost Comp/Load_data.py
ximk Dec 26, 2023
d7ddb70
Appease linter
ximk Dec 26, 2023
2620cf6
github is being silly
ximk Dec 26, 2023
70086c4
Final touches
ximk Dec 26, 2023
ffbfb20
Implemented the 7 column version of TTK
Blounard Apr 7, 2024
dc1cd2c
Merge branch 'main' of https://github.com/Blounard/mkw-scripts
Blounard Apr 7, 2024
f04d1e2
remade agc
Blounard Feb 23, 2025
e57711b
agc other functions
Blounard Feb 23, 2025
2f4090b
rkg lib
Blounard Feb 25, 2025
a401694
Remove pycache files
Epik95mkw Feb 26, 2025
c76be6c
Add dolphin function stubs
Epik95mkw Feb 26, 2025
bb5c180
Add glitchy corner accessor
Epik95mkw Feb 26, 2025
cc499ec
Personal infodisplay
Epik95mkw Feb 26, 2025
78864c9
External scripts and memory sharing utils
Epik95mkw Feb 26, 2025
05aaf18
WIP superhopping macro
Epik95mkw Feb 26, 2025
8bdbae6
Superslide (and neutral glide) macro
Epik95mkw Feb 26, 2025
5d370d8
Auto MT release macro
Epik95mkw Feb 26, 2025
d2df7ec
WIP teleport offset script
Epik95mkw Feb 26, 2025
7c6d12f
Merge pull request #1 from Epik95mkw/main
Blounard Feb 26, 2025
36a3676
RKG Loader, TTK RKG to Player, TTK Player to CSV
Blounard Feb 27, 2025
3873271
mkds minimap + other small utils
Blounard Mar 1, 2025
333cd26
auto teleport + various bugfix
Blounard Mar 2, 2025
86f570d
Update .gitignore
Blounard Mar 2, 2025
f374bf7
auto tp componed component
Blounard Mar 3, 2025
b729957
Soft drift assist macro
Epik95mkw Mar 3, 2025
6fb5ba1
Merge remote-tracking branch 'upstream/main'
Epik95mkw Mar 3, 2025
2cdf1d6
Reorganize stuff
Epik95mkw Mar 3, 2025
c871000
update mkds minimap
Blounard Mar 5, 2025
2c463f5
Merge remote-tracking branch 'upstream/main'
Epik95mkw Mar 6, 2025
8a04771
Big script commit
Blounard Mar 16, 2025
7b30c17
Update TAS_Input.py
Blounard Mar 16, 2025
605001b
Simple TTK GUI
Epik95mkw Mar 16, 2025
03d1161
Merge remote-tracking branch 'upstream/main'
Epik95mkw Mar 16, 2025
436ec85
TTK GUI improvements
Epik95mkw Mar 20, 2025
03c11df
Small fix
Epik95mkw Mar 20, 2025
f314de9
Remove all on state load events
Blounard Mar 21, 2025
8c2e6af
gitignore modif to include default mii
Blounard Mar 21, 2025
49bf2ee
Merge commit '5e237f4c04f522274cf6109cd6dc53a2f2bab2b4'
Blounard Mar 21, 2025
fea79bc
Fix staticmethod for outside_drift_last_dir (#56)
malleoz Dec 26, 2023
b72a0d7
Merge remote-tracking branch 'upstream/main'
Epik95mkw Mar 21, 2025
c160db8
Update alt infodisplay with docs
Epik95mkw Mar 21, 2025
1f23c3e
TTK GUI listener thread for button commands
Epik95mkw Mar 22, 2025
19383a2
Fix TTK GUI crashing on exit
Epik95mkw Mar 22, 2025
c00fbfa
Use window.mainloop for gui window
Epik95mkw Mar 22, 2025
875172f
Fix freeze(s) caused by TTK GUI buttons
Epik95mkw Mar 23, 2025
7ebc822
Add more comments
Epik95mkw Mar 23, 2025
85a10fc
Update macros and add usage instructions
Epik95mkw Mar 23, 2025
282c363
Update wheelie turn macro
Epik95mkw Mar 24, 2025
744d89e
Update startslide scripts and inputs
Epik95mkw Mar 24, 2025
b5ceb10
Merge pull request #2 from Epik95mkw/main
Blounard Mar 24, 2025
3f9a32b
Delete scripts/Settings/Infodisplay.ini
Blounard Apr 7, 2025
8cbb96a
Delete scripts/Settings/AGC.ini
Blounard Apr 7, 2025
be1cc29
Delete scripts/AGC_Data/ghost_data.agc
Blounard Apr 7, 2025
4095e70
Delete scripts/MKW_Inputs/Startslides directory
Blounard Apr 7, 2025
2bf2286
Delete scripts/Ghost/Default directory
Blounard Apr 7, 2025
4c09cc7
Removed unwanted file from the repo
Blounard Apr 7, 2025
f0e66de
Merge branch 'main' of https://github.com/Blounard/mkw-scripts
Blounard Apr 7, 2025
8e0b6c7
TTK Save scripts auto cancel
Blounard Apr 7, 2025
7c7ee2f
Improved TTK Activate scripts
Blounard Apr 7, 2025
bf8d3ab
infodisplay update
Blounard Apr 7, 2025
6591109
Update TAS_input_window.py
Blounard Apr 7, 2025
41101d9
Update .gitignore
Blounard Apr 7, 2025
8b1194b
Delete scripts/RMC/hop test.py
Blounard Apr 7, 2025
1528535
Delete scripts/RMC/test.py
Blounard Apr 7, 2025
ce51715
Delete scripts/RMC/set_position_test.py
Blounard Apr 7, 2025
20669dd
TTK Settings and Backup
Blounard Apr 8, 2025
ee0d94e
Update AGC_Save_Ghost.py
Blounard Apr 8, 2025
870d6b4
Update draw_input_display.py
Blounard Apr 8, 2025
33fb5be
Update TAS_Input.py
Blounard Apr 8, 2025
acd8dee
draw_infodisplay more often on screen
Blounard Apr 8, 2025
3ad7430
TTK GUI edit
Blounard Apr 8, 2025
a4fab8e
Update startslide_utils.py
Blounard Apr 8, 2025
20fd079
2 bugfixes
Blounard Apr 8, 2025
17b8281
Update external_utils.py
Blounard Apr 9, 2025
afd4332
TTK GUI bugfix + new buttons
Blounard Apr 10, 2025
0ff9d82
Added module for Yaz1 management
Blounard Apr 12, 2025
ac23d11
Update _draw_info_display.py
Blounard Apr 12, 2025
a7aec65
bugfix compressed ghost
Blounard Apr 12, 2025
5ed69fe
Create update_scripts.py
Blounard Apr 13, 2025
c84d7fa
update python stub
Blounard Apr 13, 2025
0e23fdf
Various fixes and updates
Epik95mkw Apr 13, 2025
4ead035
Merge remote-tracking branch 'upstream/main'
Epik95mkw Apr 13, 2025
ddfe33c
Restore input display changes
Epik95mkw Apr 13, 2025
191982b
Merge pull request #3 from Epik95mkw/main
Blounard Apr 13, 2025
36d841f
auto input optimizer v1
Blounard Apr 14, 2025
a16ba05
bugfix infodisplay
Blounard Apr 14, 2025
c9a0b64
Delete ttk_lib -backup.py
Blounard Apr 14, 2025
9f57c75
Update _TTK_Backup.py
Blounard Apr 14, 2025
4347066
added requests to python packages installer
Blounard Apr 14, 2025
b69caea
crash fix attempt
Blounard Apr 14, 2025
e10c307
more infodisplay options
Blounard Apr 15, 2025
11056c7
Update infodisplay_utils.py
Blounard Apr 15, 2025
db5a76f
infodisplay rkg buffer + erase rkg buffer
Blounard Apr 17, 2025
dfd199b
Update infodisplay_utils.py
Blounard Apr 17, 2025
63a0e91
AGC setting update
Blounard Apr 20, 2025
57e6ae4
agc fix aniamtion
Blounard Apr 21, 2025
fd1293a
228 memory check event
Blounard Apr 25, 2025
6539c7b
agc save at exit crashfix
Blounard Apr 25, 2025
a300400
bug fix in settings
Blounard Apr 25, 2025
b5cce6f
python stubs update 230
Blounard Apr 25, 2025
f6e92a1
Exact finish time
Blounard Apr 28, 2025
9f434bf
AGC load player
Blounard Apr 28, 2025
8ec043e
Improved freefly
Blounard May 5, 2025
5bf9235
auto input opti
Blounard May 5, 2025
0bacfe9
small bugfix
Blounard May 5, 2025
acac792
Delete special.py
Blounard May 5, 2025
179dcaa
ttk gui update
Blounard May 6, 2025
1f6c7f6
Update Auto_Input_Optimizer.py
Blounard May 6, 2025
bef2906
Flag for no UI delay
Epik95mkw May 9, 2025
03b9a27
Upgraded superslide macro
Epik95mkw May 9, 2025
80851db
Updated startslide
Blounard May 15, 2025
77aaa14
Merge remote-tracking branch 'upstream/main'
Epik95mkw May 17, 2025
589b175
Boost panel timer
Epik95mkw May 17, 2025
a60ab32
framedump extended
Blounard May 18, 2025
6970bd5
with the packages it's better
Blounard May 18, 2025
a1cacbb
update wiggle slide, and some small fix
Blounard May 20, 2025
4b42f01
framedump script update
Blounard May 25, 2025
940ae8a
bugfix
Blounard May 26, 2025
2c4779f
debug script
Blounard May 26, 2025
42af695
QOL stuff
Epik95mkw May 27, 2025
aff9a88
Update macros after new EV discoveries
Epik95mkw May 27, 2025
ab5a0e4
Merge remote-tracking branch 'upstream/main'
Epik95mkw May 27, 2025
5fe572e
Merge pull request #4 from Epik95mkw/main
Blounard May 27, 2025
35a8080
attempt to fix linux import
Blounard May 27, 2025
ce1aa79
Reverse previous commit
Blounard May 27, 2025
3a36e2f
Attempt to fix import syntax for Linux
Epik95mkw May 28, 2025
7d2465a
bugfix
Blounard May 31, 2025
70cab37
updater update
Blounard May 31, 2025
139fd6a
tiny bugfix
Blounard May 31, 2025
d0a82f9
math geometry function
Blounard May 31, 2025
56d3a09
geometry function
Blounard May 31, 2025
8928445
framedump osd extradisplay
Blounard Jun 1, 2025
4f458ad
Merge remote-tracking branch 'upstream/main'
Epik95mkw Jun 2, 2025
e5326ae
Merge pull request #5 from Epik95mkw/main
Blounard Jun 2, 2025
f58df12
mbp library
Blounard Jun 8, 2025
358ae0c
added input display images
xAntares17 Jun 18, 2025
07ce060
implements width and color options, config_util changed accordingly
xAntares17 Jun 18, 2025
0482f3a
changed spelling: frame to frames
xAntares17 Jun 18, 2025
6c8498e
formatting
xAntares17 Jun 18, 2025
1bfd681
default color fixed
xAntares17 Jun 18, 2025
18efa3d
Merge pull request #6 from xAntares17/width-color-options
Blounard Jun 18, 2025
ba481b2
does the recoloring once in main for better performance
xAntares17 Jun 19, 2025
ddb5169
restructuring
xAntares17 Jun 19, 2025
00ea3fa
necessary name changes
xAntares17 Jun 19, 2025
782f8b9
Merge pull request #7 from xAntares17/width-color-options
Blounard Jun 19, 2025
d1ac30a
AGC copy input 1f delay fix
Blounard Jun 20, 2025
7c5547f
Merge branch 'main' of https://github.com/Blounard/mkw-scripts
Blounard Jun 20, 2025
e9f2867
added comments
Blounard Jun 20, 2025
d8364a8
OSD update for the present event
Blounard Jun 20, 2025
da11212
input display fix when not in race
Blounard Jun 20, 2025
0ce3599
creates additional fonts in the sizes specified in custom_text_scaling
xAntares17 Jun 22, 2025
6e8b2c8
implements custom text function, author display encoding changed to u…
xAntares17 Jun 22, 2025
ab9f138
added slash
xAntares17 Jun 22, 2025
900724a
Merge pull request #8 from xAntares17/custom-text
Blounard Jun 22, 2025
c3e1fb9
performance improvements
xAntares17 Jun 22, 2025
a76eb48
further optimization by selecting the analog stick parts depending on…
xAntares17 Jun 23, 2025
8b55d19
Merge pull request #9 from xAntares17/custom-text
Blounard Jun 23, 2025
fabf855
made dpad edges less rough, added tutorial folder
xAntares17 Jun 25, 2025
ebce1c9
fly in animation
xAntares17 Jun 25, 2025
8b8e678
reanchoring stick text depends on scale
xAntares17 Jun 26, 2025
3e41310
Update input_display_util.py
xAntares17 Jun 26, 2025
2dda662
Add inactive outline colour to config
kierio04 Jun 26, 2025
8b04b5a
Merge pull request #11 from kierio04/main
Blounard Jun 27, 2025
6f79eee
Merge pull request #10 from xAntares17/custom-text
Blounard Jun 27, 2025
3956b0c
pretty speedometer option added as gecko code doesnt use entry anim. …
xAntares17 Jul 1, 2025
44c5659
adds pretty speedometer scaled font
xAntares17 Jul 1, 2025
a2d5217
Merge pull request #12 from xAntares17/custom-text
Blounard Jul 1, 2025
5f1fbc2
improved framdump script
Blounard Jul 15, 2025
eeb66ba
Update mbp_utils.py
Blounard Jul 15, 2025
8f17f66
Update _draw_info_display.py
Blounard Jul 15, 2025
0dc8799
Update framesequence.py
Blounard Jul 18, 2025
28d5272
framedump script update
Blounard Jul 19, 2025
df386fb
Update config_util.py
Blounard Jul 19, 2025
4a108b7
Update config_util.py
Blounard Jul 19, 2025
b32aeb9
Update encoder.py
Blounard Jul 19, 2025
1539a48
fix fly out anim + other small changes
xAntares17 Jul 20, 2025
49ec92c
number quality improvement; letters mostly unchanged except saturatio…
xAntares17 Jul 20, 2025
e7c0aed
Merge pull request #13 from xAntares17/fixes-overhauls
Blounard Jul 20, 2025
3e18867
Update input_display_util.py
Blounard Jul 21, 2025
ed0ab80
framedump script custom timings
Blounard Jul 24, 2025
7a327eb
Update TTK_GUI.py
Blounard Jul 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 25 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
/scripts/MKW_Inputs/*.csv
scripts/MKW_Inputs/**/*.csv
scripts/MKW_Inputs/**/*.rkg
scripts/AGC_Data/**/*.agc
scripts/external/**/*.ini
scripts/Settings/**/*.ini
scripts/FrameDumps/**/*.txt
scripts/FrameDumps/**/*.rawtxt
scripts/FrameDumps/**/*.ini
scripts/FrameDumps/**/*.mp4
scripts/FrameDumps/**/*.mp3
scripts/FrameDumps/**/*.wav
scripts/FrameDumps/*.png

scripts/Data Dump/**
/scripts/Ghost/**/*.rkg
/scripts/Ghost/**/*.csv
**/__pycache__
**/*test*.py


scripts/RMC/test.py
scripts/RMC/test codecallbacl.py

/scripts/Input_optimizer
scripts/RMC/test tp lap.py
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"python.analysis.extraPaths": [
"./scripts/python-stubs"
],
"editor.detectIndentation": false
}
Empty file.
93 changes: 93 additions & 0 deletions scripts/FrameDumps/Extra/author_display_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import moviepy
import numpy as np
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import sys
import os
import time
import subprocess
import math

from Extra import common

def make_list_author(c, main_folder):
#return a dict so that result[frame] contain an ordered list of author that contributed on that frame
#also return a list of all author
result = {}
raw_author_list = []
author_file = os.path.join(main_folder, c.get('author_list_filename'))
if os.path.isfile(author_file):
with open(author_file, 'r', encoding='utf-8') as f:
entry_list = f.read().split('\n')
for entry in entry_list:
temp = entry.split(':')
author_name = temp[0]
raw_author_list.append(author_name)
frames_entry = temp[1].split(',')
for token in frames_entry:
temp = token.split('-')
for frame in range(int(temp[0]), int(temp[-1])+1):
if not frame in result.keys():
result[frame] = []
result[frame].append(author_name)
return raw_author_list, result


def add_author_display(image, frame_dict, config, main_folder, raw_author_list, author_dict):
ad_config = config['Author display']
state, state_counter = int(frame_dict['state']), int(frame_dict['state_counter'])
author_display_layer = Image.new('RGBA', image.size, (0,0,0,0))
ID = ImageDraw.Draw(author_display_layer)
font_folder = os.path.join(main_folder, 'Fonts')
top_left_text = ad_config.get('top_left').split(',')
top_left = round(float(top_left_text[0])*image.width), round(float(top_left_text[1])*image.height)
font_size = ad_config.getint('font_size')
font = ImageFont.truetype(os.path.join(font_folder, ad_config.get('font')), font_size)
active_text_color = common.get_color(ad_config.get('active_text_color'))
inactive_text_color = common.get_color(ad_config.get('inactive_text_color'))
outline_width = ad_config.getint('outline_width')
active_outline_color = common.get_color(ad_config.get('active_outline_color'))
inactive_outline_color = common.get_color(ad_config.get('inactive_outline_color'))
curframe = int(frame_dict['frame_of_input'])
spacing = 4
current_h = top_left[1]

for author_name in raw_author_list:
if curframe in author_dict.keys() and author_name in author_dict[curframe]:
ID.text( (top_left[0], current_h), author_name, fill = active_text_color, font = font, stroke_width = outline_width, stroke_fill = active_outline_color)
else:
ID.text( (top_left[0], current_h), author_name, fill = inactive_text_color , font = font, stroke_width = outline_width, stroke_fill = inactive_outline_color)
current_h += spacing + font_size


if ad_config.getboolean('fade_animation'):
author_display_layer = common.fade_image_manually(author_display_layer, frame_dict, ad_config)

# TODO
# if you change the delay to 0f (encoder line 97&98) the anim starts 1f early
# once shad's GUI is done, this can be parameterized easily. It's hard to notice so I didn't bother.

if ad_config.getboolean('fly_animation'):

if state == 1 and state_counter <= 10:
return None

offset = common.fly_in(frame_dict, image.height)
if state == 4 and 192 < state_counter <= 201:
image.alpha_composite(author_display_layer, (round(0 - image.width*offset), 0))
return None

ITEM_POSITION = 381/1440
AUTHOR_DISPLAY_POSITION = (1 - float(top_left_text[1]))
height_correction = round((AUTHOR_DISPLAY_POSITION - ITEM_POSITION)*image.height)

if offset is not None:
if ad_config.get('fly_in_direction') == 'bottom':
image.alpha_composite(author_display_layer, (0, image.height - top_left[1] - height_correction - offset))
else:
image.alpha_composite(author_display_layer, (0, offset - round(ITEM_POSITION*image.height)))
else:
image.alpha_composite(author_display_layer, (0,0))
else:
image.alpha_composite(author_display_layer, (0,0))
147 changes: 147 additions & 0 deletions scripts/FrameDumps/Extra/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import moviepy
import numpy as np
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from PIL import ImageFilter
import sys
import os
import time
import subprocess
import math

def get_color(color_text):
n = int(color_text, 16)
l = []
for _ in range(4):
l.append(n%256)
n//=256
l.reverse()
return tuple(l)

def color_white_part(image, color):

if image.mode != 'RGBA':
image = image.convert('RGBA') #needed, crashes otherwise if image doesnt have transparency like analog_5_3_part1

color = tuple(color[:3])
pixels = image.load()
for y in range(image.height):
for x in range(image.width):
r, _, _, a = pixels[x, y]

if r == 255:
pixels[x, y] = (color[0], color[1], color[2], a)
else:
brightness = r / 255
new_r = int(color[0] * brightness)
new_g = int(color[1] * brightness)
new_b = int(color[2] * brightness)
pixels[x, y] = (new_r, new_g, new_b, a)

return image

def get_filter_list(config_text):
raw_list = config_text.split(',')
filters = []
for raw_text in raw_list:
if raw_text in ['BLUR', 'blur', 'Blur']:
filters.append(ImageFilter.BLUR)
elif raw_text in ['CONTOUR', 'contour', 'Countour']:
filters.append(ImageFilter.CONTOUR)
elif raw_text in ['DETAIL', 'detail', 'Detail']:
filters.append(ImageFilter.DETAIL)
elif raw_text in ['EDGE_ENHANCE', 'Edge_enhance', 'edge_enhance', 'Edge_Enhance']:
filters.append(ImageFilter.EDGE_ENHANCE)
elif raw_text in ['EDGE_ENHANCE_MORE', 'Edge_enhance_more', 'edge_enhance_more', 'Edge_Enhance_More', 'Edge_enhance_More']:
filters.append(ImageFilter.EDGE_ENHANCE_MORE)
elif raw_text in ['EMBOSS', 'Emboss', 'emboss']:
filters.append(ImageFilter.EMBOSS)
elif raw_text in ['FIND_EDGES', 'Find_edges', 'find_edges', 'Find_Edges']:
filters.append(ImageFilter.FIND_EDGES)
elif raw_text in ['SHARPEN', 'Sharpen', 'sharpen']:
filters.append(ImageFilter.SHARPEN)
elif raw_text in ['SMOOTH', 'Smooth', 'smooth']:
filters.append(ImageFilter.SMOOTH)
elif raw_text in ['SMOOTH_MORE', 'Smooth_more', 'smooth_more', 'Smooth_More']:
filters.append(ImageFilter.SMOOTH_MORE)
return filters

def get_resampler(resample_filter):
if resample_filter in ['nearest', 'Nearest', 'NEAREST']:
return Image.Resampling.NEAREST
elif resample_filter in ['bicubic', 'Bicubic', 'BICUBIC']:
return Image.Resampling.BICUBIC
elif resample_filter in ['bilinear', 'Bilinear', 'BILINEAR']:
return Image.Resampling.BILINEAR
elif resample_filter in ['box', 'Box', 'BOX']:
return Image.Resampling.BOX
elif resample_filter in ['hamming', 'Hamming', 'HAMMING']:
return Image.Resampling.HAMMING
else:
return Image.Resampling.LANCZOS


def is_layer_active(frame_dict, config):
#Return a boolean if the layer should be visible on screen
fade_in_len = config.getint('fade_in_duration', 20)
fade_out_len = config.getint('fade_out_duration', 120)
start = config.getint('start_frame', 0)
try:
end = config.getint('end_frame')
except:
end = None
state, state_counter = int(frame_dict['state']), int(frame_dict['state_counter'])
curframe = int(frame_dict['frame_of_input'])

if state < 1 or curframe <= start:
return False
if end and curframe >= end + fade_out_len:
return False
if end is None and state >= 4 and state_counter >= fade_out_len:
return False
return True

def fade_image_manually(image, frame_dict, config):
fade_in_len = max(1,config.getint('fade_in_duration', 20))
fade_out_len = max(1,config.getint('fade_out_duration', 120))
start = config.getint('start_frame', 0)
try:
end = config.getint('end_frame')
except:
end = None
state, state_counter = int(frame_dict['state']), int(frame_dict['state_counter'])
curframe = int(frame_dict['frame_of_input'])

if state >= 1 and start <= curframe < fade_in_len + start :
#fade in
alpha = (curframe - start)/fade_in_len
r,g,b,a = image.split()
a = a.point(lambda x:x*alpha)
image = Image.merge("RGBA", (r,g,b,a))
if end is None and state >= 4 and state_counter < fade_out_len:
#fade out on stage 4
alpha = 1 - state_counter/fade_out_len
r,g,b,a = image.split()
a = a.point(lambda x:x*alpha)
image = Image.merge("RGBA", (r,g,b,a))
if end and end < curframe <= fade_out_len + end :
#fade out on frame > end
alpha = 1 - (curframe - end)/fade_out_len
r,g,b,a = image.split()
a = a.point(lambda x:x*alpha)
image = Image.merge("RGBA", (r,g,b,a))
return image

def fly_in(frame_dict, height):
state, state_counter = int(frame_dict['state']), int(frame_dict['state_counter'])

if state == 1 and 10 < state_counter < 21:
DISPLACEMENT_RATIOS = [0.0757, 0.1549, 0.225, 0.4333, 0.382, 0.3402, 0.308, 0.284, 0.269, 0.265]
idx = state_counter - 11
return round(DISPLACEMENT_RATIOS[idx]*height)
if state == 4 and 192 < state_counter < 202:
FLY_OUT_RATE = 1/10
idx = state_counter - 192
return FLY_OUT_RATE * idx
return None
Loading