Giter Club home page Giter Club logo

stepperjs's Introduction

Hi there πŸ‘‹

  • I'm front-end engineer.
  • I’m currently working on NAVER WEBTOON corp.
  • I'm currently migrating the SeriesOn service to Next.js

Connect Me

  • facebook.com/coderifleman
  • instagram.com/uyeong21c

Presentations

stepperjs's People

Contributors

duyonglee avatar uyeong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

duyonglee

stepperjs's Issues

Create a reverse option.

import Stepper from 'stepperjs';

const stepper = new Stepper();

stepper.start({
    reverse: true,
    doing: (now) => {
        //   Time
        //    |    now => 1
        //    |    now => 0.9
        //    |    now => 0.8
        //    |    ...
        //    |    now => 0.1
        //    ↓    now => 0
    }
});

Create a reverse option.

import Stepper from 'stepperjs';

const stepper = new Stepper();

stepper.start({
    reverse: true,
    doing: (now) => {
        // Time
        //    |     now => 1
        //    |     now => 0.9
        //    |     now => 0.8
        //    |     ...
        //    |     now => 0.1
        //   ↓    now => 0
    }
});

Write TestCase of Stepper

Spec of Stepper

μ‚¬μš©μžλŠ” Stapper 클래슀의 μƒˆλ‘œμš΄ μΈμŠ€ν„΄μŠ€λ₯Ό 생성할 수 μžˆλ‹€.

  • new ν‚€μ›Œλ“œλ‘œ μΈμŠ€ν„΄μŠ€λ₯Ό μƒμ„±ν•˜λ©΄ μƒˆλ‘œμš΄ μΈμŠ€ν„΄μŠ€κ°€ μƒμ„±λœλ‹€.
  • μ˜΅μ…˜ 인자λ₯Ό μƒλž΅ν•˜λ©΄ κΈ°λ³Έ μ˜΅μ…˜μœΌλ‘œ μ„€μ •λœ μΈμŠ€ν„΄μŠ€κ°€ μƒμ„±λœλ‹€.
  • μ˜΅μ…˜ 인자λ₯Ό μ „λ‹¬ν•˜λ©΄ μ „λ‹¬ν•œ μ˜΅μ…˜μœΌλ‘œ μ„€μ •λœ μΈμŠ€ν„΄μŠ€κ°€ μƒμ„±λœλ‹€.

μ‚¬μš©μžλŠ” stepper 객체의 option() λ©”μ„œλ“œλ₯Ό μ΄μš©ν•΄ μ˜΅μ…˜ 값을 λ³€κ²½ν•  수 μžˆλ‹€.

  • μ˜΅μ…˜λͺ…κ³Ό 값을 μ „λ‹¬ν•˜λ©΄ μ§€μ •ν•œ μ˜΅μ…˜μ΄ λ³€κ²½λœλ‹€.
  • μ˜΅μ…˜λͺ…κ³Ό κ°’ 셋을 객체둜 μ „λ‹¬ν•˜λ©΄ μ—¬λŸ¬κ°œμ˜ μ˜΅μ…˜μ΄ μΌκ΄„λ‘œ λ³€κ²½λœλ‹€.

μ‚¬μš©μžλŠ” stepper 객체의 on() λ©”μ„œλ“œλ₯Ό μ΄μš©ν•΄ 이벀트 λ¦¬μŠ€λ„ˆλ₯Ό 등둝할 수 μžˆλ‹€.

  • 이벀트λͺ…κ³Ό λ¦¬μŠ€λ„ˆλ₯Ό μ „λ‹¬ν•˜λ©΄ μ§€μ •ν•œ 이벀트 λ¦¬μŠ€λ„ˆκ°€ λ“±λ‘λœλ‹€.
  • 이벀트λͺ…κ³Ό λ¦¬μŠ€λ„ˆ 셋을 객체둜 μ „λ‹¬ν•˜λ©΄ μ—¬λŸ¬κ°œμ˜ 이벀트 λ¦¬μŠ€λ„ˆκ°€ λ“±λ‘λœλ‹€.

μ‚¬μš©μžλŠ” stepper 객체의 off() λ©”μ„œλ“œλ₯Ό μ΄μš©ν•΄ 이벀트 λ¦¬μŠ€λ„ˆλ₯Ό ν•΄μ œν•  수 μžˆλ‹€.

  • 이벀트λͺ…κ³Ό λ¦¬μŠ€λ„ˆλ₯Ό μ „λ‹¬ν•˜λ©΄ μ§€μ •ν•œ 이벀트 λ¦¬μŠ€λ„ˆκ°€ ν•΄μ œλœλ‹€.
  • 아무것도 μ „λ‹¬ν•˜μ§€ μ•ŠμœΌλ©΄ 이벀트 λ¦¬μŠ€λ„ˆκ°€ λͺ¨λ‘ ν•΄μ œλœλ‹€.

μ‚¬μš©μžλŠ” stepper 객체의 start() λ©”μ„œλ“œλ₯Ό μ΄μš©ν•΄ progress 계산을 μ‹œμž‘ν•  수 μžˆλ‹€.

  • progress 계산이 μ‹œμž‘λ˜λ©΄ start μ΄λ²€νŠΈκ°€ λ°œμƒλœλ‹€.
  • duration을 1 이상 μ„€μ • ν–ˆμ„ λ•Œλ§Œ progress 계산이 μ‹œμž‘λœλ‹€.
  • 계산 쀑이 μƒνƒœκ°€ 아닐 λ•Œλ§Œ progress 계산이 μ‹œμž‘λœλ‹€.
  • progress 값이 λ°”λ€”λ•Œλ§ˆλ‹€ ν˜„μž¬ progress κ°’κ³Ό ν•¨κ»˜ update μ΄λ²€νŠΈκ°€ λ°œμƒλœλ‹€.
  • reverse μ˜΅μ…˜μ„ true둜 μ„€μ •ν•˜λ©΄ progress 값이 거꾸둜 κ³„μ‚°λœλ‹€.
  • loop μ˜΅μ…˜μ„ true둜 μ„€μ •ν•˜λ©΄ progress 계산이 λ°˜λ³΅λœλ‹€.
  • progress 계산이 λλ‚˜λ©΄ ended μ΄λ²€νŠΈκ°€ λ°œμƒλœλ‹€.
  • progress 계산이 λλ‚˜λ©΄ 더이상 update μ΄λ²€νŠΈκ°€ λ°œμƒν•˜μ§€ μ•ŠλŠ”λ‹€.

μ‚¬μš©μžλŠ” stepper 객체의 pause() λ©”μ„œλ“œλ₯Ό μ΄μš©ν•΄ progress 계산을 μΌμ‹œ 정지할 수 μžˆλ‹€.

  • progress 계산이 μΌμ‹œ 정지 되면 paused μ΄λ²€νŠΈκ°€ λ°œμƒλœλ‹€.
  • μΌμ‹œ 정지 μƒνƒœκ°€ 아닐 λ•Œλ§Œ progress 계산이 μΌμ‹œ μ •μ§€λœλ‹€.
  • progress 계산이 μΌμ‹œ μ •μ§€λ˜λ©΄ update μ΄λ²€νŠΈκ°€ λ°œμƒν•˜μ§€ μ•ŠλŠ”λ‹€.
  • μΌμ‹œ 정지 μƒνƒœμ—μ„œ play() λ©”μ„œλ“œλ₯Ό ν˜ΈμΆœν•˜λ©΄ progress 계산이 μ΄μ–΄μ„œ μ‹œμž‘λœλ‹€.

μ‚¬μš©μžλŠ” stepper 객체의 stop() λ©”μ„œλ“œλ₯Ό μ΄μš©ν•΄ progress 계산을 쀑지할 수 μžˆλ‹€.

  • progress 계산이 μ€‘μ§€λ˜λ©΄ stoped μ΄λ²€νŠΈκ°€ λ°œμƒλœλ‹€.
  • 쀑지 μƒνƒœκ°€ 아닐 λ•Œλ§Œ progress 계산이 μ€‘μ§€λœλ‹€.
  • progress 계산이 μ€‘μ§€λ˜λ©΄ 더이상 update μ΄λ²€νŠΈκ°€ λ°œμƒν•˜μ§€ μ•ŠλŠ”λ‹€.
  • μΌμ‹œ 쀑지 μƒνƒœμ—μ„œ stop() λ©”μ„œλ“œλ₯Ό ν˜ΈμΆœν•˜λ©΄ 계산이 μ€‘μ§€λœλ‹€.

example with just a ticker

I want to create a slideshow with stacked images that quickly change z-index via controlling that with JS. (like stop animate via images)

I though instead of just applying a setInterval to each image changing the z-index of each indididual image that another one is on top, I'd better use this.

is it a good use case?

How do I limit the amount of update ticks to be equal to the amount of images over a duration I choose?

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.