Advanced Random Tutorial

2 favourites
From the Asset Store
Carousel Animation, make carousel of you image gallery or anything
  • Little late on this post, but is it possible to do a raidal gradient with it like this one

    I only saw horizontal gradient in the tutorial.

    And if the answer is yes, can this gradient be animated?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • eonian it's not something I had originally considered for it, but it's possible yes.

    As I was interested in how possible it was I gave it a go, you can check out the project below.

    It works in a similar way to the other gradients I did except per pixel it calculates the angle between the pixel and a given position ( in this case {x: 127, y: 127} ). The angle can then be fed into the gradient expression to get a radial gradient.

    I've tried animating it by adding an increasing value to the angle and wrapping it to the 0 - 360 range. Which works, you can probably do something more exciting by transforming the angle with some cool maths though. As you can see it's using waaaaay too much CPU to be practical unfortunately, hence the poor framerate ( I get about 8FPS ) normally this sort of thing is done on the GPU which is optimised for doing complex per pixel maths like this.

    You may have more success writing a custom effect, as that would be run on the GPU and the maths is much the same just written in shader language (GLSL). You would have to write your own gradient system, but interpolating colours is easier in GLSL thankfully. Only downside is that you would likely have to hardcode the gradient values into the effect.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)