ゲーム:動くゲージとか値受け渡し[php]

f:id:tsumayouzi:20141015103712g:plain

(なんでjs,しかもJQueryでやるのかは意味不明ですが)
ゲームとかでよくある自動で動いてタイミング定める系のゲージとstopかかったときにphpで値受け渡すメモ

 

HTML

 <div class="percent">
<div class="progress_base">

<div class="progres_variable" style="width:60%">
<!-- ここ -->
<div class="progress level4" style="width: 100%;">

<!-- ここ -->
<div class="progress-inner s4">
</div>
<!-- ここ -->
</div>
</div>
<div class="gridline"></div>
<div class="level3" id="speed"></div>
</div>

</div>
<p style="text-align:center"><form action="./p1411_anime.php" method="get" id="form1">
<input type="hidden" value="$sed" name="sed"/>
<input type="hidden" value="0" id="speed_value" name="speed"/>
<input type="submit" value="stop" class="stop_btn"/>
</form></p>

 JS

  <script type="text/javascript">
function speed_animate() {
$("#speed").animate({"width": "240px"},
{duration: 1800, easing: "linear", complete: function(){
$("#speed").animate(
{"width": "0px"},
{duration: 1800, easing: "linear",complete: function(){
speed_animate();
}
});
}
}
);
}
speed_animate();

//値取得用(表示もする)
$('#speed').exResize(function(){
var x = $('#speed').width();
var y = x/2.4;
y = Math.floor(y)
document.getElementById('speed_value').value=y;
});

/* タッチの開始時のイベント */
$('#select_wrapper').bind('click', function() {
$('#form1').submit();
});
</script>