Clicking on a drop, a droplet is created in the mouse position and immediately dragged. Once created two of them (from different drops), on the release of the mouse, the hittest will be checked to see if any drop are overlapping. If positive, the current hittest would lead to a creation of a new tween for a specified “wave” and will start a function for the hittesting drops to flow down the screen. When out of sight, the drops will be removed, making it possible to create new ones. The flush buttons, simply resets the waves by creating a new tween bringing them to the initial position (off the stage).
Creation of new droplets:
They are created (at the mouse position) when clicking on one of the big drops, and with them a new function is created to make them immediately dragged.
function italydropfunction(e:MouseEvent)
{
if (numitaly == 0) {
numitaly++;
parent.highlight_ita.visible = true
witaly = new droplet();Â
witaly.x = stage.mouseX;
witaly.y = stage.mouseY;
addChild(witaly);
witaly.drop1.startDrag();
witaly.drop1.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
witaly.drop1.addEventListener(MouseEvent.MOUSE_UP, ihittester);Â
}
}
These are simply 5 circles, where only the first one is dragged by the mouse, while the rest just follow each other at different speeds.
stage.addEventListener(Event.ENTER_FRAME, moving);
function moving(evt:Event):void
{
new Tween(drop2, "x", Strong.easeOut, drop2.x, drop1.x, 0.02, true);
new Tween(drop2, "y", Strong.easeOut, drop2.y, drop1.y, 0.02, true);
new Tween(drop3, "x", Strong.easeOut, drop3.x, drop2.x, 0.02, true);
new Tween(drop3, "y", Strong.easeOut, drop3.y, drop2.y, 0.02, true);
new Tween(drop4, "x", Strong.easeOut, drop4.x, drop3.x, 0.01, true);
new Tween(drop4, "y", Strong.easeOut, drop4.y, drop3.y, 0.01, true);
new Tween(drop5, "x", Strong.easeOut, drop4.x, drop4.x, 0.01, true);
new Tween(drop5, "y", Strong.easeOut, drop4.y, drop4.y, 0.01, true);
new Tween(drop6, "x", Strong.easeOut, drop4.x, drop5.x, 0.01, true);
new Tween(drop6, "y", Strong.easeOut, drop4.y, drop5.y, 0.01, true);
}
When the mouse is released, it will check if there are any hits going on and what kind it is, with a hittest function. Based on which drops are hitting, a determined action will follow.
function uhittester (e:MouseEvent):void {
var uhittarget:MovieClip = e.currentTarget as MovieClip
// +italy
if (numitaly == 1){
if (uhittarget.hitTestObject(witaly.drop1)) {
trace("usage+italy!");
new Tween(parent.iuwave, "y", Strong.easeOut, parent.iuwave.y, 718.8, 30, false);
wusage.addEventListener(Event.ENTER_FRAME, ugodown)
witaly.addEventListener(Event.ENTER_FRAME, igodown)
}}
// (…)
}
Water look (and merging):
This is created just by putting all the drops under a same movieclip, and then adding some inner dropshadow and bevel filter to it.
var myBevel:BevelFilter = new BevelFilter();
myBevel.angle = 65;
myBevel.type = BitmapFilterType.INNER;
myBevel.distance = 6;
myBevel.highlightColor = 0x333333;
myBevel.shadowColor = 0xFFFFFF;
myBevel.blurX = 10;
myBevel.blurY = 10;
myBevel.quality = 0;
var myShadow:DropShadowFilter = new DropShadowFilter();
myShadow.distance = 10;
myShadow.color = 0x000000;
myShadow.blurX = 10;
myShadow.blurY = 10;
myShadow.quality = 3;
myShadow.angle = 275;
myShadow.inner = true;
myShadow.alpha = 0.82;
myShadow.quality = 0;
infographic.filters = [myBevel, myShadow];
Droplets continuously going down:
Are droplets like the other, by they have been added some random movements down (for different speeds) and to left or right.
function fl_GenerateRandomNumber(limit:Number):Number
{
var randomNumber:Number = Math.floor(Math.random()*(limit+1));
return randomNumber;
}
if (drop1.y < 0) {
new Tween(drop1, "x", Strong.easeOut, drop1.x, drop1.x + fl_GenerateRandomNumber(60) -30, 0.1, true);
new Tween(drop1, "y", Strong.easeOut, drop1.y, drop1.y + fl_GenerateRandomNumber(60), 0.1, true);