valentinilk / compose-shimmer

A simple shimmer library for Jetpack Compose.
https://valentinilk.github.io/compose-shimmer/
Apache License 2.0
634 stars 35 forks source link

Shimmer effect issue #26

Open Takshaksh opened 8 months ago

Takshaksh commented 8 months ago

This error keep logging in the logger, I have used the credit card like shimmer effect on a Text composable:

Text()

Text(
      text = "PREMIUM FEATURES",
      textAlign = TextAlign.Center,
      color = if (hasBackground) Color.White else Green,
      fontSize = 14.5.sp,
      fontWeight = FontWeight.SemiBold,
      modifier = Modifier
          .shimmer()
          .background(
              color = if (hasBackground) Green else GreenLite,
              shape = RoundedCornerShape(16.dp)
          )
  )

Shimmer Theme

private val shiningShimmerTheme = defaultShimmerTheme.copy(
    animationSpec = infiniteRepeatable(
        animation = tween(
            durationMillis = 1200,
            delayMillis = 2_000,
            easing = LinearEasing,
        ),
    ),
    blendMode = BlendMode.Hardlight,
    rotation = 25f,
    shaderColors = listOf(
        PrimaryLiteColor.copy(alpha = 0.0f),
        PrimaryLiteColor.copy(alpha = 0.8f),
        PrimaryLiteColor.copy(alpha = 0.0f),
    ),
    shaderColorStops = null,
    shimmerWidth = 400.dp,
)

Error


          0:3(12): error: extension `GL_EXT_shader_framebuffer_fetch' unsupported in fragment shader
2024-02-05 12:27:01.112  6035-6084  skia  com.example.animationex  D  Shader compilation error
          ------------------------
2024-02-05 12:27:01.112  6035-6084  skia  com.example.animationex  D     1  #version 310 es
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     2  
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     3  #extension GL_EXT_shader_framebuffer_fetch : require
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     4  precision mediump float;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     5  precision mediump sampler2D;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     6  inout mediump vec4 sk_FragColor;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     7  uniform mediump vec4 uleftBorderColor_Stage1_c0_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     8  uniform mediump vec4 urightBorderColor_Stage1_c0_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D     9  uniform highp vec4 uscale01_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    10  uniform highp vec4 ubias01_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    11  uniform highp vec4 uscale23_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    12  uniform highp vec4 ubias23_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    13  uniform mediump float uthreshold_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    14  in highp vec2 vTransformedCoords_0_Stage0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    15  flat in mediump vec4 vcolor_Stage0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    16  mediump vec4 stage_Stage1_c0_c0_c0_c0(mediump vec4 _input) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    17      mediump vec4 _output;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    18      mediump float t = vTransformedCoords_0_Stage0.x + 9.9999997473787516e-06;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    19      _output = vec4(t, 1.0, 0.0, 0.0);
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    20      return _output;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    21  }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    22  mediump vec4 stage_Stage1_c0_c0_c1_c0(mediump vec4 _input) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    23      mediump vec4 _output;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    24      mediump float t = _input.x;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    25      highp vec4 scale, bias;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    26      if (t < uthreshold_Stage1_c0_c0_c1_c0) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    27          scale = uscale01_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    28          bias = ubias01_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    29      } else {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    30          scale = uscale23_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    31          bias = ubias23_Stage1_c0_c0_c1_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    32      }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    33      _output = t * scale + bias;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    34      return _output;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    35  }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    36  mediump vec4 stage_Stage1_c0_c0(mediump vec4 _input) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    37      mediump vec4 _output;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    38      mediump vec4 t = stage_Stage1_c0_c0_c0_c0(vec4(1.0));
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    39      if (t.x < 0.0) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    40          _output = uleftBorderColor_Stage1_c0_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    41      } else if (t.x > 1.0) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    42          _output = urightBorderColor_Stage1_c0_c0;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    43      } else {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    44          _output = stage_Stage1_c0_c0_c1_c0(t);
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    45      }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    46      return _output;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    47  }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    48  mediump float _blend_overlay_component(mediump float sc, mediump float sa, mediump float dc, mediump float da) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    49      if (2.0 * dc <= da) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    50          return (2.0 * sc) * dc;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    51      }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    52      return sa * da - (2.0 * (da - dc)) * (sa - sc);
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    53  }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    54  mediump vec4 blend_overlay(mediump vec4 src, mediump vec4 dst) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    55      mediump vec4 result = vec4(_blend_overlay_component(src.x, src.w, dst.x, dst.w), _blend_overlay_component(src.y, src.w, dst.y, dst.w), _blend_overlay_component(src.z, src.w, dst.z, dst.w), src.w + (1.0 - src.w) * dst.w);
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    56      result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w);
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    57      return result;
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    58  }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    59  mediump vec4 blend_hard_light(mediump vec4 src, mediump vec4 dst) {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    60      return blend_overlay(dst, src);
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    61  }
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    62  void main() {
2024-02-05 12:27:01.113  6035-6084  skia  com.example.animationex  D    63      mediump vec4 output_Stage1;
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    64      {
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    65          output_Stage1 = stage_Stage1_c0_c0(vec4(1.0, 1.0, 1.0, 1.0));
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    66      }
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    67      {
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    68          mediump vec4 _dstColor = sk_FragColor;
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    69          sk_FragColor = blend_hard_light(output_Stage1, _dstColor);
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    70          sk_FragColor = sk_FragColor;
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    71      }
2024-02-05 12:27:01.114  6035-6084  skia  com.example.animationex  D    72  }```
valentinilk commented 6 months ago

Which platform did you test this on?

Takshaksh commented 4 months ago

This is Android application running on API 33.