jujuadams / clean-shapes Goto Github PK
View Code? Open in Web Editor NEWAntialiased primitives library for GameMaker Studio 2023.1
License: MIT License
Antialiased primitives library for GameMaker Studio 2023.1
License: MIT License
Here's another thing I noticed
Higher rounding and border thickness worsen the effects
Code for the above gif:
var _x = 100, _y = 200, _size = 50, _offset = sin(current_time / 500);
CleanConvex([_x - _size, _y - _size, _x + _size + (_offset * _size), _y - _size - (_offset * _size), _x + _size, _y + _size, _x - _size, _y + _size]).Blend(c_orange, 1.0).Border(10, c_red, 1.0).Rounding(0).Draw();
_x += _size * 3;
CleanConvex([_x - _size, _y - _size, _x + _size + (_offset * _size), _y - _size - (_offset * _size), _x + _size, _y + _size, _x - _size, _y + _size]).Blend(c_orange, 1.0).Border(30, c_red, 1.0).Rounding(0).Draw();
_x += _size * 3;
CleanConvex([_x - _size, _y - _size, _x + _size + (_offset * _size), _y - _size - (_offset * _size), _x + _size, _y + _size, _x - _size, _y + _size]).Blend(c_orange, 1.0).Border(10, c_red, 1.0).Rounding(30).Draw();
_x += _size * 3;
CleanConvex([_x - _size, _y - _size, _x + _size + (_offset * _size), _y - _size - (_offset * _size), _x + _size, _y + _size, _x - _size, _y + _size]).Blend(c_orange, 1.0).Border(30, c_red, 1.0).Rounding(30).Draw();
Setting a border larger than or equal to the rounding value causes problems.
Minor note on CleanShapes, I have to do this to get a border-only ellipse:
CleanEllipse(focused_node.x, focused_node.y, 120, 80)
.Blend(c_black, 0)
.Border(5, focused_color, 1)
.Draw();
If you remove that Blend it just draws a solid ellipse (using the border color), which isn't what I'd expect. Not sure if this is a bug/fixable, just mentioning it
Will be a wrapper for CleanConvex
It would be useful to be able to add a gradient (radial/four corner) on Circles too.
Either/both Beziér curves and splines
The .Thickness(pixels) function makes CleanLine much thinner than requested.
Triangles and convex polygons require that their coordinate be defined in a clockwise fashion. Clean Shapes should support an "autofix" behaviour that solves this problem for the user.
I mentioned this in the pull request, the spline test room was crashing due to it.
Assuming x1, y1, etc. are set, the following code would compile:
CleanSpline([x1, y1, x2, y2, x3, y3, x4, y4, x5, y5], 6) // more segments than colours
.BlendExt([c_white, 1.0, c_yellow, 1.0, c_fuchsia, 1.0, c_aqua, 1.0, c_lime, 1.0])
.Draw();
But this would throw an ungraceful error:
CleanSpline([x1, y1, x2, y2, x3, y3, x4, y4, x5, y5], 5) // same amount or less segments than colours
.BlendExt([c_white, 1.0, c_yellow, 1.0, c_fuchsia, 1.0, c_aqua, 1.0, c_lime, 1.0])
.Draw();
___________________________________________
############################################################################################
ERROR in
action number 1
of Draw Event
for object oTestSpline:
Push :: Execution Error - Variable Index [10] out of range [10] - -15.argument0(91,10)
at gml_Script_anon___CleanClassSpline_gml_GlobalScript_CleanSpline_5301___CleanClassSpline_gml_GlobalScript_CleanSpline (line 201) - var _colour = merge_colour(_inputArray[_int], _inputArray[_int + 2], _frac);
############################################################################################
gml_Script_anon___CleanClassSpline_gml_GlobalScript_CleanSpline_5301___CleanClassSpline_gml_GlobalScript_CleanSpline (line 201)
gml_Object_oTestSpline_Draw_0 (line 1) - CleanSpline([x1, y1, x2, y2, x3, y3, x4, y4, x5, y5], 5)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.