| <html> |
| <head> |
| <title>test</title> |
| <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'></script> |
| <script src="soundmanager2.js"></script> |
| |
| <style type="text/css"> |
| .dinamick{ |
| background: url(2.png) no-repeat; |
| width: 240px; |
| height: 240px; |
| border: 1px ridge #999999; |
| margin: auto; |
| } |
| #dinamick{ |
| position: relative; |
| width: 180px; |
| height: 180px; |
| top: 30px; |
| } |
| |
| /*<img src="3.png" width="200" height="200" alt="" />*/ |
| </style> |
| <script type="text/javascript"> |
| var dv,nd; |
| var date = Date.parse(Date()); |
| function rand(m,n){m=parseInt(m);n=parseInt(n);return Math.floor(Math.random()*(n-m+1))+m;} |
| |
| |
| |
| |
| $(document).ready(function(){ |
| dv = $('body div.dinamick:first img#dinamick:first'); |
| nd = $('body span#nd'); |
| //dP(10); |
| $('button#btn').click(function(){ |
| eval($('textarea#eval').val()); |
| }); |
| }); |
| |
| function dP(a){ |
| a=((a>100)?100:((a<1)?1:a)); |
| b=a/5; |
| c=180 + b; |
| b=Math.round((240-c)/2); |
| dv.css({top:b+'px',width:c+'px',height:c+'px'}); |
| //setTimeout(function(){dP(rand(1,100))},rand(50,100)); |
| } |
| soundManager.flashVersion = 9; |
| soundManager.useFastPolling = true; |
| soundManager.onload = function() { |
| |
| mySound = soundManager.createSound({ |
| |
| usePeakData: true, |
| |
| useWaveformData: true, |
| |
| id: 'someSound', |
| |
| url: 'Armin.mp3', |
| |
| volume: 100, |
| whileplaying: function(){ |
| pdb = mySound.peakData.left*100 |
| dP(pdb); |
| nd.text(Math.round(pdb)); |
| } |
| }); |
| |
| } |
| |
| |
| |
| |
| </script> |
| </head> |
| <body style="width: 1000px; height: 500px;"> |
| Нагрузка на динамик: <span id="nd">0</span>%<br /> |
| <div class="dinamick" align="center"> |
| |
| <img id="dinamick" src="3.png" alt="" /> |
| |
| |
| </div> |
| |
| <a href="" onclick="mySound.setVolume(10); return false;">10%</a> |
| <a href="" onclick="mySound.play(); return false;">Play</a> |
| <a href="" onclick="mySound.pause(); return false;">pause</a> |
| <a href="" onclick="mySound.resume(); return false;">resume</a> |
| <a href="" onclick="mySound.stop(); return false;">Stop</a> |
| <a href="" onclick="mySound.toggleMute(); return false;">mute</a> |
| <textarea cols="60" rows="10" id="eval">mySound.setVolume(200);</textarea> |
| <button id="btn">Выполнить код</button> |
| |
| |
| |
| </body> |
| </html> |