wodeni / Animate-plus-plus

Animate your vector graphics using C++ :zap:
3 stars 0 forks source link

Animate++

Animate++ is a C++ library that lets you rapidly compose beautiful vector graphics animation.

Dependencies

Getting started

Hello World example

Sample program: outputs a synoptically correct SVG file that yields to the same visual output

#include <iostream>
#include <animate.h>
using namespace anipp;

int main() {
    Rect r(20, 20, 100, 100, 3, 3);
    r.attr({ {"fill", "red"},
        {"stroke", "black"},
        {"stroke-width", "5"}
    });
    Point center(70, 70);
    r.animate.rotate(center, 0, center, 360)
             .duration("10s")
             .loop(true);
    r.save("./output.svg");
}

Exported SVG:

<?xml version="1.0"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
    <rect x="20" y="20" rx="3" ry="3" width="100" height="100" fill="red" stroke="black" stroke-width="5">
        <animateTransform
            attributeName="transform"
            type="rotate"
            dur="10s"
            from="0 70 70"
            repeatCount="indefinite"
            to="360 70 70" />
    </rect>
</svg>

Click to show animation:

Directory structure

├── Makefile
├── README.md
├── docs
│   ├── assets
│   ├── final-report
│   ├── notes
│   ├── progress-report
│   ├── proposal
│   └── talk
├── examples
│   └── rect_rotate.svg
├── include
│   └── pugixml-1.9
├── src
│   ├── animate.hpp
│   ├── parser.cpp
│   ├── parser.hpp
│   ├── shapes.cpp
│   ├── shapes.hpp
│   ├── utils.cpp
│   └── utils.hpp
└── test
├── src
└── svgs

Authors

Wode "Nimo" Ni - wn2155@columbia.edu Xuanyuan Zhang - xz2580@columbia.edu