我正试着做一个标志,让它到处都是烟雾。我撞到了这个小玩意:http://jsfiddle.net/jonnyc/Ujz4P/5/,现在我正试图改变它,这样它就通过了一个标志,但是它不想工作。
index.html
<html>
<head>
<title>Smoke</title>
<style>
.container
{
width: 360px;
height: 200px;
border: 2px solid black;
}
</style>
<script type="text/javascript" src="smoke_effect.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<div class="container">
<img id="smoke-logo" src="images.jpg"/>
</div>
</body>
</html>我把它粘贴在一个叫做smoke_effect.js的文档中,但是我根本没有修改代码,我只是把标签从"myCanvas“更改为”烟雾-徽标“。
发布于 2014-05-07 18:45:09
我对你的fiddle做了两个大的改动
我将CSS改为:
#myCanvas{
background:transparent;
}而画的功能,而不是填充半透明的黑色,只是清除画布。
// The function to draw the scene
function draw() {
// Clear the drawing surface and fill it with a black background
//context.fillStyle = "rgba(0, 0, 0, 0.5)";
//context.fillRect(0, 0, 400, 400);
context.clearRect(0,0,400,400);
// Go through all of the particles and draw them.
particles.forEach(function(particle) {
particle.draw();
});
}这样你就可以在烟雾后面放一个图像。
https://stackoverflow.com/questions/23525662
复制相似问题