You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Around 2016/01/27 a demo application 'stars.nml' ran at about 60 fps.
Currently (2017/12/37) it seems to run at about 30fps.
A prelimanary investigation indicates that the loss of performance happens somewere before 2016/06/20.
<application framework="false" version="0.1">
<!--
/* -------------------------------------------------------------------------- */
/* MIT license (c) 2016 Nidium, Inc. */
/* -------------------------------------------------------------------------- */
/* Permission is hereby granted, free of charge, to any person obtaining a */
/* copy of this software and associated documentation files (the "Software"), */
/* to deal in the Software without restriction, including without limitation */
/* the rights to use, copy, modify, merge, publish, distribute, sublicense, */
/* and/or sell copies of the Software, and to permit persons to whom the */
/* Software is furnished to do so, subject to the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be included in */
/* all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL */
/* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER */
/* DEALINGS IN THE SOFTWARE. */
/* -------------------------------------------------------------------------- */
-->
<meta>
<title>Test case</title>
<viewport> 800x600</viewport>
<version>1.0</version>
<date>2012-03-15</date>
<robots>index, follow</robots>
<identifier>com.nidium.app.demos.stars</identifier>
<author>Nidium Inc.</author>
</meta>
<assets>
<script>
var canvas = document.canvas;
var ctx = canvas.getContext("2d");
document.showFPS(true);
var particule = function(ctx) {
this.ctx = ctx;
this.reset();
this.sizes = {
halfWidth: canvas.width / 2,
halfHeight: canvas.height / 2
}
}
particule.prototype.reset = function() {
this.positions = {
x: 2 * (Math.random() - 0.5),
y: 2 * (Math.random() - 0.5),
z: 1
}
}
particule.prototype.draw = function() {
//this.ctx.save();
this.ctx.fillStyle = "#FFF";
this.positions.z -= 0.01;
var x = (this.positions.x / this.positions.z) * this.sizes.halfWidth + this.sizes.halfWidth;
var y = (this.positions.y / this.positions.z) * this.sizes.halfHeight + this.sizes.halfHeight;
if (x <= 0 || x > canvas.width || y <= 0 || y > canvas.height) {
this.reset();
}
this.ctx.fillRect(x, y, 1, 1);
//this.ctx.restore();
}
var stars = [];
for (var i = 0; i < 4096*4; i++) {
stars[i] = new particule(ctx);
}
function draw()
{
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < stars.length; i++) {
stars[i].draw();
}
window.requestAnimationFrame(draw);
}
draw();
/*ctx.fillStyle = "blue";
//ctx.fillRect(0, 0, 20, 20);
console.log("default", ctx.fillStyle);
var img = new Image();
img.src = "./pattern.png";
img.onload = function() {
var pattern = ctx.createPattern(img, "repeat");
ctx.fillStyle = pattern;
console.log("Pattern set");
console.log("New fillstyle", ctx.fillStyle);
ctx.save();
console.log("After save", ctx.fillStyle);
ctx.fillRect(0, 0, 800, 800);
ctx.fillStyle = "red";
console.log("remove pattern", ctx.fillStyle);
ctx.restore();
ctx.fillStyle = "yellow";
console.log("After restore", ctx.fillStyle);
}*/
</script>
</assets>
</application>
The text was updated successfully, but these errors were encountered:
Around 2016/01/27 a demo application 'stars.nml' ran at about 60 fps.
Currently (2017/12/37) it seems to run at about 30fps.
A prelimanary investigation indicates that the loss of performance happens somewere before 2016/06/20.
The text was updated successfully, but these errors were encountered: