File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed
external_library/java/video_export Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ load_library :VideoExport
2+ include_package 'com.hamoid'
3+
4+ # Press 'q' to finish saving the movie and exit.
5+
6+ # In some systems, if you close your sketch by pressing ESC,
7+ # by closing the window, or by pressing STOP, the resulting
8+ # movie might be corrupted. If that happens to you, use
9+ # video_export.end_movie like you see in this example.
10+
11+ # In some systems pressing ESC produces correct movies
12+ # and .end_movie is not necessary.
13+ attr_reader :video_export
14+
15+ def settings
16+ size ( 600 , 600 )
17+ end
18+
19+ def setup
20+ sketch_title 'Basic Example'
21+ @video_export = VideoExport . new ( self )
22+ video_export . start_movie
23+ end
24+
25+ def draw
26+ background ( color ( '#224488' ) )
27+ rect ( frame_count * frame_count % width , 0 , 40 , height )
28+ video_export . save_frame
29+ end
30+
31+ def key_pressed
32+ return unless ( key == 'q' )
33+ video_export . end_movie
34+ exit
35+ end
Original file line number Diff line number Diff line change 1+ load_library :VideoExport
2+ include_package 'com.hamoid'
3+
4+ VideoExport
5+ attr_reader :pg , :video_export
6+
7+ def settings
8+ size ( 600 , 600 )
9+ end
10+
11+ def setup
12+ sketch_title 'Create Graphics'
13+ @pg = createGraphics ( 640 , 480 )
14+ @video_export = VideoExport . new ( self , data_path ( 'pgraphics.mp4' ) , pg )
15+ video_export . start_movie
16+ end
17+
18+ def draw
19+ background ( 0 )
20+ text ( format ( 'exporting video %d' , frame_count ) , 50 , 50 )
21+ pg . begin_draw
22+ pg . background ( color ( '#224488' ) )
23+ pg . rect ( pg . width * noise ( frame_count * 0.01 ) , 0 , 40 , pg . height )
24+ pg . end_draw
25+ video_export . save_frame
26+ end
27+
28+ def key_pressed
29+ return unless ( key == 'q' )
30+ video_export . end_movie
31+ exit
32+ end
You can’t perform that action at this time.
0 commit comments