Awesome
RoassalExporter
<!-- [![.github/workflows/main.yml](https://github.com/pharo-graphics/RoassalExporters/workflows/CI/badge.svg)](https://github.com/pharo-graphics/RoassalExporters/actions)-->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
Example of usage:
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
<img src="https://user-images.githubusercontent.com/10532890/84853801-ff367f80-b02d-11ea-9040-5de4920e7635.png" width="400"/>Video
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
Example video
| 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"
<a href="https://vimeo.com/429861918" target="_blank" title="Roassal video demo - Click to Watch!">
<img src="https://user-images.githubusercontent.com/10532890/84852814-c695a680-b02b-11ea-8070-3396c0b8931e.png" width="400">
</a>
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.
AFrame 3D
You can export a canvas to an html 3D basic exporter with AFrame <a href="https://aframe.io/" target="_blank">https://aframe.io/</a>
Metacello new
baseline: 'RoassalExporters';
repository: 'github://pharo-graphics/RoassalExporters';
load: 'AFrame'.
Then execute the example example12AFrameExport
, you will get: