javascript – Sugerencia para desarrollo de ruleta horizontal en nodejs + socket.io

Tengo una ruleta funcional ahora mismo, que se dibuja mediante canvas, pero al estar dibujandose continuamente para dar la apariencia de estar girando no resulta con la calidad que me gustaria, es por eso que averigue sobre otra opcion, tener una imagen que contenga 2 o 3 veces los casilleros de la ruleta y mover esa imagen, daria la apariencia de un loop, pero en verdad solo estaria recorriendo de izquierda a derecha la imagen. Sim embargo aun no descubro como escribir el codigo para realizar esto, ademas de que no sabria como obtener el resultado, cosa que usando canvas si consigo obtenerlo. Busco sugerencias y referencias para poder desarrollar mi proyecto.

imagen creada por canvasintroducir la descripción de la imagen aquí

Imagen creada por mi en photoshop (si, falta el verde, era solo prueba)introducir la descripción de la imagen aquí

adjunto mi codigo canvas
(los numeros se obtienen en un index.js ejecutado en nodejs) (var numbers = Array.from({ length: 14 }, (v, k) => k); //y luego son ordenados mediante una funcion, luego son enviados por socket al html)

<canvas
      id="rollerCanvas"
      height="40px"
      style="border: 1px solid black; display:block; margin-left: auto;
      margin-right: auto;"
    ></canvas>

    <script>
      var socket = io();
      var canvas = document.getElementById("rollerCanvas");
      canvas.width = window.innerWidth * 0.475;
      var ctx = canvas.getContext("2d");
      ctx.font = "18px Calibri";
      ctx.textAlign = "center";

      var resultNum = -1;
      var offset;
      var currentList = ();
      var currentRollInterval;

      socket.on("newNumbers", function(data) {
        clearInterval(currentRollInterval);
        currentList = data.list;
        updateList();
        resultNum = -1;

        rollNums();
      });

      socket.on("GetResult", function(data) {
        resultNum = data.resultNum;
        offset = data.offset;
      });

      function rollNums() {
        let speed = 15;

        currentRollInterval = setInterval(function() {
          let found = false;

          if (resultNum !== -1) {
            for (let num of currentList) {
              if (num.value === resultNum) {
                let tmpspeed = (num.pos + offset - canvas.clientWidth / 2) / 70;
                if (tmpspeed < 15 && tmpspeed > 0) speed = tmpspeed;

                if (speed >= 0 && speed <= 0.01)
                  clearInterval(currentRollInterval);
              }
            }
          }

          for (let i = 0; i < currentList.length; i++) {
            currentList(i)("pos") -= speed;

            if (currentList(i).pos < -16) {
              if (i === 0) {
                currentList(i)("pos") = currentList(currentList.length - 1).pos + 48 - speed;
              } else {
                currentList(i)("pos") = currentList(i - 1).pos + 48;
              }
            }
          }

          updateList();
        }, 16);
      }

      function updateList() {
        ctx.fillStyle = "#330033";
        ctx.fillRect(0, 0, canvas.clientWidth, canvas.clientHeight);

        for (let num of currentList) {
          if (num.pos < canvas.clientWidth + 16) {
            //Background colour
            if (num.value === 0) {
              ctx.fillStyle = "#32CD32";
            } else if (num.value % 2 === 0) {
              ctx.fillStyle = "#CC0000";
            } else {
              ctx.fillStyle = "#000000";
            }
            ctx.fillRect(num.pos - 16, 4, 32, 28);

            ctx.fillStyle = "#FFFFFF";
            ctx.fillText(num.value, num.pos, 24);
          }
        }

        ctx.strokeStyle = "#FFFFFF";
        ctx.lineWidth = "2px";
        ctx.moveTo(canvas.clientWidth / 2, 0);
        ctx.lineTo(canvas.clientWidth / 2, 32);
        ctx.stroke();
      }
    </script>

google sheets – formate custom cell output from horizontal to vertical cells

I have the following table setup:

Date Time Name1 Name2
01.01.0001 15 Bob Emily
02.02.0002 21 Bob2

and I want to transform this into this:

Date Time Names
01.01.0001 15 Bob
Emily
02.02.0002 21 Bob2
03.03.0003

Without using any custom google script functions.
Is that possible?

film – Consistent black horizontal lines on colour negatives

A hair. Looks sharp enough that it could be on the film side of the shutter in which case getting it out should be easy. If it is on the other side of the shutter and your camera has an interchangeable lens, you should be able to get at it with removing the lens and putting up the mirror. If you don’t have an interchangeable lens, it might require convincing the camera to open shutter while the back is open. Don’t prod the shutter itself: it’s easy to bend the blades and that is bad news.

If you already reloaded the camera, you can either pray or rewind the film. It’s not likely to be a problem of development: if this happened while scanning the negative, the hair would show as white.

document library – Modern SharePoint Web Part – Remove Horizontal Scroll bar

I have a Document Library web part on my modern page in which I’d only like the users to see 4 of the 7 columns. I would normally hide the extra three columns, but due to a JSON script, they have to be visible. So my thinking is that If I can remove the horizontal scroll bar, the users won’t know those extra 3 columns are there.

Is there a way to remove the horizonal scroll bar on a Modern Document Library Web Part? I have a Modern Script Editor Web Part I could use if this task is doable.

Thank you,

Chris

reactjs – Adding a tooltip or horizontal marker to VictoryStack bar chart

I have created a VictoryStack bar chart and need to add a marker on the chart to indicate a user’s score. This is the current code:

<VictoryChart
    height={250}
    width={300}
    domainPadding={{x: (0, 125), y: (0, -50)}}
    domain={{x: (0,1), y: (0, 100)}}
>
    <VictoryStack
    colorScale={("#ee418980", "rgb(240, 240, 240)", "#00a9af7e")}
    style={{
        data: { width: 100 },
        labels: { padding: -33, fontSize: 12, fontFamily: "Arial, Helvetica, sans-serif" }
    }}
    labelComponent={
        <VictoryPortal>
            <VictoryLabel/>
        </VictoryPortal>
    }
    >
    <VictoryBar
        data={({x: 1, y: 33, label: "Disengaged"},)}
    />
    <VictoryBar
        data={({x: 1, y: 33, label: "Normal"},)}
    />
    <VictoryBar
        data={({x: 1, y: 33, label: "Engaged"},)}
    />

    </VictoryStack>
    <VictoryAxis
        crossAxis
        tickValues={("")}
    />
</VictoryChart>

And this is what the current version looks like:

VictoryStack current version

I now need to represent a score along the bar. How can I add a horizontal line or some type of callout on the bar to indicate a user’s score like this example?

VictoryStack ideal version

I can’t find a way to add another label to the existing labels that are shown on the VictoryBars. Is there a better alternative?

camera – Horizontal and vertical field of view calculation when principal point is not image center

I have a requirement to calculate the ground footprint for an aerial camera. I have the camera position and orientation. To calculate it, I require to calculate Horizontal Field of View (FoV) and vertical FoV. I found the formulas in calculating horizontal FoV and vertical FoV. But the formulas assume that the principal point is in the image center (I hope).

What are the correct formulas to apply when the principal point is not the image center? In my case, the principal point deviates from the image center.

Does principal point have an impact on calculating Horizontal FoV and Vertical FoV?

How in tailwindcss make modal dialog when page has horizontal scrolling?

Hello,
Basing on tailwindcss 2 modal example https://alpinetoolbox.com/examples/modal
I make modal dialog with setting max-h-screen class, like

<div class="overflow-auto" role="dialog" style="background-color: rgba(0,0,0,0.5)" x-show="showModal"
:class="{ 'absolute inset-0 z-50 flex items-center justify-center': showModal }"
@keydown.escape.window="showModal = false"
>
<!--Dialog-->
<div
class="flex flex-col sm:h-4/5 md:h-4/6 max-h-screen justify-between rounded shadow-lg py-4 text-left px-6 modal-container"
x-show="showModal" @click.away="showModal = false" x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 scale-90" x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="ease-in duration-300" x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-90">

HTML:

and it works ok, untill page has no horizontal scrolling.

If page has horizontal scrolling – then only part of the page is with modal and space below is
empty and this makes page
SEMrush

I also tried to use max-h-full instead of max-h-screen, but no effect.

How can I made it ?

Thanks!

 

How to make table with horizontal scrolling with tailwindcss 2.1?

I want to make table with horizontal scrolling for its content and
I try to use whitespace-nowrap class for table cells which have long content and
overflow-x-auto for all the table, like:

  <div class="editor_listing_wrapper_bix_width">


  <table class=" overflow-x-auto p-1 m-1 d2">
  <thead class="bg-gray-700 border-b-2 border-t-2 border-gray-300">
  <tr>
  <th class="w-1/12 py-2">Id</th>
  <th class="w-4/12 py-2">Name</th>
  <th class="w-4/12 py-2">Description</th>
  <th class="w-1/12 py-2"></th>
  </tr>
  </thead>
  <tbody>

  <tr>

  <td>1</td>
  <td class="whitespace-nowrap">
  Laptops
  <small class="pl-2 pt-1">
  ( Used in 2 ad(s) )
  </small>
  </td>

  <td class="whitespace-nowrap p-1">Laptops description Lorem ipsum dolor sit amet,
  consectetur
  adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
  aliqua....
  </td>

HTML:

But looks like horizontal scrolling is for all area, not for my table

Pls, take look at pen: https://codepen.io/sergeynilov/pen/eYgjVgM

I use tailwindcss 2.1.0.
SEMrush

Thanks!

 

python – How do i flip a vertical list to a horizontal list?

Create a function that flips a horizontal list into a vertical list, and a vertical list into a horizontal list.

In other words, take a 1 X 𝑛 list (1 row and n columns) and flip it into a 𝑛 X 1 list (n rows and 1 column) and vice versa.

# Take a horizontal list and flip it vertical.
 
flip_list(((5), (6), (9))) ➞ (5, 6, 9)
# Take a vertical list and flip it horizontal.
 
flip_list(()) ➞ ()

Flutter Horizontal ListView with Sticky Headers

How can I built a horizontal ListView with Sticky Headers like the following in Flutter?

example

For this example I used the sticky_infinite_list package. The problem is that it has no grouping built in, so I had to place a ListView/Row inside contentBuilder. This leads to bad performance, because the whole ListView/Row is rendered as soon as the beginning of it enters the cache area.