My favorites | Sign in
Project Logo
                
Search
for
Updated Jul 19, 2008 by dono...@hydrotik.com
HydroTween  
HydroTween is a multi-use tweening parser for Go developed by DonovanAdams.

Introduction

// Color Tweening!
HydroTween.go(mc, {color:0xFF0000}, 2, 0, Elastic.easeOut);

// Or reset back to the original color
HydroTween.go(mc, {color:HydroTween.RESET}, 2, 0, Elastic.easeOut);


// Fuse style sequencing!
var seq1:HydroSequence = new HydroSequence(
    {target:fusebox, x:320, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, Blur_blurX:8, Blur_blurY:8, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, color:0x0000FF, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, Blur_blurX:0, Blur_blurY:0, duration:.8, easing:Quadratic.easeInOut},
    {target:fusebox, x:400, duration:.5, easing:Quadratic.easeInOut}
);

seq1.addItem([{target:fusebox, rotation:270, duration:3, easing:Quadratic.easeInOut}, {func:trace, args:["HELLO WORLD"]}]);

seq1.start();

// Papervision3D Tweening!
// Call once to setup a 3D tweens renderer
HydroTween.init3D(renderer, scene, camera, viewport);

// Simple Papervision3D Tween
HydroTween.go(plane, {rotationX:100, z:500}, 2, 0, Elastic.easeOut);

HydroTween is a multi-use tweening parser for Go developed by DonovanAdams. It will tween individual targets, or you can use Fuse style sequencing. Currently HydroTween will tween the following properties:

  • alpha
  • Bevel_angle
  • Bevel_blurX
  • Bevel_blurY
  • Bevel_color
  • Bevel_distance
  • Bevel_highlightAlpha
  • Bevel_highlightColor
  • Bevel_quality
  • Bevel_shadowAlpha
  • Bevel_shadowColor
  • Bevel_strength
  • Blur_blurX
  • Blur_blurY
  • Blur_quality
  • brightness
  • color
  • contrast
  • DropShadow_alpha
  • DropShadow_angle
  • DropShadow_blurX
  • DropShadow_blurY
  • DropShadow_color
  • DropShadow_distance
  • DropShadow_quality
  • DropShadow_strength
  • Glow_alpha
  • Glow_blurX
  • Glow_blurY
  • Glow_color
  • Glow_quality
  • Glow_strength
  • height
  • hue
  • pan
  • rotation
  • rotationX (PV3D)
  • rotationY (PV3D)
  • rotationZ (PV3D)
  • saturation
  • scaleX
  • scaleY
  • scaleZ (PV3D)
  • text
  • tint
  • volume
  • width
  • x
  • y
  • z (PV3D)

More info can be found at Hydrotik

Tweening Examples

General:

HydroTween.go(mc, {x:400}, 2, 0, Elastic.easeOut);

Start Values (Currently only works with NON image/bitmap matric properties:

HydroTween.go(mc, {start_x:100, x:400}, 2, 0, Elastic.easeOut);

Filter:

HydroTween.go(mc, {Glow_color:0x0000FF, Glow_blurX:8, Glow_blurY:8, Glow_strength:3}, 2, 0, Elastic.easeOut);

Image/Bitmap/ColorMatrix:

// Brightness
HydroTween.go(mc, {brightness:2}, 2, 0, Elastic.easeOut);
// Contrast
HydroTween.go(mc, {contrast:2}, 2, 0, Elastic.easeOut);
// Hue
HydroTween.go(mc, {hue:45}, 2, 0, Elastic.easeOut);
// Saturation
HydroTween.go(mc, {saturation:-1}, 2, 0, Elastic.easeOut);
// Tint
HydroTween.go(mc, {tint:0x00FF00}, 2, 0, Elastic.easeOut);
// Color
HydroTween.go(mc, {color:0xFF0000}, 2, 0, Elastic.easeOut);
// Color Reset (This will tween back to it's original value
HydroTween.go(mc, {color:-1}, 2, 0, Elastic.easeOut);

Matrix tweening (for array values such as sepia, etc) should make a return in the next update as well as a tint percentage value.

Sound:

// Volume
HydroTween.go(soundchannel, {volume:.1}, 2, 0, Elastic.easeOut);
// Contrast
HydroTween.go(soundchannel, {pan:-1}, 2, 0, Elastic.easeOut);

Sound tweening takes the SoundChannel instance as a target.

Text:

HydroTween.go(textfield, {text:100}, 2, 0, Elastic.easeOut);

This simply tweens the number from 0 to whatever param is specified and outputs to a textfield. I hope to expand on the functionality of this soon.

Using Callbacks and Updaters:

// Complete Callback
HydroTween.go(textfield, {text:100}, 2, 0, Elastic.easeOut, onCompleteHandler);
// Update Callback
HydroTween.go(textfield, {text:100}, 2, 0, Elastic.easeOut, null, onUpdateHandler);

Fuse style Sequence Tweening:

var seq1:HydroSequence = new HydroSequence(
    {target:fusebox, x:320, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, Blur_blurX:8, Blur_blurY:8, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, color:0x0000FF, duration:1, easing:Quadratic.easeInOut},
    {target:fusebox, Blur_blurX:0, Blur_blurY:0, duration:.8, easing:Quadratic.easeInOut},
    {target:fusebox, x:400, duration:.5, easing:Quadratic.easeInOut}
);

seq1.addItem([{target:fusebox, rotation:270, duration:3, easing:Quadratic.easeInOut}, {func:trace, args:["HELLO WORLD"]}]);

seq1.start();

Autostart: AUTOSTART is a parameter that enables easy coding of a tween. For example:

HydroTween.go(mc, {x:400}, 2, 0, Elastic.easeOut);

Comment by gilbuns, Jun 20, 2008

NOTE: The latest version of HydroTween does not support the "seconds" attribute. Use "duration" instead.

Comment by yfk29tnc, Jun 15, 2009

// Color Reset (This will tween back to it's original value HydroTween.go(mc, {color:-1}, 2, 0, Elastic.easeOut);

doesn't work for me.. turns it white instead of sprite original color


Sign in to add a comment
Hosted by Google Code