Notes to Lesson 10
Below is an example of a morph from a square to a diamond shape.
getShape1(); $mySquare->setLine(5,0,0,255); $mySquare->setLeftFill(255,0,0); $mySquare->drawLine(100,0); $mySquare->drawLine(0,100); $mySquare->drawLine(-100,0); $mySquare->drawLine(0,-100); $myTriangle=$myMorph->getShape2(); $myTriangle->setLine(5,255,255,0); $myTriangle->setLeftFill(0,0,255); $myTriangle->movePen(-100,0); $myTriangle->drawLineTo(0,100); $myTriangle->drawLineTo(100,0); $myTriangle->drawLineTo(0,-100); $myTriangle->drawLineTo(-100,0); $myMovie=new SWFMovie(); $myMovie->setDimension(400,300); $myMovie->setBackground(255,255,255); $firstMorph=$myMovie->add($myMorph); $firstMorph->moveTo(100,100); for($i=0; $i<1.05; $i+=0.05){ $firstMorph->setRatio($i); $myMovie->nextFrame(); } for($p=0; $p<10; $p++){ $myMovie->nextFrame(); } $myMovie->save("Note10.swf"); ?>
Result: