{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Animations In VCS\n", "\n", "This Notebook demonstrates how to create animations in VCS\n", "\n", "Animations are rendered via FFMPEG\n", "\n", "- [Download the Jupyter notebook](Animations.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Content\n", "\n", "- [Preparing The Notebook](#prepare)\n", "- [Example 1: Simple 2D Animation](#example1)\n", " - [preparing 1d data](#2d_data)\n", " - [creating the frames/pngs](#2d_creating)\n", " - [create the animation](#2d_anim)\n", "- [Example 2: 1D line moving behind a \"target\" 1D data](#example2)\n", " - [preparing 1d data](#1d_data)\n", " - [preparing vcs objects](#1d_vcs_objects)\n", " - [creating the frames/pngs](#1d_creating)\n", " - [create the animation](#1d_anim)\n", " - [slowing down the animation](#1d_slow)\n", " - [speeding up the animation](#1d_fast)\n", "- [Example 3: Rotating Earth](#example3)\n", " - [preparing data](#rot_data)\n", " - [preparing vcs objects](#rot_vcs_objects)\n", " - [creating the frames/pngs](#rot_creating)\n", " - [create the animation](#rot_anim)\n", " - [controlling the animation order](#rot_order)\n", " - [bringing it all together, animating the data as well](#rot_all)\n", " \n", "[Back to top](#top)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Preparing The Notebook\n", "[Back to top](#top)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "VCS 2.12 does not produce animation directly visible in the notebook\n", "The class bellow helps with this\n", "Nightly versions of vcs do produce animations objects that are adequate for notebooks" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "class FFMPEG(object):\n", " def __init__(self,source,width=320,height=240,controls=True):\n", " self.source = source\n", " self.width = width\n", " self.height = height\n", " self.controls=controls\n", " def _repr_html_(self):\n", " html = \"