QShader - Shaders support for 2D PyQt Games.
Project description
Powerful shading support for PyQt5..
#thread QTimer 10
#pre_define hue 0
#import PyQt5.QtGui QColor
#begin_shader
Color1 = QColor.fromHsv(hue, 50, 200)
Color2 = QColor.fromHsv((hue + 30) % 360, 50, 220)
Color3 = QColor.fromHsv((hue + 60) % 360, 50, 240)
if @@UNDER_MOUSE:
Gradient = f"qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 {Color1.name()}, stop:{@@MOUSE_POSITION_WIDGET.x() / $$parent.width()} {Color2.name()}, stop:1 {Color3.name()})"
else:
Gradient = f"qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 {Color1.name()}, stop:0.5 {Color2.name()}, stop:1 {Color3.name()})"
$$style(f"background: {Gradient}; color: white; border: 0px solid; border-radius: 1px; font-size: 18px; padding: 15px;")
$$effect(BloomEffect, 100, QColor.fromRgb(Color1.red(), Color2.green(), Color3.blue(), @@RGB_MAX))
hue = (hue + 1) % 360
#end_shader
#thread QTimer 10
#pre_define hue 0
#import PyQt5.QtGui QColor
#begin_shader
color = QColor.fromHsv(hue, @@RGB_MAX, @@RGB_MAX)
$$style(f'background-color: {color.name()}; color: black; border: 0px; font-size: 20px; padding: 30px;')
$$effect(BloomEffect, 250, color)
$$parent.setText(color.name())
hue = (hue + (2 if @@UNDER_MOUSE else 1)) % 360
#end_shader
WARNING: QShader is in ALPHA state, please be patient and report all bugs.
QShader Documentation. QTS Documentation.
QShader V1.0.0-ALPHA.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qshader-1.1.0.tar.gz
(6.8 kB
view hashes)