Jump to content

Adasiax

Members
  • Posts

    7
  • Joined

  • Last visited

Adasiax's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. O my god ;p You mean somethign like this? var url = 'lissajous.php?T1'+'='+'##'+'&T2'+'='+'##'+'&a1'+'='+'##'+'&a2'+'='+'##' ;
  2. Is that function correct? function UpdateImage(){ var T1 = $('#T1Slider').slider('option', 'value'); var T2 = $('#T2Slider').slider('option','value'); var a1 = $('#a1Slider').slider('option','value'); var a2 = $('#a2Slider').slider('option','value'); var url = 'lissajous.php?T1=' + T1 + T2 + a1 + a2; $('#lissajousOutput').attr('src', url); } $('#T1Slider').slider({ change: UpdateImage; });
  3. I have 4 functions which are changing four different parameters. But when i change them one after another every parameter is changing without including 3 left. How can i change that? Here is the code: <script text="text/javascript"> $(function(){ $('#T1Slider').slider({ change: function(){ var T1 = $(this).slider('option','value') $('#lissajousOutput').attr('src', 'lissajous.php?T1='+T1) } }); }); </script> <script text="text/javascript"> $(function(){ $('#T2Slider').slider({ change: function(){ var T2 = $(this).slider('option','value') $('#lissajousOutput').attr('src', 'lissajous.php?T2='+T2) } }); }); </script> <script text="text/javascript"> $(function(){ $('#a1Slider').slider({ change: function(){ var a1 = $(this).slider('option','value') $('#lissajousOutput').attr('src', 'lissajous.php?a1='+a1) } }); }); </script> <script text="text/javascript"> $(function(){ $('#a2Slider').slider({ change: function(){ var a2 = $(this).slider('option','value') $('#lissajousOutput').attr('src', 'lissajous.php?a2='+a2) } }); }); </script> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> </head> <center><img src="lissajous.php" id="lissajousOutput"></center> </br></br> <center>T1<div name="T1" style="width: 800px; " id="T1Slider"></div></center> <br> <center>T2<div name="T2" style="width: 800px; " id="T2Slider"></div></center> <br> <center>a1<div name="a1" style="width: 800px; " id="a1Slider"></div></center> <br> <center>a2<div name="a2" style="width: 800px; " id="a2Slider"></div></center>
  4. How can I automatically save image from php to directory by clicking a button?
  5. I've got something like this but it's not working <html> <body> <head> <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> </head> <script> <?php $(function(){ $('#T1Slider').slider({ change: function(){ var T1 = $(this).slider('option','value') $('#lissajousOutput').attr('src', 'lissajous.php?T1='+T1) } }); }); header ("Content-type: image/png"); ///x = a1 * cos(t/T1); /// y = a2 * sin(t/T2); $Values = $_GET + array( 'T1' => 20 //Default values , 'T2' => 30 //Used if nothing is given ); $T1 = $Values['T1']; $T2 = $Values['T2']; $myImage = @imagecreatetruecolor(640, 480) or die("Cannot Initialize new GD image stream"); $text_color = imagecolorallocate($myImage, 255, 255, 224); $poly_color = imagecolorallocate($myImage, 124, 120, 224); //calculate x-value and y-value point by point $points = array(); for ($i=0; $i<1000; $i=$i+1) { //define curve's function $x = 310*cos($i/$T1); //define x-value $y = 230*sin($i/$T2);//define y-value //move the coordinate, append a point's x-value and y-value $points[] = 320+$x; //x-value $points[] = 240-$y; //y-value } //count points $totalPoints = count($points)/2; //drawing title $title = "Final Plot ($totalPoints points)"; imagestring($myImage, 3, 5, 5, $title, $text_color); /** drawing points one by one, notice if there * are 10 points, we need to draw 9 lines: * 1) point 0 to 1; * 2) point 1 to 2; * ... * ... * 9) point 8 to 9; */ for ($i=0; $i<$totalPoints-1; $i++) { imageLine($myImage, $points[2*$i], $points[1+2*$i], $points[2+2*$i], $points[3+2*$i], $poly_color); } //finalizing imagepng($myImage); imagedestroy($myImage); ?> </script> <img src="lissajous.php" id="lissajousOutput"> <div id="T1Slider"> </div> </body> </html>
  6. Thanks: ) But can you do at least one slider for me? I will see how it works on example and it would be easier for me to do the rest:)
  7. I have a lissajous figure write in PHP but i want to dynamically change a1,a2 T1,T2 value by implementing a slider that when released, posts to the server, updates the values and recreates the image. Can someone help me to do that? Here is a similar example of what I mean http://www.scottlogic.co.uk/blog/colin/2009/06/dependency-property-performance-and-lissajous-figures/ Here is the code: <?php header ("Content-type: image/png"); ///x = a1 * cos(t/T1); /// y = a2 * sin(t/T2); $T1 = 20; $T2 = 30; $myImage = @imagecreatetruecolor(640, 480) or die("Cannot Initialize new GD image stream"); $text_color = imagecolorallocate($myImage, 255, 255, 224); $poly_color = imagecolorallocate($myImage, 124, 120, 224); //calculate x-value and y-value point by point $points = array(); for ($i=0; $i<1000; $i=$i+1) { //define curve's function $x = 310*cos($i/$T1); //define x-value $y = 230*sin($i/$T2);//define y-value //move the coordinate, append a point's x-value and y-value $points[] = 320+$x; //x-value $points[] = 240-$y; //y-value } //count points $totalPoints = count($points)/2; //drawing title $title = "Final Plot ($totalPoints points)"; imagestring($myImage, 3, 5, 5, $title, $text_color); /** drawing points one by one, notice if there * are 10 points, we need to draw 9 lines: * 1) point 0 to 1; * 2) point 1 to 2; * ... * ... * 9) point 8 to 9; */ for ($i=0; $i<$totalPoints-1; $i++) { imageLine($myImage, $points[2*$i], $points[1+2*$i], $points[2+2*$i], $points[3+2*$i], $poly_color); } //finalizing imagepng($myImage); imagedestroy($myImage); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.