Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
Shader para criar progressbars usando máscaras para obter outros formatos shader_type canvas_item; uniform sampler2D mask_texture; uniform float progress : hint_range(0.0, 1.0); uniform vec4 fill_color : source_color; uniform vec4 empty_color : source_color; uniform int fill_direction : hint_enum("Vertical", "Horizontal") = 0; void fragment() { vec4 mask = texture(mask_texture, UV); if (mask.a < 0.01) { discard; } float uv_pos; // Define qual eixo vai ser usado pro preenchimento if (fill_direction == 0) { // Vertical (de baixo pra cima) uv_pos = 1.0 - UV.y; } else { // Horizontal (da esquerda pra direita) uv_pos = UV.x; } // Define se o pixel está preenchido float is_filled = step(uv_pos, progress); // Mistura as cores conforme o preenchimento vec4 chosen = mix(empty_color, fill_color, is_filled); COLOR = vec4(chosen.rgb, mask.a * chosen.a); }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)