GTween beta 5 Released! Major rewrite.

I’ve just released GTween beta 5. As I previously mentioned, this release is a significant rewrite to the full tweening engine. It stabilizes much of the positioning logic, and makes it more predictable. It also involved some very significant changes to the API, and the introduction of two important new classes: GTweenTimeline, and GTweeny.

GTween specific enhancements include a reduction in size to 4.5kb, a more predictable positioning model, slightly enhanced performance, the ability to specify repeat counts, full read/write access to start and end property values, the ability to lock starting properties, and a clean up of the API and code.

To read more about GTween, check out some demos, or download the library, visit gskinner.com/libraries/gtween/. To get more information on what’s changed, check out the version history or the API documentation.

This was a major rewrite, which pretty much guarantees that it has introduced new bugs. Please feel free to provide bug reports and feedback in the comments below. I’m hoping the next release will be final, once this version has seen some testing, bug fixing, and revisions based on feedback.

Here’s a super simple demo, showing GTween’s ability to deal with interrupted tweens. When you click around, it simply sets new end properties on each tween, and the tween adapts to the new values (and hey, it looks kind of cool). Check out the home page for more complex demos.

Continue reading →

Synchronized Timeline Animations in GTween

Another new feature I’ve added to GTween beta 5 is support for synchronizing timeline animations with scripted tweens. This lets you ensure that animations will remain synched even if you change the framerate of your FLA or if you pause, reverse, repeat, or otherwise manipulate your tweens.

Here’s a simple demo of it in action. The run cycle and fire are frame by frame animations, all other animation is done with GTween. Notice how the run cycle always lines up exactly the same with the motion tweens (despite everything being time based) and how it pauses along with the rest of the animation. The fire is not synchronized, so it will continue to play when the tween pauses, and is affected by framerate.

Also worth noting: the fire’s visibility is controlled through another new feature of beta 5, which improves on progress points. Best part, its only a few lines of fairly readable code for this whole demo.

Continue reading →

Preview: GTween beta 5, Now With More Sequencing.

GTween beta 5 was originally going to consist of minor bug fixes, but it’s quickly become a low level rewrite of the entire tweening library. I’ve simplified a lot of the logic, added new features, increased performance, improved reliability, made the code more readable, and even slightly reduced file size.

It will be another week or so before it is released (still fixing bugs and addressing edge cases), but I thought I would post a quick demo showing the much more powerful and easy to use sequencing features in beta 5.

All of this animation is done with GTween. Notice that you can move the slider, or click on its track to jump to any position in the sequence, and everything will display properly for that position. Also note the blur filters on the buttons as they tween into position.

Continue reading →

Editable Multi-Field Text Flow in Flash!

TextFlowPro enables you to flow a series of text fields together so that they act as a single text container, and still allow users to select, edit, and copy/paste text between the textfields. It should work with any text formatting, including different text formatting on different fields. It even supports tabIndex.

In terms of the sheer number of problems I had to solve to get things working, this is one of the most complex classes I have released for free. I was originally going to release this as a commercial component alongside the Spelling Plus Library, but I never got it to a level of quality that I was happy with. While I think I could iron out the remaining bugs, I still don’t think it would reflect the quality I want our commercial offerings to show – there are simply too many player bugs, edge cases, and niggling user experience problems.

However, it represents a huge amount of work, and I didn’t want to just leave it to rot, so I’m releasing it in the hopes people can do really cool things with it. At the very least, I hope it serves as a crash course in working with some of the text metrics APIs in player 9. I’m more than happy to answer any questions about how it works in the comments below.

Here are a couple of simple demos to show what it can do. These will be familiar to you if you’ve checked out TextFlowLite or TextFlow, but these add one small thing: editing!

Continue reading →

Flowing Text Between TextFields with Orphans/Widows

The TextFlow class allows you to flow text between text fields easily in Flash player 9. It has configurable support for orphans and widows (lines left at the start and end of a field respectively), as well as a simple API for getting the “overflow” from any field (or the whole flow).

It builds on the TextFlowLite class I posted a few days ago, sharing the same functionality and adding the following APIs:

// change orphans and widows (defaults to 2):
myTextFlow.orphans = 3;
myTextFlow.widows = 2;
// get any text that overflows past the bottom of the last text field in the flow:
// this can be handy for paging.
myTextFlow.getOverflow();
// get the text that overflows past the 2nd text field in the flow:
myTextFlow.getOverflow(1);
// change the flow's text fields:
myTextFlow.textFields = [fld1,fld2,fld3];

Here are a couple of demos. The first is nearly identical to the demo for TextFlowLite, but it takes advantage of the getOverflow method to display a “more” indicator when the text overflows the last field. It also has orphans and widows set to 2, so you should never have a single line of text dangling at the top or bottom of a field.

Continue reading →

Multi Column Text in Flash 9: TextFlowLite

Ever wanted to be able to display multi-column text in Flash? What about text that spans multiple arbitrary text fields? Sure, Adobe’s Text Layout Framework will let you display multi column text, but it’s still in beta, not to mention that it’s a big, robust framework.

TextFlowLite is a simple, light-weight class that works in Flash Player 9 with standard text fields. It takes one line of code to link any number of text fields together so that the overflow of each textfield runs into the next. Likewise, it’s one line of code to change the text, or reflow it if the textfields are resized.

import com.gskinner.text.TextFlowLite;
// set up the TextFlow, by default it will use the text of the first field:
var tfl:TextFlowLite = new TextFlowLite([fld1,fld2,fl3]);
...
// change the text:
tfl.text = "my new text";
...
// change the size of a field, and reflow the text:
fld1.height += 20;
tfl.reflow();

I built this class about a year and a half ago while working on the Spelling Plus Library, and had meant to release it much earlier. It is part of a set including TextFlow (adds support for orphans and widows), and TextFlowPro (which includes support for selection, editing, copy/paste). I will release the other two for free when I have time to retest and clean them up (hopefully later this week).

Here’s a simple demo:
Continue reading →

GTween beta 4: Tweening Library

GTween beta 4 has been released! This is the final beta of the library, and I am only keeping it beta for this release because there is a chance I will toy with the API a little bit more, and I’d like to clean up the demos before final (right now they are an ugly mix of demo and test file).

The main new feature in this release is a more robust synchronization model which allows you to synchronize child tweens to the delay, beginning, end or duration of its parent. This release also includes the GTweenFilter class (<0.5kb) which a number of people have been patiently waiting for. I also patched a number of bugs, added a few more simple demos, and created a MultiTween class that allows you to tween multiple objects to either the same destination property values, or different values using a single tween instance. Both of the new classes should be useful, but they are also there to serve as templates for people interested in writing their own extensions to GTween. They are not required to work with GTween normally - still just a single class. Here is the full list of changes:

  • fixed a bug with autoHide (thanks to JTtheGeek)
  • fixed a bug with useSmartRotation and destination values over 360 (thanks to radicalFish)
  • added propertyTarget and getPropertyTarget(), to support GTweenFilter and other potential subclasses
  • renamed the static “ticker” property to “activeTicker” to prevent issues in some editors due to it being named the same as the instance property. (thanks to Thomas Brekelmans)
  • fixed a problem with progressPoints set to a position of 0 not firing (thanks to Toby Skinner)
  • moved event meta tags to before class declaration, so they show up properly in the API documentation (thanks to Jordi Boggiano)
  • updated .clone() to support .useSetSize and .useSnapping properties
  • modified .addChild() to accept GTween.TWEEN_PHASE, GTween.END, GTween.DURATION, GTween.BEGINNING as a second parameter, allow more complex synchronization options.
  • included GTweenFilter and MultiTween in package.

As always, you can view the latest documentation, and download the latest version of the library at gskinner.com/libraries/gtween/.