Skip to content

Instantly share code, notes, and snippets.

View tshirtman's full-sized avatar

Gabriel Pettier tshirtman

View GitHub Profile
@tshirtman
tshirtman / Overworld.png
Last active September 2, 2024 10:12
a tilemap implementation in kivy using a shader
Overworld.png
@tshirtman
tshirtman / dock.py
Created April 17, 2021 10:52
using a shader to build a bottom dock for buttons with a circle opening in it
'''
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.graphics import RenderContext
from kivy import properties as P
'''
'''
import random
from uuid import uuid4
from string import ascii_lowercase
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import ListProperty, StringProperty
@tshirtman
tshirtman / rv_visible.py
Created March 23, 2021 22:09
recycleview behind the scene
'''
'''
from kivy.app import App
from kivy.lang import Builder
KV = '''
#:import get_random_color kivy.utils.get_random_color
<-StencilView>:
@el3
el3 / function_lines.py
Last active December 19, 2020 15:48
A kivy example, that will take touch inputs as input, and will fit a function to the points, and draw a line. With slider to test higher orders. And textinputs, where you can use arrow up and down to adjust numbers
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.graphics import Line, Ellipse, Color
from kivy.properties import ListProperty, StringProperty, NumericProperty
from kivy.core.window import Window
import numpy as np
@carolynvs
carolynvs / .gitconfig
Last active October 19, 2022 14:44
git wip - Show what branches you have been working on lately
[alias]
wip = for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads
@salt-die
salt-die / wobblywidget.py
Last active June 21, 2020 19:42
Make any widget wobble with wobbly widget!
"""For this to work, WobblyEffect should be parent to WobblyScatter.
"""
from kivy.clock import Clock
from kivy.uix.effectwidget import AdvancedEffectBase, EffectWidget
from kivy.uix.scatter import Scatter
from itertools import product
FRICTION = .95
K = 8
@tshirtman
tshirtman / coverimage.py
Created April 28, 2020 18:25
simple cover image / letterboxing implementation in kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
KV = '''
FloatLayout:
Image:
size_hint: None, None
source: 'landscape.png'
@tito
tito / transparent_video_test.py
Last active June 28, 2023 20:36
Kivy/ffpyplayer transparent/alpha background video
"""
Kivy/ffpyplayer example to read transparent video
=================================================
Right now, VP9/ffmpeg encoder supports alpha channel, under the yuva420p
pixel format. But for decoding, the default libvp9 used by ffmpeg doesn't
support it, so we need to ask for libvpx-vp9 instead.
I was using a set of png image as a source, and got a VP9+alpha video with::
@salt-die
salt-die / meatballs.py
Last active January 2, 2022 23:20
poke metaballs with this metaball shader written for kivy
"""Scroll with the mouse to enable auto-poking."""
from random import random
from kivy.app import App
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.effectwidget import AdvancedEffectBase