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:34 UTC

[airflow-site] branch helper-random created (now 9715ebc)

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

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


      at 9715ebc  Use helpers to select random items

This branch includes the following new commits:

     new 9715ebc  Use helpers to select random items

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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

Posted by ka...@apache.org.
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),