A downloadable project

Download NowName your own price

WHAT IS CIRCLECOLORMULTI

CircleColorMulti, or CCM in short, is a very small library that allows you to draw colored circles with more colors and more complex patterns that the linear interpolation between two colors that Gamemaker's default draw_circle_color offers.

What CCM allows you to do:

  • Draw as many colors in a circle as you want, the colors will be equally distributed along the circle's radius
  • Adjust opacity for each color
  • Adjust how much one fades from the previous one,in case yoo don't want colors to simply fade from each other in a linear way
  • Adjust the position of the color in the radius itself, using a 0 to 1 scale

SETUP AND USAGE

CCM circles can be drawn just line any normal circle with the draw_circle_color_multi function.

draw_circle_color_multi(x,y,radius,[steps],[colors]);
  • x {real} : the horizontal position where the circle will be drawn
  • y {real} : the vertical position where the circle will be drawn
  • radius {real} : the radius of the circle
  • steps {real} : the number of points the circle will have, check draw_set_circle_precision to learn more how it works. Really high numbers might break the circle.
  • colors {array} : the most important part of the function, in here you will set all the parameters to tell the circle how to render all of the various colors.


INSERTING COLORS

  [     color /     [color, alpha, {fading, factor} ]     ,...   ]

Colors are inserted in an array, and each color can either be a simple color id, or an array containing the other parameters. If you use an array fading and factor are optional.

Fading controls how much the color will fade from the previous one, a value of 1 will make it so that there is no transition between the color and the previous one, but just a hard cut to the new color. This parameter is not applied to the first color.

Factor determines where on the circle the color will be drawn, the value goes from 0 to 1, with 0 being the center of the circle and 1 being its edge, this parameter is useful if you don't want colors to be distributed equally along the circle.

THE CCM FUNCTION

CCM has a special CCM() function that lets you control a circle like a struct, the struct contains various functions that can be used to alter and draw multiple versions of the same circle.

   my_ccm = CCM(radius,[colors],[name]);

The arguments are the same as stated before, name is simply a way to group CCMs better but it's not required.

Functions can be used like this:

  my_ccm.draw(50,50);   my_ccm.opacity(0.5).draw(100,50);

Be careful when you use functions that alter the circle's look, as those will be present anytime you draw the circle after using the function.

List of functions:

draw(x, y) - Draws the circle

- x : the horizontal position where the circle will be drawn
- y : the vertical position where the circle will be drawn

transform([xscale], [yscale]) - Scales the circle

- xscale : the horizontal scaling that will be applied to the circle
- yscale : the vertical scaling that will be applied to the circle

angle(direction) - Changes the angle of the circle's segments along its radius

- direction : the direction that will be added to the circle's points, the rotation will only be visible on low segment circles

opacity(value) - Changes the circle's overall alpha value

- value : the alpha value that will be applied to the circle

blend(mode) - Applies a blend mode to the circle

- mode : the blend mode that will be used by the circle

segments(num) - Changes the amount of segments in the circle

- num : the number of segments the circle will have

drawName([x], [y]) - Draws the circle's name

- x : the horizontal position where the name will be drawn
- y : the vertical position where the name will be drawn



Always remember to get rid of the struct once it's not needed anymore.

CCM is also available on Github

Download

Download NowName your own price

Click download now to get access to the following files:

CircleColorMulti v1.0.yymps 3 kB

Leave a comment

Log in with itch.io to leave a comment.