Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Shockwave Flash Functions : swf_lookat

swf_lookat

Define a viewing transformation (PHP 4)
void swf_lookat ( float view_x, float view_y, float view_z, float reference_x, float reference_y, float reference_z, float twist )

Defines a viewing transformation by giving the viewing position and the coordinates of a reference point in the scene.

Parameters

view_x

x-coordinate for the viewing position

view_y

y-coordinate for the viewing position

view_z

z-coordinate for the viewing position

reference_x

x-coordinate for the reference point

reference_y

y-coordinate for the reference point

reference_z

z-coordinate for the reference point

twist

Controls the rotation along with viewer's z axis.

Return Values

No value is returned.

Code Examples / Notes » swf_lookat

hotkey

You can really do stunning 3D effects using swf_lookat() [and swf_ortho, of course].
Here is a little example of doing a simple 3D-rotation around a text.
The Text is split up into 2 parts, because Flash does not (yet?) support perspective-skewing, only rotation, 2D-skew and scaling. But if you split your 3D-object up into several parts, each part is transformed seperately and you can trick around that loss of perspective-skew.
Have a lot of fun experimenting with that piece of code!
regards
HotKey ^ http://www.SPR.AT
- - - - - - >8  - cut here - - - - -
<?php
Header("Content-type: application/x-shockwave-flash");
swf_openfile("php://stdout", 320, 200, 25, 1, 1, 1);
swf_ortho (-100, 100, -100, 100, -100, 100);     #create 3D coordinates
swf_definefont (0, "Pix3");
swf_addcolor (0, 0, 0, 1);
swf_fontsize (10);
swf_fonttracking(0.2);
for ($i=0; $i<628; $i+=8) {
 $j = $i / 100;
 swf_pushmatrix ();
 swf_translate(0,0,0);
 swf_perspective(100,1,0,10);
 swf_lookat(sin($j)*60,50,cos($j)*60,  0,00,0,  0);
 swf_definetext (1, "HotKey@", 0);
 swf_translate(-50,0,0);
 swf_placeobject(1,10);
 swf_definetext (2, "hehe.com", 0);
 swf_translate (55,0,0);
 swf_placeobject(2,11);
 
 swf_showframe();
 swf_removeobject (10);
 swf_removeobject (11);
 swf_popmatrix();
}
swf_closefile ();
?>
- - - - - - - -  8< - - - - - - - -
*EOF*


Change Language


Follow Navioo On Twitter
swf_actiongeturl
swf_actiongotoframe
swf_actiongotolabel
swf_actionnextframe
swf_actionplay
swf_actionprevframe
swf_actionsettarget
swf_actionstop
swf_actiontogglequality
swf_actionwaitforframe
swf_addbuttonrecord
swf_addcolor
swf_closefile
swf_definebitmap
swf_definefont
swf_defineline
swf_definepoly
swf_definerect
swf_definetext
swf_endbutton
swf_enddoaction
swf_endshape
swf_endsymbol
swf_fontsize
swf_fontslant
swf_fonttracking
swf_getbitmapinfo
swf_getfontinfo
swf_getframe
swf_labelframe
swf_lookat
swf_modifyobject
swf_mulcolor
swf_nextid
swf_oncondition
swf_openfile
swf_ortho2
swf_ortho
swf_perspective
swf_placeobject
swf_polarview
swf_popmatrix
swf_posround
swf_pushmatrix
swf_removeobject
swf_rotate
swf_scale
swf_setfont
swf_setframe
swf_shapearc
swf_shapecurveto3
swf_shapecurveto
swf_shapefillbitmapclip
swf_shapefillbitmaptile
swf_shapefilloff
swf_shapefillsolid
swf_shapelinesolid
swf_shapelineto
swf_shapemoveto
swf_showframe
swf_startbutton
swf_startdoaction
swf_startshape
swf_startsymbol
swf_textwidth
swf_translate
swf_viewport
eXTReMe Tracker