Sample: Transformations.vbs - object transformations. Scale, move, skew, color transformations
Submitted by eLenka on 20 April, 2011 - 14:30
The source below demonstrates supported transformation types in SWF Scout library including scaling, moving, skewing, changing color.
VB Source Code:
' Transformations.vbs W = 640 H = 480 Set Movie = CreateObject("SWFScout.FlashMovie") Movie.InitLibrary "demo","demo" ' Movie creating and setting parameters Movie.BeginMovie 0,0,W,H,1,12,6 Movie.Compressed = true Movie.SetBackgroundColor 255,255,255 Font = Movie.AddFont( "Arial",12,true,false,false,false,0) FontBig = Movie.AddFont("Arial",40,true,false,false,false,0) '----------------------------- ' TRANSFORMATIONS '----------------------------- Text = Movie.AddText2 ("Transformations",0,0,0,255,FontBig, W / 2 - 70, H / 2,2) Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text Movie.PLACE_FadeOut 0.5 ' fade out text Movie.ShowFrame 10 Movie.PLACE_FadeIn 0.5 ' fade in ' scale Text = Movie.AddText ("Scaling",0,0,0,255,Font, 0, 10, 150, 160) Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text Movie.PLACE_FadeOut 0.5 ' fade out text Shape = Movie.AddShape Movie.SHAPE_Circle 25,55,30 Movie.SHAPE_BeginRadialGradient Movie.SHAPE_AddRadialGradientColor 255,255,255,255 Movie.SHAPE_AddRadialGradientColor 5,5,255,255 Movie.SHAPE_EndRadialGradient 35,35 j=Movie.CurrentMaxDepth TransX = 25 TransY = 55 for i=0 to 10 Movie.PlaceShape Shape,j Movie.PLACE_SetTranslate TransX, TransY Movie.PLACE_SetScale 1+i / 10, 1+i/20 IF (i>0) and (i<10) then Movie.PLACE_AutoRemoveDepth = true else Movie.ShowFrame 5 END IF Movie.ShowFrame 1 NEXT ' moving Text = Movie.AddText ("Moving",0,0,0,255,Font, 160, 10, 310, 165) Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text Movie.PLACE_FadeOut 0.5 ' fade out text Shape = Movie.AddShape Movie.SHAPE_Circle 105, 100, 30 Movie.SHAPE_BeginRadialGradient Movie.SHAPE_AddRadialGradientColor 255,255,255,255 Movie.SHAPE_AddRadialGradientColor 5,255,5,255 Movie.SHAPE_EndRadialGradient 35,35 j=Movie.CurrentMaxDepth TransX = 105 TransY = 100 for i=0 to 10 Movie.PlaceShape Shape,j TransX = TransX TransY = TransY - i*2 Movie.PLACE_SetTranslate TransX,TransY if i>0 then Movie.PLACE_AutoRemoveDepth = true else Movie.ShowFrame 5 END IF Movie.ShowFrame 1 NEXT Movie.ShowFrame 2 for i=0 to 10 Movie.PlaceShape Shape,j TransX = TransX TransY = TransY + i*2 Movie.PLACE_SetTranslate TransX,TransY if i>0 then Movie.PLACE_AutoRemoveDepth = true else Movie.ShowFrame 5 END IF Movie.ShowFrame 1 NEXT Movie.ShowFrame 5 ' scew Text = Movie.AddText ("Scewing",0,0,0,255,Font, 310, 10, 430, 160) Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text Movie.PLACE_FadeOut 0.5 ' fade out text Shape = Movie.AddShape Movie.SHAPE_Circle 355,75,40 Movie.SHAPE_beginRadialGradient Movie.SHAPE_AddRadialGradientColor 255,255,255,255 Movie.SHAPE_AddRadialGradientColor 250,5,5,255 Movie.SHAPE_EndRadialGradient 35,35 j=Movie.CurrentMaxDepth for i=0 to 10 Movie.PlaceShape Shape,j Movie.PLACE_SetSkew i/30,i/20 if (i>0) and (i<10) then Movie.PLACE_AutoRemoveDepth = true else Movie.ShowFrame 10 END IF Movie.ShowFrame 1 NEXT ' color transformation Text = Movie.AddText ("Color Transformation",0,0,0,255,Font, 430, 10, 640, 160) Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text Movie.PLACE_FadeOut 0.5 ' fade out text Shape = Movie.AddShape Movie.SHAPE_Circle 515,115,60 Movie.SHAPE_BeginRadialGradient Movie.SHAPE_AddRadialGradientColor 255,255,255,255 Movie.SHAPE_AddRadialGradientColor 255,90,90,110 Movie.SHAPE_EndRadialGradient 35,35 j=Movie.CurrentMaxDepth ' color transform by adding of color values for i=0 to 20 Movie.PlaceShape Shape,j ' 0 - add color, 1 - mult color Movie.PLACE_TransformColor 0, Round (i / 10 * 255), Round (i / 40 * 255), -Round (i / 40 * 255), TRUE, 0 if i>0 then Movie.PLACE_AutoRemoveDepth = true else Movie.ShowFrame 5 END IF Movie.ShowFrame 1 NEXT ' color transform by decreasing of color values for i=0 to 30 Movie.PlaceShape Shape,j ' 0 - add color, 1 - mult color Movie.PLACE_TransformColor 0, -Round (i / 10 * 255), -Round (i / 40 * 255), Round (i / 40 * 255),TRUE, 0 Movie.PLACE_AutoRemoveDepth = true Movie.ShowFrame 1 NEXT ' place solid rectangle to make fadout on whole screen Shape = Movie.AddShape Movie.SHAPE_Rectangle 0, 0, W, H Movie.SHAPE_SetSolidColor 255,255,255,true,255 Movie.PlaceShape Shape,Movie.CurrentMaxDepth Movie.PLACE_FadeOut 1 Movie.EndMovie Movie.SaveToFile "Transformations.swf"