Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate animation assets from SVG #7

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
elementary/animation-*.png
elementary/throbber-*.png
187 changes: 187 additions & 0 deletions data/throbber.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ Source: plymouth-theme-elementary
Section: x11
Priority: optional
Maintainer: elementary OS Team <builds@elementary.io>
Build-Depends: debhelper (>= 10.5.1)
Build-Depends: debhelper (>= 10.5.1),
meson,
imagemagick
Standards-Version: 4.5.0

Package: plymouth-theme-elementary
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/make -f

%:
dh $@
dh $@ --buildsystem=meson
meisenzahl marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project(
'io.elementary.plymouth-theme'
)

convert = find_program('convert')

meson.add_install_script('meson/post_install.py')
64 changes: 64 additions & 0 deletions meson/post_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
import os
import shutil
import subprocess

install_dir = os.environ.get('MESON_INSTALL_PREFIX', '/usr')
base_dir = os.environ.get('MESON_SOURCE_ROOT', '.')

theme_dir = os.path.join(install_dir, 'share', 'plymouth', 'themes', 'elementary')

STEPS = 12
IMAGES_PER_STEP = 4
SIZE = 38

SVG = os.path.join(base_dir, 'data', 'throbber.svg')

for i in range(0, STEPS):
STEP_BASE_IMAGE = os.path.join(theme_dir, 'throbber-{:04d}.png'.format(i * IMAGES_PER_STEP))

subprocess.call([
'convert',
'-background',
'none',
SVG,
STEP_BASE_IMAGE
])

subprocess.call([
'convert',
'-background',
'none',
'-rotate',
'{:d}'.format(i * 30),
STEP_BASE_IMAGE,
STEP_BASE_IMAGE
])

subprocess.call([
'convert',
'-background',
'none',
'-gravity',
'center',
'-extent',
'{:d}x{:d}'.format(SIZE, SIZE),
STEP_BASE_IMAGE,
STEP_BASE_IMAGE
])

for j in range(1, IMAGES_PER_STEP):
STEP_IMAGE = os.path.join(theme_dir, 'throbber-{:04d}.png'.format(i * IMAGES_PER_STEP + j))
shutil.copyfile(
STEP_BASE_IMAGE,
STEP_IMAGE
)

for i in range(0, STEPS * IMAGES_PER_STEP):
try:
shutil.copyfile(
os.path.join(theme_dir, 'throbber-{:04d}.png'.format(i)),
os.path.join(theme_dir, 'animation-{:04d}.png'.format(i))
)
except shutil.SameFileError:
pass