Comments (2)
Thanks!
Got it working with the <hsvtorgb.scad>
library
It takes a value between 0.0 and 1.0 and translates it to an RGB value (e.g. [1,0,0] would be red, [0,1,0] would be green)
$openscad_path /dev/null \
-D 'use <hsvtorgb.scad>;' \
-D '$vpr = [60, 0, 360 * $t];' \
-o "${MYTMPDIR}/foo.png" \
-D "color(hsvToRGB(\$t,1,1)) import(\"${MYTMPDIR}/foo-centered.stl\");" \
--imgsize=600,600 \
--animate 60 \
--viewall --autocenter \
--preview \
--quiet
I've created a docker container/script that can do this with any .stl file on my github spuder/CAD-scripts/stl2gif.sh
Thanks again
from gridfinity-rebuilt-openscad.
I don't think I still have the code snippet, it got lost somewhere and I do not know where. But I can remember vaguely how I did it. To sum it up, I used the animation window in the OpenSCAD GUI to program the movement/color, get an image dump, and used Image Magick to compile into a gif. Animating in OpenSCAD can be done with the variable $t
(see the wiki). I think I normalized $t
to be between 0 and 1, so $t
was divided by the number of frames I wanted. There are three steps to this animation:
- Rotation: use the rotate command around the Z axis. Since it only does one rotation, this is simply
360*$t
- Translation: The up and down movement is a sine function of
$t
. So something likesin(360*$t)
inside a translate command. There may have been frequency modifiers. - Color: using the
color([r,g,b,a])
command, all that is needed is some continuous mapping function of$t
to a hue. I don't remember what I used, most likely something copied off Stack Overflow.
After playing the animation and having the dump images box checked, the files were in order in the script directory. With ImageMagick, you can collect all these image files and generate a gif.
from gridfinity-rebuilt-openscad.
Related Issues (20)
- Intended usage as library HOT 5
- Magnet holes don't move with larger size boxes. HOT 2
- Skeletonized baseplate with magnets is broken HOT 2
- Style Lip No Longer Working Correctly HOT 1
- Radii and dimensions are not correct! HOT 5
- Bug: Cura Reports Model is not watertight, and may not print properly. HOT 2
- Bug: FreeCAD Import "Recompute failed!" HOT 1
- Scoops not rendering HOT 1
- [feature request] magnet holes on bin tabs
- Solid Bin with Lip Style 1/2 HOT 7
- Printable labels HOT 1
- gridfinity-spiral-vase.scad: Assertion 'is_num(height_mm)' failed HOT 3
- Countersunk/counterbore for screwing together baseplates HOT 1
- Request option to have th eoption for a grid created above dividers if the line up with base grid for stacking on top of larger bins
- Bottom of bins not rendering HOT 2
- More usable space when magnet holes are disabled.
- Design not accurate after rendering. (Probably fast-csg problem)
- Exported bin height dimensions inaccurate HOT 2
- Can bins `gridz` param support decimals?
- Printing errors and artifacts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gridfinity-rebuilt-openscad.