René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Morphing [Ming wrapper example] | ||
This example demonstrates how a shape can be morphed.
This flash movie was created with the following program. Morphing.cpp
#include <iostream> #include "SWFMovie.h" int main() { Movie movie("Morphing.swf", 600, 100); Morph morph; Shape shape_start = morph.ShapeStart(); Shape shape_end = morph.ShapeEnd (); shape_start.LineStyle(1, 0, 0, 0); shape_end .LineStyle(1, 0, 0, 0); shape_start.FillStyle(255, 0, 0); shape_end .FillStyle( 0, 0, 255); shape_start.MoveTo(-25,-25); shape_start.LineTo( 25,-25); shape_start.LineTo( 25, 25); shape_start.LineTo(-25, 25); shape_start.LineTo(-25,-25); // shape_end.MoveTo(-25,-25); // shape_end.LineTo( 25,-25); // shape_end.LineTo( 25, 25); // shape_end.LineTo(-25, 25); // shape_end.LineTo(-25,-25); shape_end.MoveTo(-45+600,-45+100); shape_end.LineTo( 45+600,-45+100); shape_end.LineTo( 45+600, 45+100); shape_end.LineTo(-45+600, 45+100); shape_end.LineTo(-45+600,-45+100); DisplayItem iMorph = movie.Add(morph); //movie.Add(shape_start); //movie.Add(shape_end ); //int ix=0; //int iy=0; //iMorph.MoveTo(100, 50); for (float ratio=0; ratio<=1; ratio+=0.05) { iMorph.Ratio(ratio); movie.NextFrame(); } movie.NextFrame(); } This is one of a series of examples that demonstrates the C++ ming wrapper classes. Other examples can be found here.
|