Pseudo-3D Computer Graphics in PHP -


what i'm asking here if have thought can done. sounds feasible, attempts far have been fruitless.

what want create animation of rotating 3d cube using php. after discovering imagefilledpolygon function began think creating pseudo-3d shapes, , new idea revolves around page switching between multiple frames of rotating cube make it's spinning.

below 2 (albeit crude) frames of said cube, doesn't switch between 2 images @ all. loads image under else, session variable hasn't been set yet , stays that.

session_start();  while($toggle=1) { if(isset($_session['switch'])) {     $image = imagecreatetruecolor(2000,1000);     $col_poly = imagecolorallocate($image,0,0,200);     $col_poly2 = imagecolorallocate($image,0,200,0);     imagefilledpolygon($image,array(         125,0,         375,0,         375,250,         125,250,         ),         4 ,         $col_poly);     imagefilledpolygon($image,array(         125,250,         375,250,         375,500,         125,500,         ),         4 ,         $col_poly2);         header('content-type: image/png');         imagepng($image);         imagedestroy($image);      unset($_session['switch']);     sleep(5); } else {     $image = imagecreatetruecolor(2000,1000);     $col_poly = imagecolorallocate($image,0,0,200);     $col_poly2 = imagecolorallocate($image,0,200,0);     $col_poly3 = imagecolorallocate($image,200,0,0);     imagefilledpolygon($image,array(         0,125,         250,0,         500,125,         250,250,         ),         4 ,         $col_poly);     imagefilledpolygon($image,array(         250,250,         0,125,         0,375,         250,500,         ),         4 ,         $col_poly2);     imagefilledpolygon($image,array(         250,250,         500,125,         500,375,         250,500,         ),         4 ,         $col_poly3);      header('content-type: image/png');     imagepng($image);     imagedestroy($image);      $_session['switch'] = 1;     sleep(5); } } 

just clarify, not interested in form of css animation or else can done. i'm curious if method work, that's all.

could tell me how echo out text or button on page alongside image well? have save polygon image png , echo out separately alongside text?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -