canvasrenderer
Advanced tools
Comparing version 0.0.2 to 0.0.3
/** | ||
* canvasrenderer v0.0.1 build 04.08.2015 | ||
* canvasrenderer v0.0.3 build 04.08.2015 | ||
* https://github.com/vanruesc/canvasrenderer | ||
@@ -18,3 +18,3 @@ * Copyright 2015 Raoul van Rueschen, Zlib | ||
* @param {Object} [options] - The settings. | ||
* @param {Number} [options.dt=1000/60] - A delta time constant. | ||
* @param {Number} [options.dt=1/60] - The update rate in seconds. | ||
* @param {Boolean} [options.clearCanvas=true] - Whether the canvas should automatically be cleared. | ||
@@ -102,3 +102,3 @@ * @param {Boolean} [options.enabled=true] - Whether the animation should be rendered. If set to false, the render function will merely update the time. | ||
{ | ||
if(options.dt !== undefined) { this.dt = options.dt; } | ||
if(options.dt !== undefined) { this.dt = options.dt * 1000.0; } | ||
if(options.canvas !== undefined) { this.canvas = options.canvas; } | ||
@@ -105,0 +105,0 @@ if(options.clearCanvas !== undefined) { this.clearCanvas = options.clearCanvas; } |
/** | ||
* canvasrenderer v0.0.1 build 04.08.2015 | ||
* canvasrenderer v0.0.3 build 04.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=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())/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)}); |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/vanruesc/canvasrenderer", | ||
@@ -12,0 +12,0 @@ "author": { |
@@ -11,3 +11,3 @@ "use strict"; | ||
* @param {Object} [options] - The settings. | ||
* @param {Number} [options.dt=1000/60] - A delta time constant. | ||
* @param {Number} [options.dt=1/60] - The update rate in seconds. | ||
* @param {Boolean} [options.clearCanvas=true] - Whether the canvas should automatically be cleared. | ||
@@ -95,3 +95,3 @@ * @param {Boolean} [options.enabled=true] - Whether the animation should be rendered. If set to false, the render function will merely update the time. | ||
{ | ||
if(options.dt !== undefined) { this.dt = options.dt; } | ||
if(options.dt !== undefined) { this.dt = options.dt * 1000.0; } | ||
if(options.canvas !== undefined) { this.canvas = options.canvas; } | ||
@@ -98,0 +98,0 @@ if(options.clearCanvas !== undefined) { this.clearCanvas = options.clearCanvas; } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164133