JavaScript Why do transparent objects become opaque when animating canvas element?

I'm trying to do a js app that would basically move some balls on a canvas element. I set the context.fillStyle = "rgba(12, 34, 56, 0.2)"; the problem is that the balls become opaque from transparent after a short period of time. How can I maintain their transparency and why do they become opaque?

here is simplified version of my code:

function startScript(){
var layer1       = document.getElementById("layer1");
var context1     = layer1.getContext("2d");

var posX = 5;

context1.fillStyle = "rgba(12, 34, 56, 0.05)";

animate();

function animate() {

    posX+=3;

    context1.arc(posX, 200, 5, 0, Math.PI*2);
    context1.fill();

    // request new frame
    requestAnimFrame(function() {
        animate();
    });
}
}

window.requestAnimFrame = (function(callback) {
    return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
    function(callback) {
        window.setTimeout(callback, 1000 / 60);
    };
})();
Answer:1

I am attempting to write a pair of shaders for WebGL which will allow me to render a color cube. However, when I attempt to open the file, I receive the error "unable to initialize the shader program"...

I am attempting to write a pair of shaders for WebGL which will allow me to render a color cube. However, when I attempt to open the file, I receive the error "unable to initialize the shader program"...

I have a question concerning plugins. I am using the ionic framework (http://ionicframework.com/) and Cordova for my hybrid app. I am using a toast (text popup) plugin to provide some feedback. ...

I have a question concerning plugins. I am using the ionic framework (http://ionicframework.com/) and Cordova for my hybrid app. I am using a toast (text popup) plugin to provide some feedback. ...

  1. cordova ionic plugin keyboard
  2. cordova ionic plugin
  3. cordova ionic plugin webview
  4. cordova ionic plugin_not_installed
  5. cordova ionic plugin camera
  6. ionic cordova plugin remove
  7. ionic cordova plugin add
  8. cordova-plugin-ionic-webview npm
  9. cordova-plugin-ionic-keyboard example
  10. cordova-plugin-ionic@^5.0.0
  11. ionic cordova plugin update
  12. ionic cordova-plugin-whitelist
  13. ionic cordova-plugin-file
  14. ionic cordova plugin list
  15. ionic cordova-plugin-firebase
  16. cordova-plugin-ionic-keyboard npm
  17. ionic cordova-plugin-device
  18. cordova-plugin-ionic-webview example
  19. ionic cordova-plugin-advanced-http
  20. ionic cordova-plugin-googlemaps

I'm writing a google chrome extension to modify the look of tumblr for a project. I'm trying to make the posts to go down in multiple colums rather than just one, It is going... alright. Except as ...

I'm writing a google chrome extension to modify the look of tumblr for a project. I'm trying to make the posts to go down in multiple colums rather than just one, It is going... alright. Except as ...

I've seen so many different posts that pertain to my situation, but I'm still learning server side and js code, so I just don't understand how to apply it to my problem yet. I'm trying to build an ...

I've seen so many different posts that pertain to my situation, but I'm still learning server side and js code, so I just don't understand how to apply it to my problem yet. I'm trying to build an ...

  1. populate jquery select
  2. jquery populate select from json
  3. jquery populate select from ajax
  4. jquery populate select from array
  5. jquery populate select options
  6. jquery populate select options from array
  7. jquery populate select list from json
  8. jquery populate select list
  9. jquery populate select from ajax json
  10. jquery populate select box
  11. jquery populate select box with json data
  12. jquery populate select options from json
  13. jquery populate select from json array
  14. jquery populate select options from ajax
  15. jquery populate select list from array
  16. jquery populate select on click
  17. jquery populate select options from database
  18. jquery populate select dropdown
  19. jquery populate select with years
  20. jquery populate select from object