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/04 13:49:27 UTC

[airflow-site] branch aip-11 updated: Use helpers to select random items (#108)

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

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


The following commit(s) were added to refs/heads/aip-11 by this push:
     new a40ccc3  Use helpers to select random items (#108)
a40ccc3 is described below

commit a40ccc3f5113f834eccffbe0cf42dd0941a5c688
Author: Kamil BreguĊ‚a <mi...@users.noreply.github.com>
AuthorDate: Mon Nov 4 14:49:22 2019 +0100

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

diff --git a/landing-pages/src/js/headerAnimation.js b/landing-pages/src/js/headerAnimation.js
index 60c6c0a..3f4f56c 100644
--- a/landing-pages/src/js/headerAnimation.js
+++ b/landing-pages/src/js/headerAnimation.js
@@ -28,7 +28,8 @@ const ANIM_AMPLITUDE = 40;
 const DRAW_SAFE_AREA = false;
 
 const randomBetween = (from, to) => from + Math.random() * (to - from);
-const randomInt = (from, to) => randomBetween(from, to) | 0;
+const randomInt = (from, to) => Math.round(randomBetween(from, to));
+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),