【重要】サービス終了のお知らせ

Discussions

QBackground

Can we have a transparent backgound or image at the back?

Sample Code

AAnswer to: Background

ethertank

I use this code for it.


function loop () {
// some code

// comment out
// context.fillStyle = 'rgba(0,0,0,0.05)';
// context.fillRect(0, 0, context.canvas.width, context.canvas.height);

context.globalCompositeOperation = "destination-in"; // Good idea :-)
context.fillStyle = 'rgba(255, 255, 255, 0.9)'; // If you change opacity, amount of blur will change :-)
context.fillRect(0, 0, context.canvas.width, context.canvas.height);
context.globalCompositeOperation = "source-over"; // Undo for drawing particles.

// code for drawing particle...
}


Please try to change the background color by CSS.
That way, you can know that the canvas is transparent.

aprilrussell

JavaScriptにおいて、あるクラスのメソッドをオーバーライドするには、サブクラスのprototypeオブジェクトにオーバーライドしたいスーパークラスのメソッドと同名のメソッドを定義します。Refer: free run 3 cool math games

Post a question

You can post JavaScript, HTML, CSS related questions with attached reference to actual codes and get the answers likewise.

Ask a question

  • 1. Click the ‘Post a question’ above

  • 2. Enter question details, reference code, and click ‘Add question’ button

  • 3. Question will be paired with the code on display

Add an answer

  • 1. Choose a question

  • 2. Enter answer details, attach the reference code and click ‘add answer’ button

  • 3. Your answer will accompanied with attached code

Tag