A quad that efficiently draws a 2D light ray effect on its surface. That's useful for adding atmospheric effects, like the typical effects you see underwater or in a forest. (Demo Source.)
Play around with the different settings to make it suit the style you want. In addition to the class-specific properties, you can also assign an overall color or different colors per vertex.
Add it to a juggler or call advanceTime
so that the effect
becomes animated.
var godRays:GodRayPlane = new GodRayPlane(320, 200); godRays.color = 0xff8000; godRays.speed = 0.1; // animation speed godRays.size = 0.1; // number of rays ~= 1 / size godRays.skew = 0; // angle of rays godRays.shear = 0; // spread of angle godRays.fade = 1; // rays fade out towards the bottom godRays.contrast = 1; // distinctiveness and brightness of the rays addChild(godRays); Starling.juggler.add(godRays);
Since most of the work is done in a shader, this effect is very lightweight and renders really fast. A MeshStyle
, together with a MeshEffect
, does the heavy lifting.
Feel free to edit this part of the page if you want to add information that's lacking in the above description.
Questions are better asked in the forum, though.