You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2019/11/01 21:04:35 UTC

[airflow-site] 01/01: Use helpers to select random items

This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch helper-random
in repository https://gitbox.apache.org/repos/asf/airflow-site.git

commit 9715ebc9baed02278bbc31e142b418150f461909
Author: Kamil BreguĊ‚a <ka...@polidea.com>
AuthorDate: Fri Nov 1 22:03:26 2019 +0100

    Use helpers to select random items
---
 landing-pages/src/js/headerAnimation.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/landing-pages/src/js/headerAnimation.js b/landing-pages/src/js/headerAnimation.js
index 60c6c0a..fe30d70 100644
--- a/landing-pages/src/js/headerAnimation.js
+++ b/landing-pages/src/js/headerAnimation.js
@@ -29,6 +29,7 @@ const DRAW_SAFE_AREA = false;
 
 const randomBetween = (from, to) => from + Math.random() * (to - from);
 const randomInt = (from, to) => randomBetween(from, to) | 0;
+const randomItem = (arr) => arr[randomInt(0, arr.length)];
 
 class Polygon {
   constructor(pos, vectors) {
@@ -147,10 +148,10 @@ function createBoxes(sketch, vw, vh, clearArea, colors) {
       const box = new Box(
         pos,
         randomBetween(MAX_BLOCK_SIZE / 2, MAX_BLOCK_SIZE),
-        colors[randomInt(0, colors.length)],
+        randomItem(colors),
         randomBetween(0.5, 1),
         randomBetween(0, 1) > 0.5 ? 1 : -1,
-        Math.random() * 2 * sketch.PI
+        randomBetween(0, 2 * sketch.PI)
       );
       boxes.push(box);
     }
@@ -167,7 +168,6 @@ function createLogoArea(sketch, canvas, title, subtitle, button) {
   const vectors = [
     sketch.createVector(titleRect.x, titleRect.y),
     sketch.createVector(titleRect.x + titleRect.width, titleRect.y),
-    // sketch.createVector(titleRect.x + titleRect.width, titleRect.y + titleRect.height),
     sketch.createVector(subtitleRect.x + subtitleRect.width, subtitleRect.y),
     sketch.createVector(subtitleRect.x + subtitleRect.width, subtitleRect.y + subtitleRect.height),
     sketch.createVector(buttonRect.x + buttonRect.width, buttonRect.y + buttonRect.height),