3D Animation Demo

3D Animation Demo

Source: 3d_animation_demo.f90

Animate a rotating 3D Lissajous curve. The same FuncAnimation plus save_animation pipeline writes both MP4 (raster backend rendered through ffmpeg) and a .txt ASCII frame stream replayable with fortplot_play_ascii.

fpm run --example --target 3d_animation_demo
fpm run --target fortplot_play_ascii -- output/example/fortran/3d_animation_demo/animation.txt --fps 24 --loop

Files

  • 3d_animation_demo.f90 - Source code
  • Generated media in output/example/fortran/3d_animation_demo/

Running

make example ARGS="3d_animation_demo"

Output

Animation

ASCII output:


=== Frame 1 ===

                             Rotating 3D Lissajous
+--------------------------------------------------------------------------------+
| -1.0                                                                           |
|                                                                                |
|                                                                                |
|                                          #                                     |
|                                     #                                          |
|                                #            #                                  |
|                                          #--                                   |
|                            #            ---    #                               |
|                                        --#-                                    |
|                            # #-----   -  -                                     |
|                               --   ------        #                             |
|                                -#- --  --#-- #   .   .                         |
|                            #     ---  --#  ---   #                             |
|                                   - ---      --              0.2               |
|                                  - # --- #    -- .   .                         |
|                            #    -    - --      - #                             |
|                                -   #-    #      -.   .                         |
|                                -    -    --    -                               |
|                            #  -     #     --   - #                             |
|                               -#   #       -# -  .   .                         |
|                            #  -    --     ----                                 |
|                            .  -     -     ---  # #                             |
|                              . -   #-------      .   .                         |
|                            . #  -------          #                             |
|                              . .   #         .  .                              |
|                            .    #         .  #  .                              |
|                              . .       .#    .                                 |
|                                .. .#.     .     .                              |
|                                 . . .  .  .  .                                 |
|                                                                                |
+--------------------------------------------------------------------------------+
                                       X
Y
=== Frame 2 ===

                             Rotating 3D Lissajous
+--------------------------------------------------------------------------------+
| -1.0                                                                           |
|                                                                                |
|                                                                                |
|                                         #                                      |
|                                    #                                           |
|                                            #                                   |
|                                #        #--                                    |
|                           #            -- -   #                                |
|                                       --#--                                    |
|                                      --  -        #                            |
|                           #   #-----------        .  .                         |
|                               ---  -    #--- #                                 |
|                                 -#-    - # ---    #          0.2               |
|                           #      ----  -      --  .  .                         |
|                                  -  #-- #      -                               |
|                           #     -     --       -- #                            |
|                                -    #-  #-      - .  .                         |
|                                -     -   -     -- #                            |
|                           #   -    # -    -#  --                               |
... (truncated)

Download ASCII

Download Video