小编Bre*_*son的帖子

放大缩小动画

我正在测试单击图像时的放大/缩小动画。但我没有得到我想要的结果。图像完全放大但不完全缩小。为了更好地理解我的问题,请观看此视频

这是我的代码:

放大.XML

<set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" >
<scale
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromXScale="1"
    android:fromYScale="1"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="3"
    android:toYScale="3" >
</scale>
</set>
Run Code Online (Sandbox Code Playgroud)

缩放.xml

<set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" >
<scale
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromXScale="1.0"
    android:fromYScale="1.0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="0.5"
    android:toYScale="0.5" >
</scale>
Run Code Online (Sandbox Code Playgroud)

主要活动

public class MainActivity extends Activity 
 {
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ImageButton pic = (ImageButton) findViewById(R.id.levelimg);
    pic.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View v){
            final Dialog dialog = new Dialog(MainActivity.this);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialogpic);
            dialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
            dialog.show();
        }
    });
}
  } …
Run Code Online (Sandbox Code Playgroud)

animation android

2
推荐指数
1
解决办法
3998
查看次数

大约2分钟后,Chrome for Android会停止播放Webaudio声音

我在Chrome for Android上遇到了WebAudio问题.

我在三星Galaxy S3(GT-I9300)上遇到这种情况:

  • Chrome版本44.0.2403.133
  • Android 4.3.0

这是我用来尝试隔离问题的代码:

var audioContext;
if(window.AudioContext) {
    audioContext = new AudioContext();
}

var startTime = Date.now();
var lastTrigger;

var gain = audioContext.createGain();
gain.gain.value = 1;
gain.connect(audioContext.destination);

var buttonTrigger = document.getElementById('trigger');
buttonTrigger.addEventListener('click', function(event) {
    var oscillator =  audioContext.createOscillator();
    oscillator.type = "square";
    oscillator.frequency.value = 100 +  (Math.cos(audioContext.currentTime)*100);
    oscillator.connect(gain);
    oscillator.start(0);
    oscillator.stop(audioContext.currentTime+0.1);

    lastTrigger = Date.now();
});

var timer = document.getElementById('timer');
setInterval(function() {
    if(lastTrigger) { timer.textContent = Date.now() - lastTrigger; }
}, 1000);
Run Code Online (Sandbox Code Playgroud)

在这里它是在jsfiddle

这只是创建一个振荡器节点并在单击按钮时播放.在我的手机上,如果我没有点击按钮大约一分半钟或两分钟,我就不再发出任何声音了.

没有抛出任何错误.

有没有人有这个问题的经验和可能的解决方法?

这个问题最初出现在一个更大的应用程序中,使用Phaser播放来自m4a文件的声音,所以这不仅仅与振荡器有关. …

javascript android google-chrome web-audio-api

1
推荐指数
1
解决办法
2197
查看次数