iOS / GLES2: How to achieve Glow Effect

前端 未结 3 756
旧时难觅i
旧时难觅i 2021-01-25 09:09

I have a compass style needle, free to spin.

I need it to glow when it approaches a certain orientation, say 55 degrees.

I want to have NeedleView subclass UI

相关标签:
3条回答
  • 2021-01-25 09:37

    I experimented with a lot of approaches here.

    basically I neeed two images; one glowing and one not.

    then I can draw them as CALayers on top of one another, and hijack CADisplayLink, setting

    glowLayer.opacity = glowFac;
    dullLayer.opacity = (1 - glowFac);
    

    I also played with fiddling around in GL shaders, passing the glow factor as a uniform, but this is a ton of code to do basically the same thing.

    NB I needed to find a graphic artist to 'glow' the image

    0 讨论(0)
  • 2021-01-25 09:44

    You could create the glow around the needle's image in Photoshop. Just replace the image in the app at runtime when glow is turned on.

    0 讨论(0)
  • 2021-01-25 09:49

    If you use drawRect for your drawing your needle you could possible do something like this:

    Is there an easy way or library available to let text glow?

    0 讨论(0)
提交回复
热议问题