~ubuntu-branches/ubuntu/hardy/php5/hardy-updates

« back to all changes in this revision

Viewing changes to tests/testswf

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-10-09 03:14:32 UTC
  • Revision ID: james.westby@ubuntu.com-20051009031432-kspik3lobxstafv9
Tags: upstream-5.0.5
ImportĀ upstreamĀ versionĀ 5.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
$LINEID=1;
 
4
$LINEDEPTH=50;
 
5
$LINESTEPS=30;
 
6
 
 
7
$CIRCLEID=2;
 
8
$CIRCLEDEPT=100;
 
9
 
 
10
/* stop playing */
 
11
function stop()
 
12
{
 
13
  swf_startdoaction();
 
14
  swf_actionStop();
 
15
  swf_enddoaction();
 
16
}
 
17
 
 
18
/* play stoping */
 
19
function play()
 
20
{
 
21
  swf_startdoaction();
 
22
  swf_actionPlay();
 
23
  swf_enddoaction();
 
24
}
 
25
 
 
26
/* 
 
27
 *      demonstrates:
 
28
 *               defining and placing an object.
 
29
 *
 
30
 */
 
31
function flipline()
 
32
{
 
33
  global $LINESTEPS, $LINEID, $LINEDEPTH;
 
34
 
 
35
  swf_ortho2(-100.0,100.0,-100.0,100.0);
 
36
  swf_defineline($LINEID,-60.0,0.0,60.0,0.0,1.2);
 
37
  swf_mulcolor(1.0,1.0,1.0,1.0);
 
38
  swf_addcolor(0.0,0.0,0.0,0.0);
 
39
  for($i=0; $i<$LINESTEPS; $i++) {
 
40
          $p = $i/($LINESTEPS-1.0);
 
41
          swf_pushmatrix();
 
42
          swf_rotate(60.0*$p,'z');
 
43
          swf_translate(20.0+20.0*$p,0.0,0.0);
 
44
          swf_rotate(120.0*$p,'z');
 
45
          swf_placeobject($LINEID, $LINEDEPTH);
 
46
          swf_popmatrix();
 
47
          swf_showframe();
 
48
  }
 
49
  for($i=0; $i<$LINESTEPS; $i++) {
 
50
          swf_removeobject($LINEDEPTH);
 
51
          if(($i%4) == 0)
 
52
            swf_showframe();
 
53
  }
 
54
  swf_showframe();
 
55
}
 
56
 
 
57
/* growblobs follows */
 
58
 
 
59
$NBLOBS=8;
 
60
$BLOBSTEPS=20;
 
61
 
 
62
/* 
 
63
 *      demonstrates:
 
64
 *              shape definition
 
65
 *              placing, and modifying objects.         
 
66
 *
 
67
 */
 
68
function growblobs()
 
69
{
 
70
  global $NBLOBS, $BLOBSTEPS, $CIRCLEDEPT, $CIRCLEID;
 
71
 
 
72
  swf_ortho2(-200.0,200.0,-200.0,200.0);
 
73
 
 
74
  swf_startshape($CIRCLEID);
 
75
  swf_shapefillsolid(0.0,0.0,0.0,1.0);
 
76
  swf_shapearc(0.0,0.0,300.0,0.0,360.0);
 
77
  swf_endshape();
 
78
 
 
79
  swf_mulcolor(1.0,1.0,1.0,1.0);
 
80
  $startframe = swf_getframe();
 
81
  for($j=0; $j<$NBLOBS; $j++) {
 
82
          swf_setframe($startframe+2*$j);
 
83
          for($i=0; $i<$BLOBSTEPS; $i++) {
 
84
      $p = $i/($BLOBSTEPS-1.0);
 
85
      swf_pushmatrix();
 
86
      swf_scale($p,$p,$p);
 
87
      swf_addcolor($p,$p,$p,0.0);
 
88
      if($i== 0)
 
89
                  swf_placeobject($CIRCLEID,$CIRCLEDEPTH+$j);
 
90
      else
 
91
                  swf_modifyobject($CIRCLEDEPTH+$j,MOD_COLOR|MOD_MATRIX);
 
92
      swf_popmatrix();
 
93
      swf_showframe();
 
94
          }
 
95
          swf_removeobject($CIRCLEDEPTH+$j);
 
96
  }
 
97
  swf_showframe();
 
98
}
 
99
 
 
100
swf_openfile("test.swf",400.0,400.0,20.0,1.0,1.0,1.0);
 
101
flipline();
 
102
growblobs();
 
103
 
 
104
//    trytext();
 
105
//    makebuttons();
 
106
//    stop();
 
107
swf_showframe();
 
108
swf_closefile();
 
109
 
 
110
//    swf_openfile("images.swf",400.0,400.0,20.0,1.0,1.0,1.0);
 
111
//    showimages();
 
112
//    brushstrokes();
 
113
//    symboltest();
 
114
//    stop();
 
115
//    swf_showframe();
 
116
//    swf_closefile();
 
117
//    fprintf(stderr,"wrote images.swf\n");
 
118
    exit(0);
 
119
 
 
120
?>