SWF (.swf)

As of Version 12.2, the "SWF" format is obsolete. Use other video formats such as "MP4".

Background & Context

    • Registered MIME type: application/x-shockwave-flash
    • Adobe/Macromedia Flash file format.
    • Used for interactive and animated vector graphics, video, and sound on the web.
    • SWF is an acronym derived from Shockwave Flash.
    • SWF files are normally embedded in HTML and played by a browser plugin.
    • Adobe announced an end-of-life for Adobe Flash Player at the end of 2020.

Export

  • Export["file.swf",{expr1,expr2,}] exports a list of arbitrary expressions to SWF.
  • When exporting a list {expr1,expr2,}, the animation is composed from frames corresponding to rasterized images of the expri.
  • The duration of the SWF animation is determined by the number of frames and the specified frame rate.
  • Export["file.swf",Manipulate[]] exports an animated demonstration of a Manipulate object.
  • The exported Flash animation will play at the same speed and will have the same size as the Manipulate object.
  • If bookmarks are set in the Manipulate object, Export will create an SWF file by interpolating between the bookmarks, while preserving the speed and duration of the Manipulate.
  • Export["file.swf",ListAnimate[]] exports a ListAnimate object as a Flash animation.
  • See the following reference pages for full general information:
  • Exportexport to a file
    CloudExportexport to a cloud object
    ExportStringexport to a string
    ExportByteArrayexport to a byte array

Options

  • General options:
  • BackgroundWhitecolor of padded area around the exported animation
    ImageSizeAutomaticpixel dimensions of the animated object
  • If ImageSize is set to Automatic, and the image size cannot be determined from the expression given, the first frame of the exported object will be rasterized and taken as the size of the resulting animation.
  • Video encoding and compression settings:
  • "CompressionMethod"Nonewhether the SWF data should be compressed
    VideoEncoding"ScreenVideo"encoding method used for animation video
  • Allowed settings for "CompressionMethod" are None and "GZ".
  • Method options for VideoEncoding->{"ScreenVideo",opts}:
  • "BlockSize"32block size parameter of the screen video codec
  • "Blocksize"->n or "Blocksize"->{n,m} sets the block size parameter of the Flash interframe compression method. Allowed values for the pixel dimensions are of the form where .
  • Playback controls:
  • "AnimationDuration"Automaticlength of the animation in seconds when exporting a Manipulate object
    "ControlAppearance""Generic"how Manipulate control elements are rendered in the exported file
    "FrameRate"15number of frames shown per second
    "RepeatAnimation"Truewhether the animation loops indefinitely
    "Scalable"Falsewhether the animation scales to fit into the window when played with a browser plugin
  • The following settings can be given for "ControlAppearance":
  • Automaticcaptures user controls exactly as seen in the notebook interface, using the style elements of the local computer system
    "Generic"renders graphical controls in a generic style
    Noneexcludes control elements when exporting an animation
  • An animation exported with the default setting "ControlAppearance"->"Generic" will look the same regardless of the computer system on which it was created.
  • With "ControlAppearance"->None, no user controls are included in the exported animation.
  • Export["file.swf",Manipulate[],"ControlAppearance"->Automatic] exports a Manipulate object to a Flash animation file, rendering user controls in the style of the local notebook interface.
  • Controls elements captured from a Wolfram Language animation cannot be manipulated when playing an animation file.
  • Additional properties and settings:
  • "HTMLFile"Nonename of the file to which an HTML wrapper should be written
    "ThumbnailFile"Nonename of the file to which a small preview image of the first frame should be exported

Examples

open allclose all

Basic Examples  (3)

Export a sequence of images to Flash:

Create a Manipulate to be exported to Flash:

Export it to SWF:

You can export a ListAnimate object to Flash:

Scope  (1)

Create a Flash file whose frames interpolate through the "start", "end", and "back" bookmark settings of a Manipulate: