# Is it possible to create and set user defined fragment constant on gui?

**URL:** <https://forum.defold.com/t/is-it-possible-to-create-and-set-user-defined-fragment-constant-on-gui/82088>\
**Category:** Questions\
**Created:** [December 14, 2025, 7:25am UTC](https://forum.defold.com/t/is-it-possible-to-create-and-set-user-defined-fragment-constant-on-gui/82088 "2025-12-14T07:25:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [December 14, 2025, 7:50am UTC](https://forum.defold.com/t/is-it-possible-to-create-and-set-user-defined-fragment-constant-on-gui/82088/2 "2025-12-14T07:50:41Z")

</div>

Hello @wind! 👋😉  
Yes, totally, you can assign material to gui nodes with fragment constants, check out for example how I made a simple stripe/shining effect for gui nodes for one of our Community Challenges, where fragment constants are used:

> [@GUI: Animated light effect on logo](https://forum.defold.com/t/gui-animated-light-effect-on-logo/79420/5):
>
> Ok, first version would be something like this: Fragment program for this is very simple: varying mediump vec2 var\_texcoord0; varying lowp vec4 var\_color; uniform lowp sampler2D texture\_sampler; uniform lowp vec4 tint; uniform mediump vec4 stripe\_data; // (x - position, y - width, z - sharpness, w - angle) void main() { lowp vec4 tex = texture2D(texture\_sampler, var\_texcoord0.xy); // Calculate the distance from the stripe center mediump flo…

---

_[View the full topic](https://forum.defold.com/t/is-it-possible-to-create-and-set-user-defined-fragment-constant-on-gui/82088)._
