Git Product home page Git Product logo

Comments (10)

tjenkinson avatar tjenkinson commented on June 8, 2024

You need to do

import { Marquee, loop } from "dynamic-marquee";

and then drop the dynamicMarquee.โ€™s

from dynamic-marquee.

rakeshnayak360 avatar rakeshnayak360 commented on June 8, 2024

thank u. But what u mean by " drop dynamicMarquee 's ?

from dynamic-marquee.

rakeshnayak360 avatar rakeshnayak360 commented on June 8, 2024

i have one more doubt. How to give conditions that update the itemList after 'x' items?

Example:

cost array1 = ['a','b','c','d','e'];
const array2 = ['z'];

in this example, first loop array1. After completing array1 then start array2

how can achieve this?

from dynamic-marquee.

tjenkinson avatar tjenkinson commented on June 8, 2024

The thing you get back from loop has an update function on it that you can call at any point with an array of new functions with the new items

from dynamic-marquee.

rakeshnayak360 avatar rakeshnayak360 commented on June 8, 2024

But how do i know that array1 is completed ?

from dynamic-marquee.

rakeshnayak360 avatar rakeshnayak360 commented on June 8, 2024

const control = loop(marquee, array1);
After loop is ended
control.update([() => array2);

What i need is code for After loop is ended
How do i know that is loop has ended?

from dynamic-marquee.

tjenkinson avatar tjenkinson commented on June 8, 2024

Canโ€™t you have a single array that contains everything?

from dynamic-marquee.

rakeshnayak360 avatar rakeshnayak360 commented on June 8, 2024

cost array1 = ['a','b','c','d','e'];
const array2 = ['z'];

Result i wanted was (infinite 'z')
'a','b','c','d','e','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z','z'

from dynamic-marquee.

tjenkinson avatar tjenkinson commented on June 8, 2024

I don't think loop is the correct thing for this case then. You probably want something like

const items = ['a', 'b', 'c', 'd', 'e'];

marquee.onItemRequired(() => {
  const next = items[0];
  if (items.length > 1) items.shift();
  return next;
});

marquee.appendItem(items[0]);

and then you can do items.push('f') and this should always keep looping the last item.

from dynamic-marquee.

tjenkinson avatar tjenkinson commented on June 8, 2024

Something like https://stackblitz.com/edit/typescript-uzfjwd?file=index.ts

from dynamic-marquee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.