Java Reference
In-Depth Information
}
delteRotation = random.nextFloat()*.04;
rotate = random.nextInt(360);
}
public function update():Void{
currentStep--;
if (currentStep == 0){
delete this from (parent as Group).content;
} else{
rotate += delteRotation;
opacity = currentStep/totalSteps;
}
}
}
In Listing 9-10 we can see that Flare extends ImageView and shows the Image flareImage . The init
function sets the effect to a ColorAdjust with a random value; the value deltaRotation is also set to a random
value as well as the starting rotation. When the Timeline anim from the class DiscoStar calls the function
update , this class behaves much like some of the other particles we have looked at. First we check to see
whether the particle is done living as tracked by the value of currentStep . If the particle is still alive, it is
rotated a little bit, and it becomes more transparent. Figure 9-5 shows what one Flare looks like.
Figure 9-5. Source image for Flare
Search WWH ::




Custom Search