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

@drecom/scene-graph-cocos-animation-rt

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@drecom/scene-graph-cocos-animation-rt - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

drecom-scene-graph-cocos-animation-rt-0.0.1.tgz

2

lib/scene-graph-cocos-animation-rt.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["scene-graph-cocos-animation-rt"]=e():t["scene-graph-cocos-animation-rt"]=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e);var n={linear:function(t){return t},quadOut:function(t){return t*(2-t)}},a=2*Math.PI;function i(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function o(t,e){var r=function(t,e){var r=e,n=e-t[0],o=3*r,u=3*n,s=3*(e-t[2]),c=1/(-r+u-s+(e-1)),f=(o-6*n+s)*c,m=f*(1/3),l=(-o+u)*c,p=1/3*(3*l-f*f),g=p*(1/3),h=(2*f*f*f-9*f*l+r*c*27)/27,v=h/2,y=v*v+g*g*g;if(y<0){var d=1/3*-p,b=d*d*d,M=Math.sqrt(b),P=-h/(2*M),F=P<-1?-1:P>1?1:P,x=Math.acos(F),k=2*i(M),j=k*Math.cos(x*(1/3))-m,O=k*Math.cos((x+a)*(1/3))-m,A=k*Math.cos((x+2*a)*(1/3))-m;return 0<=j&&j<=1?0<=O&&O<=1?0<=A&&A<=1?Math.max(j,O,A):Math.max(j,O):0<=A&&A<=1?Math.max(j,A):j:0<=O&&O<=1?0<=A&&A<=1?Math.max(O,A):O:A}if(0===y){var C=v<0?i(-v):-i(v);return O=-C-m,0<=(j=2*C-m)&&j<=1?0<=O&&O<=1?Math.max(j,O):j:O}var w=Math.sqrt(y);return i(-v+w)-i(v+w)-m}(t,e),n=1-r;return 3*t[1]*r*n*n+3*t[3]*r*r*n+r*r*r}var u=Math.PI/180;var s=function(){function t(e,r){this.fps=60,this.paused=!1,this.elapsedTime=0,this.colorMatrix=void 0,this.animation=e,this.target=r,this.animationFrameTime=1/this.animation.sample,this.curveFuncsMap=new Map;for(var n=Object.keys(this.animation.curves),a=0;a<n.length;a++){for(var i=n[a],o=[],u=this.animation.curves[i],s=0;s<u.keyFrames.length;s++){var c=u.keyFrames[s],f=t.getCurveFunction(c.curve);o.push(f)}this.curveFuncsMap.set(i,o)}}return Object.defineProperty(t.prototype,"spf",{get:function(){return 1/this.fps},enumerable:!0,configurable:!0}),t.getCurveFunction=function(t){return t?"string"==typeof t?n.hasOwnProperty(t)?n[t]:n.linear:function(t){return function(e){return o(t,e)}}(t):n.linear},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.reset=function(){this.elapsedTime=0},t.prototype.getCurrentKeyFrameIndex=function(t,e,r){if(0===t.length)return 0;for(var n=1/r,a=t.length-1;a>=0;a--){if(n*(r*t[a].frame)<e)return a}return n*(r*t[0].frame)>e?-1:t.length},t.prototype.update=function(e){var r=this;if(!this.paused){this.elapsedTime+=e*this.spf;for(var n=!1,a=Object.keys(this.animation.curves),i=0;i<a.length;i++){var o=a[i],u=this.animation.curves[o],s=this.getCurrentKeyFrameIndex(u.keyFrames,this.elapsedTime,this.animation.sample);if(-1!==s){if(s!==u.keyFrames.length){var c=this.curveFuncsMap.get(o);if(c&&0!=c.length){var f=void 0,m=u.keyFrames[s],l=0;if(s>=u.keyFrames.length-1)f=m,s>0&&(m=u.keyFrames[s-1]),(l=this.elapsedTime/this.animation.duration)<1?n=!0:l=1;else{var p=this.animationFrameTime*(this.animation.sample*m.frame);f=u.keyFrames[s+1],l=(this.elapsedTime-p)/(this.animationFrameTime*(this.animation.sample*f.frame)-p),n=!0}var g=f.value,h=m.value,v=c[s],y={target:this.target,animationProperty:o,currentValue:h,targetValue:g,timeRatio:l,curveFunc:v};t.getAnimationPropertyConversionInfoSet(y).forEach(function(t){"alpha"===t.key&&void 0===t.target.alpha?(r.colorMatrix||(r.colorMatrix=new PIXI.filters.ColorMatrixFilter,t.target.filters||(t.target.filters=[]),t.target.filters.push(r.colorMatrix)),r.colorMatrix.alpha=t.value):t.target[t.key]=t.value})}}}else n=!0}n||(this.paused=!0)}},t.getPrimitiveAnimationPropertyConversionInfo=function(t){var e=t.targetValue-t.currentValue,r=t.currentValue+e*t.curveFunc(t.timeRatio);switch(t.animationProperty){case"x":return{target:t.target.position,key:t.animationProperty,value:r};case"y":return{target:t.target.position,key:t.animationProperty,value:-1*r};case"rotation":return{target:t.target,key:t.animationProperty,value:r*u};case"opacity":return{target:t.target,key:"alpha",value:r/255};default:return{target:t.target,key:t.animationProperty,value:r}}},t.getObjectAnimationPropertyConversionInfoSet=function(t){var e=new Set,r=t.targetValue,n=t.currentValue;if("color"===t.animationProperty){var a=t.curveFunc(t.timeRatio);if("tint"in t.target){var i={r:n.r/255,g:n.g/255,b:n.b/255},o={r:r.r/255,g:r.g/255,b:r.b/255},u={r:(o.r-i.r)*a*16711680,g:(o.g-i.g)*a*65280,b:(o.b-i.b)*a*255};e.add({target:t.target,key:"tint",value:i.r/16711680+(u.r-u.r%65536)+i.g/65280+(u.g-u.g%256)+i.b/255+u.b})}}else for(var s=Object.getOwnPropertyNames(n),c=0;c<s.length;c++){var f=s[c],m=r[f]-n[f],l=n[f]+m*t.curveFunc(t.timeRatio);e.add({target:t.target[t.animationProperty],key:f,value:l})}return e},t.getAnimationPropertyConversionInfoSet=function(e){if("number"==typeof e.currentValue){var r=new Set,n=t.getPrimitiveAnimationPropertyConversionInfo(e);return r.add(n),r}return t.getObjectAnimationPropertyConversionInfoSet(e)},t}(),c=function(){function t(){}return t.prototype.extendRuntimeObjects=function(t,e,r,n){e.forEach(function(t,e){if(t.animations){var a=r.get(e);if(a.sgmed||(a.sgmed={}),a.sgmed.cocosAnimations=t.animations,a.sgmed.cocosAnimations){for(var i=0;i<a.sgmed.cocosAnimations.length;i++){(o=a.sgmed.cocosAnimations[i]).runtime=new s(o,a)}if(n.autoCoordinateFix)for(i=0;i<a.sgmed.cocosAnimations.length;i++)for(var o=a.sgmed.cocosAnimations[i],u=Object.keys(o.curves),c=0;c<u.length;c++){var f=u[c];if("position"===f)for(var m=o.curves[f],l=0;l<m.keyFrames.length;l++){var p=m.keyFrames[l].value;p.y=-p.y}}}}})},t.prototype.filterAnimationContainer=function(t,e){void 0===e&&(e=[]),t.sgmed&&t.sgmed.cocosAnimations&&e.push(t);for(var r=0;r<t.children.length;r++)this.filterAnimationContainer(t.children[r],e);return e},t}();e.default=c}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["scene-graph-cocos-animation-rt"]=e():t["scene-graph-cocos-animation-rt"]=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e);var n={linear:function(t){return t},quadOut:function(t){return t*(2-t)}},a=2*Math.PI;function i(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function o(t,e){var r=function(t,e){var r=e,n=e-t[0],o=3*r,u=3*n,s=3*(e-t[2]),c=1/(-r+u-s+(e-1)),f=(o-6*n+s)*c,m=f*(1/3),l=(-o+u)*c,p=1/3*(3*l-f*f),g=p*(1/3),h=(2*f*f*f-9*f*l+r*c*27)/27,v=h/2,y=v*v+g*g*g;if(y<0){var d=1/3*-p,b=d*d*d,M=Math.sqrt(b),P=-h/(2*M),F=P<-1?-1:P>1?1:P,x=Math.acos(F),k=2*i(M),j=k*Math.cos(x*(1/3))-m,O=k*Math.cos((x+a)*(1/3))-m,A=k*Math.cos((x+2*a)*(1/3))-m;return 0<=j&&j<=1?0<=O&&O<=1?0<=A&&A<=1?Math.max(j,O,A):Math.max(j,O):0<=A&&A<=1?Math.max(j,A):j:0<=O&&O<=1?0<=A&&A<=1?Math.max(O,A):O:A}if(0===y){var C=v<0?i(-v):-i(v);return O=-C-m,0<=(j=2*C-m)&&j<=1?0<=O&&O<=1?Math.max(j,O):j:O}var w=Math.sqrt(y);return i(-v+w)-i(v+w)-m}(t,e),n=1-r;return 3*t[1]*r*n*n+3*t[3]*r*r*n+r*r*r}var u=Math.PI/180;var s=function(){function t(e,r){this.fps=60,this.paused=!1,this.elapsedTime=0,this.colorMatrix=void 0,this.animation=e,this.target=r,this.animationFrameTime=1/this.animation.sample,this.curveFuncsMap=new Map;for(var n=Object.keys(this.animation.curves),a=0;a<n.length;a++){for(var i=n[a],o=[],u=this.animation.curves[i],s=0;s<u.keyFrames.length;s++){var c=u.keyFrames[s],f=t.getCurveFunction(c.curve);o.push(f)}this.curveFuncsMap.set(i,o)}}return Object.defineProperty(t.prototype,"spf",{get:function(){return 1/this.fps},enumerable:!0,configurable:!0}),t.getCurveFunction=function(t){return t?"string"==typeof t?n.hasOwnProperty(t)?n[t]:n.linear:(e=t,function(t){return o(e,t)}):n.linear;var e},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.reset=function(){this.elapsedTime=0},t.prototype.getCurrentKeyFrameIndex=function(t,e,r){if(0===t.length)return 0;for(var n=1/r,a=t.length-1;a>=0;a--){if(n*(r*t[a].frame)<e)return a}return n*(r*t[0].frame)>e?-1:t.length},t.prototype.update=function(e){var r=this;if(!this.paused){this.elapsedTime+=e*this.spf;for(var n=!1,a=Object.keys(this.animation.curves),i=0;i<a.length;i++){var o=a[i],u=this.animation.curves[o],s=this.getCurrentKeyFrameIndex(u.keyFrames,this.elapsedTime,this.animation.sample);if(-1!==s){if(s!==u.keyFrames.length){var c=this.curveFuncsMap.get(o);if(c&&0!=c.length){var f=void 0,m=u.keyFrames[s],l=0;if(s>=u.keyFrames.length-1)f=m,s>0&&(m=u.keyFrames[s-1]),(l=this.elapsedTime/this.animation.duration)<1?n=!0:l=1;else{var p=this.animationFrameTime*(this.animation.sample*m.frame);f=u.keyFrames[s+1],l=(this.elapsedTime-p)/(this.animationFrameTime*(this.animation.sample*f.frame)-p),n=!0}var g=f.value,h=m.value,v=c[s],y={target:this.target,animationProperty:o,currentValue:h,targetValue:g,timeRatio:l,curveFunc:v};t.getAnimationPropertyConversionInfoSet(y).forEach(function(t){"alpha"===t.key&&void 0===t.target.alpha?(r.colorMatrix||(r.colorMatrix=new PIXI.filters.ColorMatrixFilter,t.target.filters||(t.target.filters=[]),t.target.filters.push(r.colorMatrix)),r.colorMatrix.alpha=t.value):t.target[t.key]=t.value})}}}else n=!0}n||(this.paused=!0)}},t.getPrimitiveAnimationPropertyConversionInfo=function(t){var e=t.targetValue-t.currentValue,r=t.currentValue+e*t.curveFunc(t.timeRatio);switch(t.animationProperty){case"x":return{target:t.target.position,key:t.animationProperty,value:r};case"y":return{target:t.target.position,key:t.animationProperty,value:-1*r};case"rotation":return{target:t.target,key:t.animationProperty,value:r*u};case"opacity":return{target:t.target,key:"alpha",value:r/255};default:return{target:t.target,key:t.animationProperty,value:r}}},t.getObjectAnimationPropertyConversionInfoSet=function(t){var e=new Set,r=t.targetValue,n=t.currentValue;if("color"===t.animationProperty){var a=t.curveFunc(t.timeRatio);if("tint"in t.target){var i={r:n.r/255,g:n.g/255,b:n.b/255},o={r:r.r/255,g:r.g/255,b:r.b/255},u={r:(o.r-i.r)*a*16711680,g:(o.g-i.g)*a*65280,b:(o.b-i.b)*a*255};e.add({target:t.target,key:"tint",value:i.r/16711680+(u.r-u.r%65536)+i.g/65280+(u.g-u.g%256)+i.b/255+u.b})}}else for(var s=Object.getOwnPropertyNames(n),c=0;c<s.length;c++){var f=s[c],m=r[f]-n[f],l=n[f]+m*t.curveFunc(t.timeRatio);e.add({target:t.target[t.animationProperty],key:f,value:l})}return e},t.getAnimationPropertyConversionInfoSet=function(e){if("number"==typeof e.currentValue){var r=new Set,n=t.getPrimitiveAnimationPropertyConversionInfo(e);return r.add(n),r}return t.getObjectAnimationPropertyConversionInfoSet(e)},t}(),c=function(){function t(){}return t.prototype.extendRuntimeObjects=function(t,e,r,n){e.forEach(function(t,e){if(t.animations){var a=r.get(e);if(a.sgmed||(a.sgmed={}),a.sgmed.cocosAnimations=t.animations,a.sgmed.cocosAnimations){for(var i=0;i<a.sgmed.cocosAnimations.length;i++){(o=a.sgmed.cocosAnimations[i]).runtime=new s(o,a)}if(n.autoCoordinateFix)for(i=0;i<a.sgmed.cocosAnimations.length;i++)for(var o=a.sgmed.cocosAnimations[i],u=Object.keys(o.curves),c=0;c<u.length;c++){var f=u[c];if("position"===f)for(var m=o.curves[f],l=0;l<m.keyFrames.length;l++){var p=m.keyFrames[l].value;p.y=-p.y}}}}})},t.prototype.filterAnimationContainer=function(t,e){void 0===e&&(e=[]),t.sgmed&&t.sgmed.cocosAnimations&&e.push(t);for(var r=0;r<t.children.length;r++)this.filterAnimationContainer(t.children[r],e);return e},t}();e.default=c}])});
{
"name": "@drecom/scene-graph-cocos-animation-rt",
"version": "0.0.9",
"version": "0.0.10",
"description": "",

@@ -22,4 +22,4 @@ "main": "lib/scene-graph-cocos-animation-rt.min.js",

"devDependencies": {
"@drecom/scene-graph-cocos-animation-cli": "^0.0.7",
"@drecom/scene-graph-mediator-rt": "^1.1.8",
"@drecom/scene-graph-cocos-animation-cli": "^0.0.8",
"@drecom/scene-graph-mediator-rt": "^1.2.2",
"@drecom/scene-graph-schema": "0.0.6",

@@ -32,3 +32,3 @@ "@types/pixi.js": "^4.8.2",

},
"gitHead": "4e15bb18fea8f4e87894f2ce5eca9ad3c2739847"
"gitHead": "0423b30b70ce63a851dc2b4768f8ebc9aa4d8793"
}
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