zimjs 18.1.8 → 18.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/zim.js +21 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "18.1.8",
3
+ "version": "18.1.9",
4
4
  "type": "module",
5
5
  "main": "./src/zim.js",
6
6
  "types": "./ts-src/typings/zim",
package/src/zim.js CHANGED
@@ -47749,6 +47749,8 @@ zim.Carousel3D = function(width, height, items, widthFactor, heightFactor, curve
47749
47749
 
47750
47750
  var shift;
47751
47751
  var min, max;
47752
+
47753
+
47752
47754
 
47753
47755
  this.makeCarousel = function() {
47754
47756
 
@@ -47811,7 +47813,7 @@ zim.Carousel3D = function(width, height, items, widthFactor, heightFactor, curve
47811
47813
  that.holder.loop(function(item, i) {
47812
47814
  item.y = item.start - r + (that.amount+r+r*2*1000000 + item.shift) % (r*2);
47813
47815
  var delta = item.y - center;
47814
- var w = Math.sqrt(Math.pow(r,2) - Math.pow(delta,2)) * 2;
47816
+ var w = (Math.sqrt(Math.pow(r,2) - Math.pow(delta,2)) * 2) || 0;
47815
47817
  item.width = w;
47816
47818
  var sh = zim.sign((height/2-item.y)) * Math.round(Math.pow((height/2-item.y), 2)/(10+900*(1-that.curve)));
47817
47819
  item.mov(0,delta*heightFactor+sh);
@@ -47824,12 +47826,12 @@ zim.Carousel3D = function(width, height, items, widthFactor, heightFactor, curve
47824
47826
  that.holder.loop(function(item, i) {
47825
47827
  item.x = item.start - r + (that.amount+r+r*2*1000000 + item.shift) % (r*2);
47826
47828
  var delta = item.x - center;
47827
- var h = Math.sqrt(Math.pow(r,2) - Math.pow(delta,2)) * 2;
47828
- item.height = h;
47829
+ var h = (Math.sqrt(Math.pow(r,2) - Math.pow(delta,2)) * 2) || 0;
47830
+ item.height = h;
47829
47831
  var sh = zim.sign((width/2-item.x)) * Math.round(Math.pow((width/2-item.x), 2)/(10+900*(1-that.curve)));
47830
- item.mov(delta*widthFactor+sh);
47832
+ item.mov(delta*widthFactor+sh);
47831
47833
  item.height = constrain(item.height - (height-item.height)*heightFactor,0,100000);
47832
- item.visible = item.height>0;
47834
+ item.visible = item.height>0;
47833
47835
  });
47834
47836
  that.holder.sortBy("height");
47835
47837
  }
@@ -47837,7 +47839,7 @@ zim.Carousel3D = function(width, height, items, widthFactor, heightFactor, curve
47837
47839
  var index = that.currentItem.dexIndex;
47838
47840
  if (index != that.latestIndex) {
47839
47841
  that.holder.loop(function(item,i,t) {
47840
- if (interactive) {
47842
+ if (interactive) {
47841
47843
  if (item==that.currentItem) {
47842
47844
  item.mouseEnabled = true;
47843
47845
  item.mouseChildren = true;
@@ -74114,6 +74116,18 @@ new MotionController({
74114
74116
  });
74115
74117
  END EXAMPLE
74116
74118
 
74119
+ EXAMPLE
74120
+ // good setting for motion following cursor
74121
+ // on mousedown or finger dragging on mobile
74122
+ const t = new Triangle(80,100,100).rot(90).center();
74123
+ const mc = new MotionController({
74124
+ target:t,
74125
+ type:"follow",
74126
+ orient:true,
74127
+ offTime:.25
74128
+ });
74129
+ END EXAMPLE
74130
+
74117
74131
  EXAMPLE
74118
74132
  F.loadAssets(["beach02.jpg", "playbeachball.png"], "https://zimjs.org/assets/"); // or load in Frame()
74119
74133
  F.on("complete", ()=>{
@@ -98446,4 +98460,4 @@ export let Ticker = zim.Ticker;
98446
98460
  export let Style = zim.Style;
98447
98461
  export let assets = zim.assets;
98448
98462
  export let assetIDs = zim.assetIDs;
98449
- export let ZIMON = zim.ZIMON;
98463
+ export let ZIMON = zim.ZIMON;