---
title: "How to animate models in OpenSCAD - Original Prusa 3D Printers"
description: "According to a proverb, a picture says more than a thousand words. And when it comes to moving picture, they often say more than a whole book. That’s why…"
url: "https://blog.prusa3d.com/how-to-animate-models-in-openscad_29523/"
lang: "en"
---

# How to animate models in OpenSCAD

[Michal Altair Valasek](https://blog.prusa3d.com/author/michalvalasek/) January 25, 2019 · 6 min read

[Guides](https://blog.prusa3d.com/category/guides_168/)

According to a proverb, a picture says more than a thousand words. And when it comes to moving picture, they often say **more than a whole book.** That’s why we’ll take a look at how to take a model programmed in OpenSCAD and **animate it.** This is especially useful when you want to **show the model to someone who doesn’t have this application** and can’t check out the model in full 3D. So instead of sending a couple of screenshots, we can actually prepare a short animation of the model being rotated around selected axes – and actually even more.

**These are the basic steps:**

1.  Start with creating a model in OpenSCAD
2.  We will use the application’s features to make the object rotate automatically
3.  Then we’ll use OpenSCAD to export individual frames of animation
4.  Using a web service called [ezgif.com](https://ezgif.com/), we’ll turn the frames into an animated gif or a video

### Creating and preparing the model for animation

The following steps can be used **for any model.** For the purpose of this tutorial, I have used a **simple model of a house** that you can download from my [GitHub](https://gist.github.com/ridercz/6a1c8ef5fbcf1527f5ad51b9f501cffa). A complete model is created after calling the *house()* module and this is how it looks:

If we want to create an animation that **rotates the object around the Z-axis,** it’s a good practice to place the model in the **center of the Z-axis.** It’s not mandatory, because it’s possible to change the origin point for the rotation, but this way it’s much easier. We will modify the code to place the model in the center of the coordinate system:

offset = \[-base\_width / 2 - grass\_offset, -base\_depth / 2 - grass\_offset\];

translate(offset) house();

This is the result:

Now take a look at the **status bar** at the bottom of the OpenSCAD window. In our case, it says:

Viewport: translate = \[4.10 2.57 15.25\], rotate = \[64.80 0.00 23.60\], distance = 172.84

These three parameters will change depending on the camera movement, zooming or rotation. These values can be modified in the OpenSCAD model code as a special **$vpr** (viewport rotation), **$vpt** (viewport translate) and **$vpd** (viewport distance) **variables.**

Add these three variables into your code and **modify the values** so the viewport looks good on your screen (it will depend on the window size or LCD screen resolution). For example:

$vpt = \[4, 3, 15\];

$vpr = \[60, 0, 35\];

$vpd = 180;

offset = \[-base\_width / 2 - grass\_offset, -base\_depth / 2 - grass\_offset\];

translate(offset) house();

Once you render the viewport, the virtual camera will be positioned into the coded position. You can move the camera/view as much as you want, but **once you press F5, it will return to the configured (coded) position.**

Now try to **change the last value of the $vpr vector** – its value is 30 in the sample code above. It’s the degree of the Z-axis rotation and it can be set in the 0-360 range.

### Animations in OpenSCAD

In the OpenSCAD menu, choose *View > Animate*. A new panel will appear above the tool panel in the lower section of the window – there are text fields named *Time, FPS* and *Steps.* *Time* does not concern us – it just shows time during the animation. The *FPS* field determines the **Frames Per Second,** which defines the speed of the animation in the preview. The *Steps* field determines the **number of animation steps.**

Animations in OpenSCAD are based on a **mechanism that refreshes the viewport every second** – the count of refreshes is set in the *FPS* field, and the value of the special **$t** variable increases from 0 to 1 in steps determined by ‘1 divided by the number in the *Steps* field’.

Modify the **$vpr** vector, so the last element (the value of rotation in the Z-axis) steadily increases from 0 to 360 after being multiplied by the **$t** coefficient:

$vpt = \[4, 3, 15\];

$vpr = \[60, 0, 360 \* $t\];

$vpd = 180;

 

offset = \[-base\_width / 2 - grass\_offset, -base\_depth / 2 - grass\_offset\];

translate(offset) house();

Then enter ’30’ into the *FPS* field and ‘360’ into the *Steps* field. This will result in the model rotation in **one-degree steps at the speed of 30 frames per second.** One complete rotation will take **12 seconds** (360/30).

### Export into GIF or video formats

If you followed the tutorial precisely, you should now see t**he rotation in the OpenSCAD window.** However, our goal is to show the 3D rotation to someone, who doesn’t have OpenSCAD – and the best way would be **an animated gif or a video.** If you have the necessary software (like [Gifcam](http://blog.bahraniapps.com/gifcam/)), you can actually just record the desktop (or a part of it) and be done relatively quickly.

However, if you don’t have such a program, you can **export individual frames of animation.** Just tick the *Dump Pictures* option next to the text fields. The rotation will slow down because OpenSCAD will start saving individual images on the hard drive. Wait until one full rotation finishes, then the *Dump Pictures* will automatically un-tick itself. In the folder, where the .scad file is saved, a bunch of new image files will be created – **frame00000.png to frame00359.png.** These are the basis for our animation.

There are various ways how to create an animated gif or a video from a bunch of images. My favorite service is [ezgif.com](http://ezgif.com/), because it’s **simple, free and doesn’t need any software installed** – everything runs in a web browser.

Upload the PNG files at [https://ezgif.com/maker](https://ezgif.com/maker). If you want to make this process a bit easier, you can **zip the PNG files first** and then upload them as a **single ZIP archive.** Once the files are selected, click the *‘Upload and make a GIF!’* button.

You will be taken to a new page, where you can change the **sequence of the frames and the animation speed.** The speed is determined as a delay between frames in milliseconds. If you want to keep the 30 fps speed, go to *‘GIF options’* and enter *‘3’* in the *Delay time* field. You can also change another parameter in this section: tick *‘use global colormap’*, because in the case of OpenSCAD animation it may lead to smaller file size. Then click the *‘Make a GIF!’* button and wait. In a few seconds, an animated GIF should show up directly under the button.

The EZGIF service also offers **various editing tools** that allow you to modify the gif – cut it, speed it up, optimize it etc. The result will be always displayed under the current picture (which shows the original look).

You can also **turn the frames into a video,** instead of an animated gif – the advantage here is the file size. The **video will be usually smaller** than the GIF. To create a video from a GIF using EZGIF, click the blue *‘Convert’* button and then select *‘to Video’*. This will enable you to **download the animation as an MP4 (H.264) video.**

The option to animate a 3D model is great when you want to **display the model in a video or share a complete 360-degree preview** on social networks. The steps described in this tutorial are easy and quick to implement – and without the need to install any other software.

These basic functions can be used for **more advanced animations,** not just a simple rotation. The **$t variable** can be used in any time of situation, so instead of rotating the camera, you can apply it to the model itself as well.

## Related articles

### [Blender for 3D Printing: The 5-Minute Guide to STL Editing](https://blog.prusa3d.com/blender-for-3d-printing-the-5-minute-guide-to-direct-mesh-editing_138255/)

**Kryštof Kohout** October 20, 2026

### [Print colorful and glowing Halloween decorations with our spooky offer](https://blog.prusa3d.com/get-ready-for-halloween-with-our-spooky-filament-offer_138639/)

**Prusa Research** October 6, 2026

### [Open Community License v1.1: The New Plugin System, More Examples, and Your Questions Answered](https://blog.prusa3d.com/open-community-license-v1-1-the-new-plugin-system-more-examples-and-your-questions-answered_137202/)

**Prusa Research** June 24, 2026

## Useful links

-   [Prusa Knowledge Base](https://help.prusa3d.com/)
-   [RepRap Calculators](https://blog.prusa3d.com/calculator_3416/)
-   [3D Printing Price Calculator](https://blog.prusa3d.com/3d-printing-price-calculator_38905/)
-   [Filament Material Guide](https://help.prusa3d.com/filament-material-guide)
-   [Color Print](https://blog.prusa3d.com/color-print_3993/)
-   [About Original Prusa i3](https://blog.prusa3d.com/prusa-i3_3543/)
-   [Prusa CORE One+ 3D Printer](https://www.prusa3d.com/product/prusa-core-one/)
-   [Original Prusa XL – Toolchanger 3D Printer](https://www.prusa3d.com/en/product/original-prusa-xl-assembled-5-toolhead-3d-printer/)
-   [Prusament](https://www.prusa3d.com/category/prusament/)

## Categories

-   [Announcements](https://blog.prusa3d.com/category/highlights_10/)
-   [Featured](https://blog.prusa3d.com/category/featured_8/)
-   [Guides](https://blog.prusa3d.com/category/guides_168/)
-   [Contests](https://blog.prusa3d.com/category/contests_596/)
-   [Prusa Stories](https://blog.prusa3d.com/category/prusa-stories/)
-   [Testimonials](https://blog.prusa3d.com/category/testimonials_590/)
-   [Printing tips](https://blog.prusa3d.com/category/printing-tips_591/)
-   [Dev Diaries](https://blog.prusa3d.com/category/dev-diaries_594/)
-   [Video](https://blog.prusa3d.com/category/video_166/)
-   [Interviews](https://blog.prusa3d.com/category/interviews_167/)
-   [Winners](https://blog.prusa3d.com/category/winners/)

## Most read articles

[Prusa Black Friday 2026 Is Here! Grab the Biggest Deals of the Year October 22, 2026](https://blog.prusa3d.com/prusa-black-friday-2026-is-here-grab-the-biggest-deals-of-the-year_138966/)[PrusaSlicer 3.0 Preview – Built for the Future of 3D Printing September 1, 2026](https://blog.prusa3d.com/prusaslicer-3-0-preview-built-for-the-future-of-3d-printing_137672/)[How Firefighters Use 3D Printing to Save Lives, Time and Money October 30, 2026](https://blog.prusa3d.com/how-firefighters-use-3d-printing-to-save-lives-time-and-money_138620/)[Blender for 3D Printing: The 5-Minute Guide to STL Editing October 20, 2026](https://blog.prusa3d.com/blender-for-3d-printing-the-5-minute-guide-to-direct-mesh-editing_138255/)[Multicolor Printing with a Prusa: Beginner’s Guide February 21, 2025](https://blog.prusa3d.com/multicolor-printing-with-a-prusa-beginners-guide_110590/)
