Module: PseudoGame.graphics.effects
a module with some premade visual effects
Functions
PseudoGame.graphics.effects:blend (polygon_collection1, polygon_collection2, blend_func[, blend_collection]) | get the polygons that represent the intersection of two collections | |
PseudoGame.graphics.effects:outline (polygon_collection, thickness, color[, outline_collection]) | creates polygons along the edges of some polygons | |
PseudoGame.graphics.effects:glow (polygon_collection, intensity, radius, radius_step, angle_step[, glow_collection]) | renders a glow effect by rendering polygons many times, this is extremely laggy | |
PseudoGame.graphics.effects:gradient_glow (polygon_collection, size, initial_alpha_divisor, corner_resolution[, glow_collection]) | renders a glow effect by creating gradients around the polygons | |
PseudoGame.graphics.effects:rotate (angle) | generates a transformation function that rotates vertices | |
PseudoGame.graphics.effects:mirror (mirror_x, mirror_y) | generates a transformation function that mirrors vertices |
Fields
draw_directly | setting effects.draw_directly to true will make the effects, that take a polygon collection to output to, draw directly to the screen instead |
Functions
- 🔗 PseudoGame.graphics.effects:blend (polygon_collection1, polygon_collection2, blend_func[, blend_collection])
-
get the polygons that represent the intersection of two collections
Parameters:
Name Type(s) Description polygon_collection1 PolygonCollection the first collection polygon_collection2 PolygonCollection the second collection blend_func function this function determines the color of the new polygons based on the color of the two intersected ones, so it should take r0, g0, b0, a0, r1, g1, b1, a1
and returnr, g, b, a
blend_collection Optional PolygonCollection the collection the resulting polygons are added to (the collection is cleared before the operation) (not required if direct drawing is enabled) - 🔗 PseudoGame.graphics.effects:outline (polygon_collection, thickness, color[, outline_collection])
-
creates polygons along the edges of some polygons
Parameters:
Name Type(s) Description polygon_collection PolygonCollection the polygon collection the outlines should be made for thickness number the thickness of the outlines color table the color of the outlines, should be formatted like this: {r, g, b, a}
outline_collection Optional PolygonCollection the polygon collection the outlines will be added to (the collection is cleared before the operation) (not required if direct drawing is enabled) - 🔗 PseudoGame.graphics.effects:glow (polygon_collection, intensity, radius, radius_step, angle_step[, glow_collection])
-
renders a glow effect by rendering polygons many times, this is extremely laggy
Parameters:
Name Type(s) Description polygon_collection PolygonCollection the polygon collection the glow should be made for intensity number the intensity of the effect (should be between 0 and 1) radius number the radius of the effect radius_step number the step size of the effect in the outer direction (lower values can lead to a lot of lag) angle_step number the step size of the effect around the object (lower values can lead to a lot of lag) glow_collection Optional PolygonCollection the polygon collection the glow will be added to (the collection is cleared before the operation) (not required if direct drawing is enabled) - 🔗 PseudoGame.graphics.effects:gradient_glow (polygon_collection, size, initial_alpha_divisor, corner_resolution[, glow_collection])
-
renders a glow effect by creating gradients around the polygons
Parameters:
Name Type(s) Description polygon_collection PolygonCollection the polygon collection the glow should be made for size number the size of the effect (in non zoom factor adjusted pixels) initial_alpha_divisor number the number the alpha right at the edge of the polygon will be divided by (to create some contrast, otherwise the effect looks like a blur) corner_resolution number the amount of vertices to add in the corners (has to be >= 1) glow_collection Optional PolygonCollection the polygon collection the glow will be added to (the collection is cleared before the operation) (not required if direct drawing is enabled) - 🔗 PseudoGame.graphics.effects:rotate (angle)
-
generates a transformation function that rotates vertices
Parameters:
Name Type(s) Description angle number the angle to rotate Returns:
-
function
the transformation function
- 🔗 PseudoGame.graphics.effects:mirror (mirror_x, mirror_y)
-
generates a transformation function that mirrors vertices
Parameters:
Name Type(s) Description mirror_x bool whether it should mirror along the x axis mirror_y bool whether it should mirror along the y axis Returns:
-
function
the transformation function
Fields
- 🔗 draw_directly
- setting effects.draw_directly to true will make the effects, that take a polygon collection to output to, draw directly to the screen instead