home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Visual Anim v2.00 Marko Seppänen marko.seppanen@wwnet.fi */ call addlib('rexxmathlib.library',0,-30,0) address IMAGEENGINEER Options results signal on error /* Setup a place for errors to go */ if arg()=0 then exit pic=arg(1) MARK pic PRIMARY PROJECT_INFO pic WIDTH width=result PROJECT_INFO pic HEIGHT height=result 'PALETTE_SAVE' pic 'ram:tempfileforiepalette' /* . THE BEGINNING . */ if exists("ie:prefs/visualengineer.cfg") == "1" then do call open("temp","ie:prefs/visualengineer.cfg","R") values=readln("temp") parse var values ok visual bg savedir space call close("temp") end else do visual=0 bg=1 savedir="ram:" space=25 end 'FORM "Visual-Engineer" "Use|Cancel"', ' CYCLE,"Visual","Bulge|Ripple|Twirl",'visual'', ' RADIO,"BG-color","Black|White",'bg'', ' DIR,"SaveDir",'savedir'', ' INTEGER,"Space around",0,100,'space',SLIDER' values=result parse var values ok visual bg savedir space savedir=strip(savedir,B,'"') if ok = 0 then exit call open("temp","ie:prefs/visualengineer.cfg","W") res=writeln("temp",values) call close("temp") /* . BACKGROUND COLOR . */ if bg == 1 then do if exists("ie:alpha/purewhite.alpha") == "1" then do OPEN "ie:alpha/purewhite.alpha" COLOUR colortexture=result RESIZE colortexture width+space*2 height+space*2 TILE colortexture2=result MARK colortexture2 SECONDARY CLOSE colortexture COMPOSITE space space MIN pic2=result end else do 'REQUEST "Please copy purewhite.alpha to dir IE:Alpha/" "Ups, sorry!"' exit end end else do if exists("ie:alpha/pureblack.alpha") == "1" then do OPEN "ie:alpha/pureblack.alpha" COLOUR colortexture=result RESIZE colortexture width+space*2 height+space*2 TILE colortexture2=result MARK colortexture2 SECONDARY CLOSE colortexture COMPOSITE space space MAX pic2=result end else do 'REQUEST "Please copy pureblack.alpha to dir IE:Alpha/" "Ups, sorry!"' exit end end CLOSE colortexture2 /* ..HOW MANY FRAMES?.. */ 'REQUEST "How many frames?" "8|12|18|24|Cancel"' select when result=1 then framecount=8 when result=2 then framecount=12 when result=3 then framecount=18 when result=4 then framecount=24 otherwise exit end /* ----------------HERE IT STARTS----------------*/ select /*..VISUAL BULGE..*/ when visual == 0 then do if exists("ie:prefs/visualbulge.cfg") == "1" then do call open("temp","ie:prefs/visualbulge.cfg","R") values=readln("temp") parse var values ok type origamount radius call close("temp") end else do type=0 origamount=25 radius=trunc(width/4) end 'FORM "Visual Bulge settings" "Use|Cancel"', ' CYCLE,"Type","Boom|Rubber|In|Out",'type'', ' INTEGER,"Bulge",1,100,'origamount',SLIDER', ' INTEGER,"Radius",0,'width','radius',SLIDER' values=result parse var values ok type origamount radius if ok = 0 then do close pic2 exit end call open("temp","ie:prefs/visualbulge.cfg","W") res=writeln("temp",values) call close("temp") x=width/2+space y=height/2+space over=0 origamount="-"origamount radius=0 radiusmax=(max(width,height))/2 rad=radiusmax/framecount*2 am=abs(origamount)/framecount*4 amount=origamount-am do counter=1 to framecount sini=sin((360/framecount*counter-1)*(3.14/180)) cosi=cos((360/framecount*counter-1)*(3.14/180)) select when type == 0 then do if over ~== "1" then do radius=radius+rad end else do radius=radius-rad end if radius>radiusmax then over=1 BULGE pic2 x y radius abs(amount) BEST end when type == 1 then do if over ~== "1" then do amount=amount+am end else do amount=amount-am end if amount>abs(origamount)-1 then over=1 BULGE pic2 x y radiusmax amount BEST end when type == 2 then do BULGE pic2 cosi*(width/4)+(width/2+space) sini*(height/4)+(height/2+space) radiusmax amount BEST end when type == 3 then do BULGE pic2 cosi*(width/4)+(width/2+space) sini*(height/4)+(height/2+space) radiusmax abs(amount) BEST end otherwise exit end x1=result visual="bulge" call save() end end /*..VISUAL RIPPLE..*/ when visual == 1 then do if exists("ie:prefs/visualripple.cfg") == "1" then do call open("temp","ie:prefs/visualripple.cfg","R") values=readln("temp") parse var values ok type amp period call close("temp") end else do type=0 amp=5 period=trunc(width/2) end 'FORM "Visual Ripple settings" "Use|Cancel"', ' CYCLE,"Type","Simple|SimpleC|Boom|BoomC|Ripple|Swirl",'type'', ' INTEGER,"Amplitude",1,359,'amp',SLIDER', ' INTEGER,"Period",0,'width','period',SLIDER' values=result parse var values ok type amp period ampadd=trunc((amp/framecount)*2) if ok = 0 then do close pic2 exit end call open("temp","ie:prefs/visualripple.cfg","W") res=writeln("temp",values) call close("temp") do counter=1 to framecount select when type == 0 then do RIPPLE pic2 width/2+space-5 0 amp period 360/framecount*counter-1 OUT BEST end when type == 1 then do RIPPLE pic2 0 0 amp period 360/framecount*counter-1 OUT BEST end when type == 2 then do if counter<(framecount/2)+2 then amp=amp+ampadd else amp=amp-ampadd RIPPLE pic2 width/2+20 0 amp period 360/framecount*counter-1 OUT BEST end when type == 3 then do if counter<framecount/2+2 then amp=amp+ampadd else amp=amp-ampadd RIPPLE pic2 0 0 amp period 360/framecount*counter-1 OUT BEST end when type == 4 then do if counter<framecount/2+2 then amp=amp+ampadd else amp=amp-ampadd RIPPLE pic2 width/2+20 0 amp period 360/framecount*counter-1 AROUND BEST end when type == 5 then do RIPPLE pic2 width/2+20 height/2+space amp period 360/framecount*counter-1 AROUND BEST end otherwise exit end x1=result visual="ripple" call save() end end /*..VISUAL TWIRL..*/ when visual == 2 then do if exists("ie:prefs/visualtwirl.cfg") == "1" then do call open("temp","ie:prefs/visualtwirl.cfg","R") values=readln("temp") parse var values ok type radius origdegree call close("temp") end else do type=0 radius=trunc(width/2) origdegree=20 end 'FORM "Visual Twirl settings" "Use|Cancel"', ' CYCLE,"Type","Swing|Swing2|ShakeIt|ShakeIt2",'type'', ' INTEGER,"Radius",1,'width','radius',SLIDER', ' INTEGER,"Degree",1,'359','origdegree',SLIDER' values=result parse var values ok type radius origdegree if ok = 0 then do close pic2 exit end call open("temp","ie:prefs/visualtwirl.cfg","W") res=writeln("temp",values) call close("temp") x=width/2+space y=height/2+space origdegree="-"origdegree radius=(max(width,height))/2 radiusmin=(min(width,height))/2 radius2=0 radiusmax=trunc(sqr(width**2+height**2)) rad=radiusmax/framecount deg=abs(4*origdegree)/(framecount) degree=origdegree-deg deg2=abs(2*origdegree)/(framecount) degree2=0 do counter=1 to framecount sini=sin((360/framecount*counter-1)*(3.14/180)) cosi=cos((360/framecount*counter-1)*(3.14/180)) select when type == 0 then do if over ~== "1" then do degree=degree+deg end else do degree=degree-deg end if degree>abs(origdegree)-deg then over=1 TWIRL pic2 x y radius+50 degree BEST end when type == 1 then do if over ~== "1" then do degree2=degree2+deg2 end else do degree2=degree2-deg2 end if degree2>abs(origdegree)-deg2 then over=1 radius2=radius2+rad TWIRL pic2 space space radius2 degree2 BEST end when type == 2 then do TWIRL pic2 cosi*(width/4)+(width/2+space) sini*(height/4)+(height/2+space) radius abs(origdegree) BEST end when type == 3 then do TWIRL pic2 cosi*(width/4)+(width/2+space) sini*(height/4)+(height/2+space) radiusmin abs(origdegree) BEST end otherwise exit end x1=result visual="twirl" call save() end end /* THE END */ otherwise exit end CLOSE pic2 exit /* ..SAVING.. */ save: 'PALETTE_LOAD' x1 'ram:tempfileforiepalette' 'RENDER_SET' x1 "0 167940 8 255 0 1" RENDER x1 if counter <10 then counter=insert("0",counter) filename=savedir''visual''"."counter SAVE x1 '"'filename'"' '"'ILBM CmpByteRun1'"' CLOSE x1 return /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do /* Did the user just cancel us? */ IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' exit end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' exit end