Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

canvasrenderer

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvasrenderer - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

23

build/canvasrenderer.js

@@ -29,3 +29,3 @@ /**

/**
* Delta time.
* Delta time in milliseconds.
*

@@ -36,6 +36,6 @@ * @property dt

this.dt = 1.0 / 60.0;
this.dt = 1000.0 / 30.0;
/**
* Used for time based rendering.
* Used for time based rendering. Milliseconds.
*

@@ -47,6 +47,6 @@ * @property now

this.now = 0.0;
this.now = ((window.performance !== undefined) ? window.performance.now() : Date.now()) / 1000.0;
/**
* Used for time based rendering.
* Used for time based rendering. Milliseconds.
*

@@ -61,3 +61,3 @@ * @property then

/**
* Used for time based rendering.
* Used for time based rendering. Milliseconds.
*

@@ -174,3 +174,3 @@ * @property accumulator

* @method update
* @param {Number} elapsed - The time since the last update call in seconds.
* @param {Number} elapsed - The time since the last update call in milliseconds.
*/

@@ -193,3 +193,3 @@

* @private
* @param {DOMHighResTimeStamp} now - The timestamp provided by requestAnimationFrame.
* @param {DOMHighResTimeStamp} now - The time since the page was loaded.
*/

@@ -201,2 +201,7 @@

if(now === undefined)
{
now = (window.performance !== undefined) ? window.performance.now() : Date.now();
}
if(this.clearCanvas)

@@ -207,3 +212,3 @@ {

this.now = now / 1000.0;
this.now = now;
elapsed = this.now - this.then;

@@ -210,0 +215,0 @@ this.then = this.now;

@@ -6,2 +6,2 @@ /**

*/
!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=1/60,this.now=0,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;this.clearCanvas&&this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.now=a/1e3,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/30,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)});

@@ -76,3 +76,3 @@ {

"line": 21,
"description": "Delta time.",
"description": "Delta time in milliseconds.",
"itemtype": "property",

@@ -86,3 +86,3 @@ "name": "dt",

"line": 30,
"description": "Used for time based rendering.",
"description": "Used for time based rendering. Milliseconds.",
"itemtype": "property",

@@ -98,3 +98,3 @@ "name": "now",

"line": 40,
"description": "Used for time based rendering.",
"description": "Used for time based rendering. Milliseconds.",
"itemtype": "property",

@@ -110,3 +110,3 @@ "name": "then",

"line": 50,
"description": "Used for time based rendering.",
"description": "Used for time based rendering. Milliseconds.",
"itemtype": "property",

@@ -186,3 +186,3 @@ "name": "accumulator",

"name": "elapsed",
"description": "- The time since the last update call in seconds.",
"description": "- The time since the last update call in milliseconds.",
"type": "Number"

@@ -212,3 +212,3 @@ }

"name": "now",
"description": "- The timestamp provided by requestAnimationFrame.",
"description": "- The time since the page was loaded.",
"type": "DOMHighResTimeStamp"

@@ -215,0 +215,0 @@ }

@@ -9,3 +9,3 @@ {

],
"version": "0.0.0",
"version": "0.0.1",
"homepage": "https://github.com/vanruesc/canvasrenderer",

@@ -12,0 +12,0 @@ "author": {

@@ -22,3 +22,3 @@ "use strict";

/**
* Delta time.
* Delta time in milliseconds.
*

@@ -29,6 +29,6 @@ * @property dt

this.dt = 1.0 / 60.0;
this.dt = 1000.0 / 30.0;
/**
* Used for time based rendering.
* Used for time based rendering. Milliseconds.
*

@@ -40,6 +40,6 @@ * @property now

this.now = 0.0;
this.now = ((window.performance !== undefined) ? window.performance.now() : Date.now()) / 1000.0;
/**
* Used for time based rendering.
* Used for time based rendering. Milliseconds.
*

@@ -54,3 +54,3 @@ * @property then

/**
* Used for time based rendering.
* Used for time based rendering. Milliseconds.
*

@@ -167,3 +167,3 @@ * @property accumulator

* @method update
* @param {Number} elapsed - The time since the last update call in seconds.
* @param {Number} elapsed - The time since the last update call in milliseconds.
*/

@@ -186,3 +186,3 @@

* @private
* @param {DOMHighResTimeStamp} now - The timestamp provided by requestAnimationFrame.
* @param {DOMHighResTimeStamp} now - The time since the page was loaded.
*/

@@ -194,2 +194,7 @@

if(now === undefined)
{
now = (window.performance !== undefined) ? window.performance.now() : Date.now();
}
if(this.clearCanvas)

@@ -200,3 +205,3 @@ {

this.now = now / 1000.0;
this.now = now;
elapsed = this.now - this.then;

@@ -203,0 +208,0 @@ this.then = this.now;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc