|License||CC BY-SA 4.0|
Easing library port of the Arduino Easing Library by Anthony Brown. This library ports the AVR port (Brown) from the original ActionScript easing functions (Penner). For more background and examples of the easing functions go to http://andybrown.me.uk/2010/12/05/animation-on-the-arduino-with-easing-functions/
Device OS Version:
This table is generated from an automated build. Success only indicates that the code compiled successfully.
This content is provided by the library maintainer and has not been validated or approved.
Easing library port of the Arduino Easing Library (Anthony Brown), for the Particle platform.
The Arduino Easing library itself is an AVR port of the original ActionScript easing functions (Robert Penner). For those of you who used to develop heavily in AS2/AS3, this will be very familiar to you as the Tweener classes. For more background and examples of the easing functions go to: http://andybrown.me.uk/2010/12/05/animation-on-the-arduino-with-easing-functions/
Refer to the basic example for a method that uses the SparkIntervalTimer library to trigger easing updates at regular time intervals. This is just one method to have time-accurate easing setup in your Particle device / Arduino.
It is up to you to implement your own approach to timing intervals, reversal (i.e. palindrome/yoyo animation); the role of this easing library is to calculate easing curve values.
See the examples folder for more details.
TODO: more examples
Import the library. Use the Particle library management interface to do this.
Instantiate an easing class according to your preference:
Besides a sine ease, you can also choose from:
BackEase easeObj; BounceEase easeObj; CircularEase easeObj; CubicEase easeObj; ElasticEase easeObj; ExponentialEase easeObj; LinearEase easeObj; QuadraticEase easeObj; QuarticEase easeObj; QuinticEase easeObj;
(Refer to http://andybrown.me.uk/2010/12/05/animation-on-the-arduino-with-easing-functions/ on what each easing type does)
Initialise the easing object by defining the duration, in seconds, needed of the easing operation. Typically this is done in
setup() or anywhere in your code right before the easing is triggered:
Next, define the magnitude of the easing range. This consequently determines the resolution of the easing function along with setDuration. Depending on use case, a good starting range is 100. This means your easing function will output values from 0.0 to 100.0. Setting setDuration to 1 will give you a normalised range (0. to 1.), although you will lose PLENTY of resolution.
Finally, calculate the eased position by calling the easeIn / easeOut / easeInOut function. This is typically called in some looping / animation routine in your code:
easedPosition = easeObj.easeInOut(t);
easedPosition is a previously declared double to store the eased range, and
t is a fractional increment between 0.0 and EASE_DUR (set in
Two of the easing methods allow further configuration:
setOvershoot(NUMBER) set the overshoot value. The higher the value the greater the overshoot.
setPeriod(NUMBER) set the period.
setAmplitude(NUMBER) set the amplitude.
Here's how you can make changes to this library and eventually contribute those changes back.
To get started, clone the library from GitHub to your local machine.
Change the name of the library in
library.properties to something different. You can add your name at then end.
Modify the sources in
After your changes are done you can upload them with
particle library upload or
Upload command in the IDE. This will create a private (only visible by you) library that you can use in other projects. Do
particle library add easing_myname to add the library to a project on your machine or add the easing_myname library to a project on the Web IDE or Desktop IDE.
At this point, you can create a GitHub pull request with your changes to the original library.
If you wish to make your library public, use
particle library publish or
Arduino Easing Library Copyright 2010 Andy Brown.
The contents of this repository is a derivative of Andy Brown's Arduino Easing Library. Copyright 2017 Chuan Khoo
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/