npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

actuate

v1.9.0

Published

Actuate is a flexible, fast "tween" library for animations

Downloads

18

Readme

MIT License Haxelib Version NPM Build Status

Actuate

Actuate is the best library for animating Haxe projects. Power through your everyday needs using no-nonsense, lightweight tweens, then extend when you need more, through the swappable custom actuator system

Installation

To install a release build:

haxelib install actuate

If you prefer to use development builds:

git clone https://github.com/jgranick/actuate
haxelib dev actuate actuate

To include Actuate in an OpenFL project, add <haxelib name="actuate" /> to your project.xml.

To add Actuate to a standard Haxe project, use -lib actuate in your HXML

Usage

It's simple to get started!

Actuate.tween (MySprite, 1, { alpha: 1 });

Actuate is designed to be simple to use and to take advantage strong code completion support in code editors like FlashDevelop, which means no more "reserved" keywords or "special" properties

Actuate.tween (MySprite, 1, { alpha: 1 }).onComplete (trace, "Hello World!");

Instance-based tweens can be a pain. When you don't keep track of each tween instance, you run the risk of creating conflicting tweens, which almost never turns out well. With first-class tween overwrite support, Actuate manages your tweens so you don't have to. Actuate also makes it simple to disable overwriting when you need to sequence multiple animations

Actuate.tween (MySprite, 1, { alpha: 1 });
Actuate.tween (MySprite, 1, { alpha: 0 }, false).delay (1);

It's also easy to stop, pause or resume your tweens, too

Actuate.stop (MySprite);
Actuate.stop (MySprite, "alpha");
Actuate.pauseAll ();
Actuate.pause (MySprite);
Actuate.pause (MySprite, MyOtherSprite);
Actuate.resumeAll ();
Actuate.resume (MySprite);
Actuate.resume (MySprite, MyOtherSprite);
Actuate.reset ();

There also are additional shortcuts you can use to help you be even more productive. For example, you can use Actuate to create quick tween-based timers for sequencing events

Actuate.timer (1).onComplete (trace, "Hello World!");

Or you can use the "apply" method to stop conflicting tweens and instantly set an object's properties

Actuate.apply (MySprite, { alpha: 1 });

Advanced Features

For advanced animations, you can also tween function calls instead of properties

Actuate.update (customResize, 1, [100, 100], [300, 300]);

Actuate also includes shortcuts for some special types of animation. Here is how you might apply a 50% tint using a color transform

Actuate.transform (MySprite, 1).color (0xFF0000, 0.5);

You can also control the volume and pan of a sound transform as well

Actuate.transform (MySprite, 1).sound (0.5, 1);
Actuate.transform (MySoundChannel, 1).sound (0.5, 1);

You can also tween filters. You can reference the filter by its class, or by the value of its index in the filter array, whichever is easier

Actuate.effects (MySprite, 1).filter (BlurFilter, { blurX: 10, blurY: 10 });

You even can create bezier curves, and complete motion paths, like in the Flash IDE. Chain multiple path commands together to create one solid path you can tween your objects across using the MotionPathActuator

var path = new MotionPath ()
  .bezier (100, 100, 50, 50)                 // quadratic, 1 control point
  .bezierN (200, 200, [50, 100], [50, 100])  // general, any number of control points
  .bezierSpline ([100, 100], [50, 50])       // spline, passing through the given points
  .line (20, 20);                            // linear
Actuate.motionPath (MySprite, 1, { x: path.x, y: path.y });

Tween Modifiers

Each tween Actuate creates can be modified with many different tween modifiers. You can link tween modifiers to add delay, complete handlers, or configure many different options about the way your tween behaves

autoVisible

Actuate.tween (MySprite, 1, { alpha: 1 }).autoVisible (false);

Changing the visible property results in better performance than only an alpha of zero, so the autoVisible modifier toggles the visible property automatically based upon the alpha value of the target. It is enabled by default, but it can be disabled if you choose

delay

Actuate.tween (MySprite, 1, { alpha: 1 }).delay (1);

Controls how many seconds should pass before your animation begins

ease

Actuate.tween (MySprite, 1, { alpha: 1 }).ease (Quad.easeOut);

Defines a custom easing equation for your animation. Actuate includes many popular easing functions in both standard and optimized formats. The default is Expo.easeOut, but you can change the default equation through Actuate.defaultEase

onComplete

Actuate.tween (MySprite, 1, { alpha: 1 }).onComplete (trace, "Tween finished");

Calls a function when the tween is finished. You can also define parameters to be used when calling the function

onRepeat

Actuate.tween (MySprite, 1, { alpha: 1 }).repeat().onRepeat (trace, ["Tween finished"]);

Calls a function when the tween repeats. You can also define parameters to be used when calling the function

onPause

Actuate.tween (MySprite, 1, { alpha: 1 }).repeat().onPause (trace, ["Tween paused"]);

Calls a function when the tween is paused. You can also define parameters to be used when calling the function

onResume

Actuate.tween (MySprite, 1, { alpha: 1 }).repeat().onResume (trace, ["Tween resumed"]);

Calls a function when the tween is resumed after being paused. You can also define parameters to be used when calling the function

onUpdate

Actuate.tween (MySprite, 1, { alpha: 1 }).onUpdate (trace, ["Tween updated"]);

Calls a function every time the tween updates. You can also define parameters to be used when calling the function

reflect

Actuate.tween (MySprite, 1, { alpha: 1 }).repeat ().reflect ();

Automatically reverses the animation every other time it is repeated. You must enable repeat in order to see any effect

repeat

Actuate.tween (MySprite, 1, { alpha: 1 }).repeat (10);

Runs your animation multiple times before it finishes. You can make your tween repeat indefinitely by passing no value, or you can define the number of times it should repeat

reverse

Actuate.tween (MySprite, 1, { alpha: 1 }).reverse ();

Reverses the direction of your tween

smartRotation

Actuate.tween (MySprite, 1, { rotation: 180 }).smartRotation ();

Rotation is circular, so it can be strange to animate. What should be positive one moment is negative the next. As a result, treating rotation like a standard tween will result in jerking once the signs change. Smart rotation always applies rotation in the nearest direction, alleviating this issue.

snapping

Actuate.tween (MySprite, 1, { alpha: 1 } ).snapping ();

Rounds all of your tween values