Exporters for Roassal.
Execute the following code snippet in a Playground:
Metacello new
baseline: 'RoassalExporters';
repository: 'github://pharo-graphics/RoassalExporters';
load.
Available exporters:
- PNG, with methods:
exportToPNG
,pngExporter
or classRSPNGExporter
- SVG, with methods:
exportToSVG
,svgExporter
or classRSSVGExporter
- PDF, with methods:
exportToPDF
,pdfExporter
or classRSPDFExporter
- Video mp4 or mov, with: methods
exportToVideo
,videoExporter
or classRSVideoExporter
classes := Collection withAllSubclasses.
c := RSCanvas new.
shapes := classes collect: [ :cls |
RSBox new model: cls;
height: (cls numberOfMethods max: 5);
width: (cls instVarNames size * 4 max: 5);
@ RSPopup;
@ RSDraggable ].
c addAll: shapes.
eb := RSEdgeBuilder orthoVertical.
eb withVerticalAttachPoint.
eb canvas: c.
eb connectFrom: #superclass.
RSTreeLayout on: shapes.
c @ RSCanvasController.
(c shapes shapeFromModel: Collection) @ (RSLabeled new text:'Über, genießen').
RSPDFCairoExporter new
canvas: c;
exportToFile: '/tmp/foo.pdf' asFileReference
You can access some of these exporters in the inspector
You can export your animations in a video. Load this baseline to load its dependencies.
Metacello new
baseline: 'RoassalExporters';
repository: 'github://pharo-graphics/RoassalExporters';
load: 'Video'.
Also you will need to install ffmpeg.
In your terminal use
xcode-select --install
or:
brew install ffmpeg
| c b |
c := RSCanvas new.
b := RSBox new
extent: 100@100;
withBorder.
c addShape: b.
c newAnimation
easing: RSEasing bounce;
from: -100@ -100;
to: 100@100;
on: b set: #position:.
c newAnimation
from: Color red;
to: Color blue;
on: b set: #color:.
c newAnimation
from: 0;
to: 10;
on: b border set: 'width:'.
c
when:RSMouseClick
do: [ c animations do: #pause ];
when: RSMouseDoubleClick
do: [ c animations do: #continue ].
c clearBackground: false.
c videoExporter
duration: 2 seconds;
fileName: 'RoassalDemo';
export
"result will be RoassalDemo.mp4"
![](https://user-images.githubusercontent.com/10532890/84852814-c695a680-b02b-11ea-8070-3396c0b8931e.png)
You can export the video with transparency and then use that video to edit another video. Videos with transparency take more disk memory.
"..."
c color: Color transparent.
c videoExporter
duration: 2 seconds;
transparent;
fileName: 'RoassalDemo';
export
"result will be RoassalDemo.mov"
Windows users can not use the video exporter, because it depends on OSSubProcess and that project does not run well in windows, let us know if this is important to you to work on that.
You can export a canvas to an html 3D basic exporter with AFrame https://aframe.io/
Metacello new
baseline: 'RoassalExporters';
repository: 'github://pharo-graphics/RoassalExporters';
load: 'AFrame'.
Then execute the example example12AFrameExport
, you will get: