• Stars
    star
    157
  • Rank 238,399 (Top 5 %)
  • Language Haxe
  • License
    MIT License
  • Created almost 13 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

More Repositories

1

openfl

The Open Flash Library for creative expression on the web, desktop, mobile and consoles.
Haxe
1,894
star
2

lime

A foundational Haxe framework for cross-platform development
JavaScript
752
star
3

starling

Known as the "Cross-Platform Game Engine", Starling is a popular Stage3D framework for OpenFL and Haxe
Haxe
235
star
4

away3d

An open source, real-time 3D engine for OpenFL
Haxe
207
star
5

box2d

Haxe port of Box2D, a popular rigid-body 2D physics engine
Haxe
95
star
6

openfl-samples

Haxelib-based OpenFL sample projects
Haxe
77
star
7

svg

Provides SVG parsing and rendering for OpenFL and Haxe
Haxe
68
star
8

openfl-animate-plugin

Custom plugin for Adobe Animate CC
C++
58
star
9

hxp

Write scripts in Haxe, and execute them on Windows, macOS or Linux
Haxe
55
star
10

dragonbones

Runtime support for DragonBones skeletal animation
Haxe
39
star
11

swf

Adds support for Flash SWF assets in OpenFL projects
Haxe
38
star
12

openfl-pixi

Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
Haxe
37
star
13

lime-vscode-extension

Visual Studio Code extension for OpenFL and Lime projects written in Haxe
Haxe
28
star
14

openfl-samples-ts

OpenFL sample projects (written in TypeScript)
TypeScript
21
star
15

openfl-samples-as3

OpenFL sample projects (written in ActionScript 3.0)
ActionScript
20
star
16

openfl-js

Wrapper to support OpenFL HTML5 development using TypeScript, Haxe, JavaScript or ActionScript 3.0
ActionScript
20
star
17

www.openfl.org

OpenFL website
HTML
17
star
18

OpenFLDevelopersGuide

Learn OpenFL fundamentals with this guide that covers the display list, events, rendering text, playing sounds and more
17
star
19

away3d-samples

Away3D sample projects for OpenFL and Haxe
Haxe
16
star
20

openfl-samples-es6

OpenFL sample projects (written in ES6+ JavaScript)
JavaScript
15
star
21

openfl-samples-haxe

OpenFL sample projects (written in Haxe, using NPM)
Haxe
14
star
22

feathers

Haxe
13
star
23

lime-samples

Lime sample projects
Haxe
13
star
24

lime.openfl.org

Lime website
SCSS
8
star
25

openfl-player

Haxe
7
star
26

robotlegs

A Haxe application framework for OpenFL
Haxe
7
star
27

http-server

Provides an http-server for Haxe projects
JavaScript
7
star
28

generator-openfl

Yeoman generator for OpenFL NPM-based projects in TypeScript, ES5, ES6, AS3, and Haxe
JavaScript
7
star
29

AS3ConversionGuide

6
star
30

tweener

A class for creating tweens in haxe - because there's infinity between 0 and 1.
Haxe
6
star
31

swiftsuspenders

Fast and light-weight IoC container for Haxe
Haxe
4
star
32

books.openfl.org

HTML
3
star
33

try.openfl.org

Create a new OpenFL test sandbox (currently a redirect)
HTML
3
star
34

swf-loader

SWF loader for OpenFL projects built with Webpack
JavaScript
3
star
35

libsdl

C
3
star
36

openfl-samples-es5

OpenFL sample projects (written in ES5 JavaScript)
JavaScript
3
star
37

builds.openfl.org

Builds (currently a redirect)
HTML
1
star
38

openfl-native

[deprecated] OpenFL native backend
Haxe
1
star
39

libopenal

C
1
star
40

liblzma

C
1
star
41

libharfbuzz

C++
1
star
42

libwebm

C++
1
star
43

libjpeg

C
1
star
44

libpng

C
1
star
45

libefsw

C++
1
star
46

libneko

C
1
star
47

libfreetype

C
1
star
48

libcairo

C
1
star
49

libtinyfiledialogs

C
1
star
50

libzlib

C
1
star
51

libvorbis

C
1
star
52

libvpx

C
1
star
53

libpixman

C
1
star
54

libogg

C
1
star
55

docs.openfl.org

Docs (currently a redirect)
HTML
1
star
56

libmojoal

C
1
star
57

lime-build

[deprecated] Headers and libraries to build lime from the source
C
1
star
58

api.openfl.org

API documentation for OpenFL, the Open Flash Library for the Haxe programming language
1
star