moving-mondrian

Randomly generated animated images in the style of Piet Mondrian  https://p.ce9e.org/moving-mondrian/
git clone https://git.ce9e.org/moving-mondrian.git

commit
9efb1f5894a7db0a12484a55c35401735ab91405
parent
7ad442c23f53f331c5cee465dc0b7bdd2841794c
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-01-16 12:46
change easing

Diffstat

M mondrian.js 10 ++++------

1 files changed, 4 insertions, 6 deletions


diff --git a/mondrian.js b/mondrian.js

@@ -1,7 +1,5 @@
    1     1 var speed = 2;  // percent per second
    2    -1 var easing_factor = 0.6;
    3    -1 var easing_max = Math.tan(Math.PI / 2 * easing_factor);
    4    -1 
   -1     2 var easingWeight = 0.6;
    5     3 
    6     4 var createLeaf = function() {
    7     5 	var element = document.createElement("div");
@@ -29,9 +27,9 @@ var getRelSize = function(element) {
   29    27 };
   30    28 
   31    29 var easing = function(x) {
   32    -1 	var xx = (x - 0.5) * Math.PI * easing_factor;
   33    -1 	var yy = Math.tan(xx);
   34    -1 	return yy / easing_max / 2 + 0.5;
   -1    30 	var xx = (x - 0.5) * 2;
   -1    31 	var y = Math.pow(xx, 5) * easingWeight + xx * (1 - easingWeight);
   -1    32 	return y / 2 + 0.5;
   35    33 };
   36    34 
   37    35 var setPos = function(element, x) {