hundredrabbits / ronin Goto Github PK
View Code? Open in Web Editor NEWExperimental Graphics Terminal
Home Page: https://hundredrabbits.github.io/Ronin/
License: Other
Experimental Graphics Terminal
Home Page: https://hundredrabbits.github.io/Ronin/
License: Other
RONIN --------------- Ronin is a procedural graphics tool designed to automate simple graphical tasks, like resizing, cropping, coloring, and generating algorithmic images. It interprets a minimal dialect of LISP, look at the examples to better understand how this all works. The library updates is constantly revealing new applications to Ronin, you can see the list of available functions here. Most of our iconography and designs were created with both Ronin and Dotgrid. - Guide: https://100r.co/site/ronin.html - Video Tutorial: https://www.youtube.com/watch?v=SgAWGh1s9zg - Demos: https://twitter.com/neauoire/status/1152481692193419267 - Community: https://hundredrabbits.itch.io/ronin/community Controls ∷ Toggle Menubar Tab ∷ Open Theme ^Shift+O ∷ Reset Theme ^Backspace File New ^N File Save ^S File Export Image ^E File Open ^U View Toggle Guides ^Shift+H View Toggle Commander ^K View Expand Commander ^Shift+K Project Run ^Enter Project Re-Indent ^Shift+I Project Clean Escape Helpers Ronin helpers are keywords that facilitates adding coordinates from the canvas into your script. The currently supported helpers are $rect, $pos, $line, $circle & $arc. Holding right-click while using a $helper will run the script as the mouse is injecting coordinates into the script. Paste the following script, and trace a shape in the canvas: (fill $circle "red") Additional helpers are also available to change parts of a shape, these are as follow: $x, $y, $xy, $wh, $a & $r. Paste the following script, and change the position and radius of a circle: (clear) (fill (circle $xy $r) "red") Extra helpers are available for various transformations, these are as follow: $drag, $view, $poly, $move & $rotate. Paste the following script, and draw the vertices of a line, press escape to stop: (clear) (stroke $poly "red") Import/Export To save an image in memory, open an image file with Ronin, or drag an image file on the window. You will then be able to import it by using the file image's name. If the image file is `preview.png`, you can import it as follow: (import $path (pos 100 100)) (import "preview.jpg" (rect 100 100 400 400)) (export) Library Files - (open name ~scale) Imports a graphic file with format. - (import name ~shape) Imports a graphic file with format. - (export ~format ~quality) Exports a graphic file with format. - (files) Returns the list of loaded files. - (print string) Exports string to file. Shapes - (pos ~x ~y) Returns a position shape. - (line ax ay bx by) Returns a line shape. - (size w h) Returns a size shape. - (rect x y w h) Returns a rect shape. - (circle cx cy r) Returns a circle shape. - (ellipse cx cy rx ry) Returns a ellipse shape. - (arc cx cy r sa ea) Returns an arc shape. - (poly ...pos) Returns a poly shape. - (text x y p t ~a ~f) Returns a text shape. - (svg x y d) Returns a svg shape. Canvas operations - (color r g b ~a) Returns a color object. - (hsl h s l ~a) returns a HSL color object - (resize ~w) Resizes the canvas to target w and h, returns the rect. - (rescale ~w ~h) Rescales the canvas to target ratio of w and h, returns the rect. - (crop ~rect) Crop canvas to rect. - (copy ~rect) Copy a section of the canvas. - (paste copy ~rect) Paste a section of the canvas. - (drag ~rect) Drag a part of the canvas. - (view a b) View a part of the canvas. - (pick ~shape) Returns the color of a pixel at pos, or of the average of the pixels in rect. - (orient ~deg) Orient canvas with angle in degrees. - (mirror) Mirror canvas, methods: x, y. - (transform) The transform toolkit, methods push, pop, reset, move, scale, rotate. - (stroke shape color ~thickness) Strokes a shape. - (fill ~rect) Fills a shape. - (clear ~rect) Clears a rect. - (gradient line ~colors 'black']) Defines a gradient color. - (guide shape color) Draws a shape on the guide layer. Pixel operations - (pixels fn ~q ~rect) - (saturation pixel q) Change the saturation of pixels. - (contrast pixel q) Change the contrast of pixels. - (brightness pixel q) Change the brightness of pixels. - (additive pixel q) Condense the data of pixels. - (multiply pixel q) Change the color balance of pixels. - (normalize pixel q) Normalize the color of pixels with another color. - (lum color) Return the luminance of a color. Strings - (concat ...items) Concat multiple strings. - (split string char) Split string at character. Math - (add ...args) Adds values. - (sub ...args) Subtracts values. - (mul ...args) Multiplies values. - (div ...args) Divides values. - (mod a b) Returns the modulo of a and b. - (rad degrees) Convert radians to degrees. - (deg radians) Convert degrees to radians. - (clamp val min max) Clamps a value between min and max. - (step val step) - (min) Returns lowest value. - (max) Returns highest value. - (ceil) Rounds up to the nearest integer. - (floor) Rounds down to the nearest integer. - (round) Rounds to the nearest integer - (sin) - (cos) - (log) - (pow) - (sqrt) Calculate the square root. - (sq a) Calculate the square. - (PI) - (TWO_PI) - (random ...args) Logic - (gt a b) Returns true if a is greater than b, else false. - (lt a b) Returns true if a is less than b, else false. - (eq a b) Returns true if a is equal to b, else false. - (and ...args) Returns true if all conditions are true. - (or a b ...rest) Returns true if at least one condition is true. - (not a) Negation. Returns true if a is false. Returns false if a is true. - (while fn action) While loop. Execute action for as long as fn is true. Language - (let name value) - (def name value) - (defn fname ~(...fnparams) ...instructions) - (λ (...args) ...instructions) - (if (condition) ...instruction-when-true ~...instruction-when-false) Lists - (each arr fn) Run a function for each element in a list. - (map arr fn) Run a function on each element in a list. - (filter arr fn) Remove from list, when function returns false. - (reduce arr fn acc) - (len item) Returns the length of a list. - (cons arr ...items) Returns a new array with the items appended. - (push arr ...items) Appends the items into the existing list. - (pop arr) Pop the last item from the list and return the item. - (first arr) Returns the first item of a list. - (last arr) Returns the last - (rest [_ ...arr]) Returns all arguments except the first - (range start end ~step) Returns a list of numbers counting from start to end. Step defaults to 1. Objects (maps) - (get item key) Gets an object's parameter with name. - (set item ...args) Sets an object's parameter with name as value. - (of h ...keys) Gets object parameters with names. - (object ...entries) Creates an object with provided entries. - (keys item) Returns a list of the object's keys - (values item) Returns a list of the object's values Convolution filters - (convolve kernel ~rect) Apply convolution filter with given kernel on an area. - (blur) Returns the blur kernel. - (sharpen) Returns the sharpen kernel. - (edge) Returns the edge kernel. Points - (offset a b) Offsets pos a with pos b, returns a. - (distance a b) Get distance between positions. Utilities - (echo ...args) Print arguments to interface. - (debug arg) Print arguments to console. - (time ~rate) Returns timestamp in milliseconds. - (js) Javascript interop. Returns window object. - (on event f) Triggers on event. - (test name a b) Unit test. Checks if a is equal to b, logs results to console. - (benchmark fn) Logs time taken to execute a function. - (get-theme) Returns an object with current theme colors. - (get-frame) Returns a shape object describing the current canvas. Extras - Themes: https://github.com/hundredrabbits/Themes - Support: https://patreon.com/100 - Pull Requests are welcome! Licenses Ronin's source code is licensed under MIT and the images, text and assets are licensed under BY-NC-SA 4.0. View individual licenses for details.
I am super hyped about this app, but I have no idea how to use it.
How do build it. How to run it.
There is no explanation, if there should be, anyways.
How?
found those thqt might indicate a pen pressure api is on the way ! https://mobiforge.com/design-development/html5-pointer-events-api-combining-touch-mouse-and-pen
I have not found anything about license terms for this software. Can I even legally use it?
Please add a license, preferably one of the copyfree licenses so I can be sure I can actually use it everywhere.
Thanks.
The description in the README says this is open source software, but CC-BY-NC-SA is not an open source license. (It is not even recommended for software use by Creative Commons.)
To help further development, it would be beneficial to discuss where we want to go with the language.
Here's a few ideas:
Maybe we could cache it.
I just head about Ronin at https://botbot.me/freenode/opensourcedesign/msg/93706802/ but even after looking at the README and the website I was still confused about what it is exactly. I searched a bit more and found https://www.youtube.com/watch?v=gifzjhyBwOc (Capsule 5: Ronin Tutorial) which seems like a decent introduction. Perhaps you should link to that video (or another) from the README. It seems like an interesting tool.
I got errors when I try to run the ronin-windows-64.zip64 MB with Windows 8.1 NVIDIA 740M
See the error:
https://imgur.com/a/rxH6ooQ
I used windows 8.1 , NVIDIA 740M
Should we go for one of those solution for fast and more complex filters ?
When Ronin is being served by the Python script, typing ?
in the command prompt will show the help screen in the same window.
This fires commander.passive()
, which shows the help screen. Pressing enter
will close the command prompt and clear out the input element (commander.hide()
). As the listen_onkeyup()
function continues, it then fires commander.passive()
again, but this time there is no command in the command line, so there is no key
set on line 50 of commander.js
. commander.passive()
clears out ronin.module
on line 53 of commander.js
and then tries to find a module by the key. Since this doesn't exist any more, it leaves ronin.module
null.
Trying to press escape
after this will do nothing, since ronin.module
no longer routes the escape key to the help module.
I was going to create a PR for this but realized there are lots of ways you could fix it and I wasn't sure the best method. You could lock the command prompt to open, you could prevent ronin.module
being nulled if a ronin.module_lock
var was set, you could try to detect if the help screen was open and then just always have escape hide it if that's the case...
would be nice to have a way to write short lambdas
; minimal
'(echo 1) ; equivalent to (lambda () (echo 1))
; advanced
'(add %1 4) ; equivalent to (lambda (a) (add a 4))
'(add %1 %2 %3) ; equivalent to (lambda (a b c) (add a b c))
Currently, the surface layer is fixed to the #surface canvas. By allowing to target and create temporary layers, we could have access to more blending functions and easy drawing on guide layer
(layer layer1 (fill (rect 10 10 20 20) "red")
(layer layer2 (fill (rect 15 15 20 20) "blue")
(blend (
(normal layer1 1)
(darken layer2 0.5)
))
and to define guide layer drawing
(defn hrule (x color) (layer _guide (stroke (line x 0 x HEIGHT) 1 color))
(hrule 40 "red") ; could use theme color by default?
($hrule)
Some of example commands as shown in help page are very long.
They're cropped because there's no word-wrap, and h-scrollbar is hidden.
; issue
(
(resize 300 300)
(fill
(frame) "yellow"))
/sources/scripts/modules/magnet.js
appears to be broken.
The line ronin.grid.draw (size, ronin.magnet.step)
appears to be broken in two ways. size
is not set and, more importantly, ronin.grid.draw
doesn't exist. From a little digging I'd guess you changed ronin.grid.
to ronin.guide
but there isn't a compatible draw method in guide.
When I run magnet lock: 10
in the commander errors are thrown which lead to this line, but also the cursor disappears and becomes unable to draw. Not sure how those issues are related, but here's the info.
I've currently run out of time, and wanted to drop this bit here, but I'll continue to look into it when I get some more time later. Thanks for the awesome editor.
currently we have ways to get data from objects but no way to create them. These would be useful to set option in other functions.
(def foo {:a 1 :b 2}) ; equivalent to const foo = {a: 1, b: 2} in JS
:a ; should be a new type TYPES.symbol
(:a foo) ; returns 1
(:c foo 4) ; returns default value 4
(:y (rect 1 2 3 4)) ; returns 2
(process {:contrast 0.5 :brightness -0.5})
(rect 5 5 15 15 {:border-radius 4})
When I use vectors with dot-grid the snapping happens at a point somewhere around my cursor seemingly at random, rather than the closest grid point to the cursor hotspot.
Can it be interesting to add that ?
Also full screen seem to not be full window.
I can check
changing the last few lines of the on-animate
example to use OSC:
...
(defn redraw
()
(
(clear)
(times seg-count draw-dash)))
(on "/a" redraw)
and then changing the code and attempting to re-render causes the sine wave to continue to be rendered until Ronin is restarted. Arch Linux, Itch, 'Version 20'
would need a name to comply with "no special char" logic
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.