Changeset 3132 for libcaca/trunk/caca-php/examples/polyline.php
- Timestamp:
- Oct 28, 2008, 8:30:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca-php/examples/polyline.php
r3131 r3132 1 1 #!/usr/bin/php5 2 2 <?php 3 4 function transform($tbl, $tx, $ty, $sx, $sy) { 5 $result = array(); 6 foreach($tbl as $pt) 7 $result[] = array($pt[0] * $sx + $tx, $pt[1] * $sy + $ty); 8 return $result; 9 } 3 10 4 11 $canvas = caca_create_canvas(0, 0); … … 22 29 ); 23 30 24 function transform($tbl, $tx, $ty, $sx, $sy) {25 $result = array();26 foreach($tbl as $pt)27 $result[] = array($pt[0] * $sx + $tx, $pt[1] * $sy + $ty);28 return $result;29 }30 31 31 for ($i = 0; $i < 10; $i++) { 32 32 caca_set_color_ansi($canvas, 1 + (($color += 4) % 15), CACA_TRANSPARENT); 33 33 $scale = caca_rand(4, 10) / 10; 34 $translate = array(caca_rand(- 10, 60), caca_rand(-5, 20));34 $translate = array(caca_rand(-5, 55), caca_rand(-2, 25)); 35 35 $pts = transform($tbl, $translate[0], $translate[1], $scale, $scale); 36 36 caca_draw_thin_polyline($canvas, $pts); … … 40 40 caca_refresh_display($display); 41 41 sleep(5); 42
Note: See TracChangeset
for help on using the changeset viewer.