canvasrenderer
Advanced tools
Comparing version 0.0.5 to 0.0.6
/** | ||
* canvasrenderer v0.0.3 build 04.08.2015 | ||
* canvasrenderer v0.0.6 build 05.08.2015 | ||
* https://github.com/vanruesc/canvasrenderer | ||
@@ -45,3 +45,3 @@ * Copyright 2015 Raoul van Rueschen, Zlib | ||
this.now = ((window.performance !== undefined) ? window.performance.now() : Date.now()) / 1000.0; | ||
this.now = (window.performance !== undefined) ? window.performance.now() : Date.now(); | ||
@@ -105,2 +105,3 @@ /** | ||
if(options.clearCanvas !== undefined) { this.clearCanvas = options.clearCanvas; } | ||
if(options.enabled !== undefined) { this.enabled = options.enabled; } | ||
this.size = options.size; | ||
@@ -107,0 +108,0 @@ } |
/** | ||
* canvasrenderer v0.0.3 build 04.08.2015 | ||
* canvasrenderer v0.0.6 build 05.08.2015 | ||
* https://github.com/vanruesc/canvasrenderer | ||
* Copyright 2015 Raoul van Rueschen, Zlib | ||
*/ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.CanvasRenderer=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function CanvasRenderer(a){var b=this;this.dt=1e3/60,this.now=(void 0!==window.performance?window.performance.now():Date.now())/1e3,this.then=this.now,this.accumulator=0,this.ctx=null,this.canvas=document.createElement("canvas"),this.clearCanvas=!0,this.enabled=!0,void 0!==a&&(void 0!==a.dt&&(this.dt=1e3*a.dt),void 0!==a.canvas&&(this.canvas=a.canvas),void 0!==a.clearCanvas&&(this.clearCanvas=a.clearCanvas),this.size=a.size),this.render=function(a){b._render(a)}}b.exports=CanvasRenderer,Object.defineProperty(CanvasRenderer.prototype,"canvas",{get:function(){return this.ctx.canvas},set:function(a){void 0!==a&&void 0!==a.getContext&&(this.ctx=a.getContext("2d"))}}),Object.defineProperty(CanvasRenderer.prototype,"size",{get:function(){return[this.ctx.canvas.width,this.ctx.canvas.height]},set:function(a){void 0!==a&&2===a.length&&(this.ctx.canvas.width=a[0],this.ctx.canvas.height=a[1])}}),CanvasRenderer.prototype.update=function(a){},CanvasRenderer.prototype.draw=function(){},CanvasRenderer.prototype._render=function(a){var b;void 0===a&&(a=void 0!==window.performance?window.performance.now():Date.now()),this.clearCanvas&&this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.now=a,b=this.now-this.then,this.then=this.now,this.enabled&&(this.accumulator+=b,this.accumulator>=this.dt&&(this.update(b),this.accumulator-=this.dt),this.draw())}},{}]},{},[1])(1)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.CanvasRenderer=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function CanvasRenderer(a){var b=this;this.dt=1e3/60,this.now=void 0!==window.performance?window.performance.now():Date.now(),this.then=this.now,this.accumulator=0,this.ctx=null,this.canvas=document.createElement("canvas"),this.clearCanvas=!0,this.enabled=!0,void 0!==a&&(void 0!==a.dt&&(this.dt=1e3*a.dt),void 0!==a.canvas&&(this.canvas=a.canvas),void 0!==a.clearCanvas&&(this.clearCanvas=a.clearCanvas),void 0!==a.enabled&&(this.enabled=a.enabled),this.size=a.size),this.render=function(a){b._render(a)}}b.exports=CanvasRenderer,Object.defineProperty(CanvasRenderer.prototype,"canvas",{get:function(){return this.ctx.canvas},set:function(a){void 0!==a&&void 0!==a.getContext&&(this.ctx=a.getContext("2d"))}}),Object.defineProperty(CanvasRenderer.prototype,"size",{get:function(){return[this.ctx.canvas.width,this.ctx.canvas.height]},set:function(a){void 0!==a&&2===a.length&&(this.ctx.canvas.width=a[0],this.ctx.canvas.height=a[1])}}),CanvasRenderer.prototype.update=function(a){},CanvasRenderer.prototype.draw=function(){},CanvasRenderer.prototype._render=function(a){var b;void 0===a&&(a=void 0!==window.performance?window.performance.now():Date.now()),this.clearCanvas&&this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.now=a,b=this.now-this.then,this.then=this.now,this.enabled&&(this.accumulator+=b,this.accumulator>=this.dt&&(this.update(b),this.accumulator-=this.dt),this.draw())}},{}]},{},[1])(1)}); |
@@ -5,3 +5,3 @@ { | ||
"description": "A base class that provides methods for canvas rendering.", | ||
"version": "0.0.4", | ||
"version": "0.0.6", | ||
"url": "https://github.com/vanruesc/canvasrenderer" | ||
@@ -147,3 +147,3 @@ }, | ||
"file": "src\\canvasrenderer.js", | ||
"line": 100, | ||
"line": 101, | ||
"description": "The animation loop.", | ||
@@ -156,3 +156,3 @@ "itemtype": "method", | ||
"file": "src\\canvasrenderer.js", | ||
"line": 109, | ||
"line": 110, | ||
"description": "The canvas.", | ||
@@ -166,3 +166,3 @@ "itemtype": "property", | ||
"file": "src\\canvasrenderer.js", | ||
"line": 127, | ||
"line": 128, | ||
"description": "The size of the canvas.", | ||
@@ -179,3 +179,3 @@ "itemtype": "property", | ||
"file": "src\\canvasrenderer.js", | ||
"line": 154, | ||
"line": 155, | ||
"description": "Abstract update method.\n\nThis method will be called by the render function\nat a maximum rate of 60 fps. If the framerate drops,\nthe animation will, of course, slow down. That's the\nintended behaviour.", | ||
@@ -195,3 +195,3 @@ "itemtype": "method", | ||
"file": "src\\canvasrenderer.js", | ||
"line": 168, | ||
"line": 169, | ||
"description": "Abstract draw method.", | ||
@@ -204,3 +204,3 @@ "itemtype": "method", | ||
"file": "src\\canvasrenderer.js", | ||
"line": 176, | ||
"line": 177, | ||
"description": "Renders the animation.", | ||
@@ -207,0 +207,0 @@ "itemtype": "method", |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"homepage": "https://github.com/vanruesc/canvasrenderer", | ||
@@ -12,0 +12,0 @@ "author": { |
@@ -97,2 +97,3 @@ "use strict"; | ||
if(options.clearCanvas !== undefined) { this.clearCanvas = options.clearCanvas; } | ||
if(options.enabled !== undefined) { this.enabled = options.enabled; } | ||
this.size = options.size; | ||
@@ -99,0 +100,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
164358
2023