I have the following canvas item shader code. The problem with it is that rotation seems to speed up over time. I suspect this is caused by me also offsetting the UV over time. Im looking for way around this. Here is my code:
shader_type canvas_item;
uniform float rotation;
uniform float speed_scale;
vec2 rotateUV(vec2 uv, vec2 pivot, float rot) {
float cosa = cos(rot);
float sina = sin(rot);
uv -= pivot;
return vec2(
cosa * uv.x - sina * uv.y,
cosa * uv.y + sina * uv.x
) + pivot;
}
void vertex() {
UV.y += time * speed_scale;
}
void fragment(){
vec4 color;
color = texture(TEXTURE, rotateUV(UV, vec2(0.5), rotation ));
COLOR = color;
}