web demo : focus areas
mastef opened this issue · 4 comments
This is a more complex issue so not sure how feasible - however sometimes I want to keep a background that has less shapes, and focus the new shapes on a certain area in the foreground. It would be nice to be able to select an area that the shapes would be generated in for the next steps.
This is also nice when you create the initial image with e.g. triangles, and then in later steps switch strategies to e.g. ellipses/circles and so on
This is something I have in mind for the C++/Qt desktop application where I started tinkering with ChaiScript scripts.
It would come down to defining custom logic for spawning/mutating the shapes - in this case to keep shapes confined within other masked areas/shapes.
I'd approach this by making the relevant shape spawning/mutation functions rebindable, and then injecting my own scripts. Then some sort of drawing tool to define focus areas in the GUI would be a layer on top of that.
A simple rectangle could be easy enough, right? So the randomly spawned shapes would have to be within the x,y,width,height boundaries
Yes - a constraint that only allowed the shapes to spawn and then mutate/move within an area would be simple enough.
It'd be a matter of changing the constructors and mutate() methods of the shape classes to have those constraints e.g in here: https://github.com/Tw1ddle/geometrize-haxe/blob/master/geometrize/shape/Ellipse.hx
I've implemented this in my C++ desktop app that I'll release a new build of very soon (https://github.com/Tw1ddle/geometrize) - thanks for the suggestion. I'm not planning to implement it again in Haxe though, so I'm closing this