Giter Club home page Giter Club logo

Comments (4)

nt4f04uNd avatar nt4f04uNd commented on June 17, 2024 1

@benjamindean yep, i just missed the thing that you have to either use duration and amplitude, or pattern and intensifies

all works fine for me now

but, i now i think you should either add assertions for that, or make another method and move the pattern vibration in there. current api is a little bit confusing imo

from flutter_vibration.

benjamindean avatar benjamindean commented on June 17, 2024

You have to provide the pattern for that. In you example, it'll vibrate only once.

from flutter_vibration.

nt4f04uNd avatar nt4f04uNd commented on June 17, 2024

@benjamindean so what's the correct code for the behavior i want to achieve?

i still don't understand
does intensifies automatically interpolate the vibration values and this code will be correct?

Vibration.vibrate(
  duration: duration,
  pattern: [0, duration],
  intensities: reverse ? const [255, 1] : const [1, 255],
);

or i have to specify all of them

final intensities = List.generate(255, (i) => i + 1);
Vibration.vibrate(
  duration: duration,
  // generates a pattern [0, 0.4, 0, 0.4, 0, 0.4, 0, 0.4, 0, 0.4, .......... ]
  pattern: List.generate(255 * 2, (i) => i).map((el) => el % 2 == 0 ? 0 : duration / 255).toList(),
  intensities: reverse ? intensities.reversed.toList() : intensities,
);

which is correct?

upd: it's not really easy to test on real device for me so i'm asking you to explain how this intended to work, and please, explicitly document this, it's not obvious at all

from flutter_vibration.

benjamindean avatar benjamindean commented on June 17, 2024

@nt4f04uNd Have you checked the examples in README? You should specify either duration or pattern in milliseconds with intensities list.

from flutter_vibration.

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.