Re: [Vala] [Genie] Clutter sample problem
- From: Nicolas <c r n a wanadoo fr>
- To: vala-list gnome org
- Subject: Re: [Vala] [Genie] Clutter sample problem
- Date: Thu, 12 Nov 2009 19:06:08 +0100
Ok i found the solution, if someone interested :
[indent=4]
uses
Clutter
class ClutterDemo
animations : array of Animation
stage : Stage
rectangles : array of Rectangle
const colors : array of string = { "blanched almond", "OldLace",
"MistyRose", "White", "LavenderBlush", "CornflowerBlue", "chartreuse",
"chocolate", "light coral", "medium violet red", "LemonChiffon2",
"RosyBrown3" }
construct ()
stage = Stage.get_default ()
rectangles = new array of Rectangle[colors.length]
stage.hide.connect (Clutter.main_quit)
create_rectangles ()
stage.color = Clutter.Color () { alpha = 255 }
stage.show_all ()
def private create_rectangles ()
i : int = 0
while i < colors.length
var r = new Rectangle
r.width = r.height = stage.height / colors.length
r.color = Color.from_string (colors[i])
r.anchor_gravity = Gravity.CENTER
r.y = i * r.height + r.height / 2
stage.add_actor (r)
rectangles[i] = r
i++
def start ()
animations = new array of Animation[rectangles.length]
i : int = 0
while i < rectangles.length
animations[i] = rectangles[i].animate (AnimationMode.LINEAR,
5000, "x", stage.width / 2, "rotation-angle-z", 500.0)
animations[i].timeline.start ()
i++
animations[animations.length -
1].timeline.completed.connect(animate_with_text)
def animate_with_text ()
j : int = 0
var mytext = new Text.full ("Bitstream Vera Sans 25", "Clutter
say hello to Genie !", Color.from_string ("white"))
mytext.set_anchor_point_from_gravity (Gravity.CENTER)
mytext.x = stage.width / 2
mytext.y = -mytext.height
stage.add_actor (mytext)
mytext.show ()
var text_anim = mytext.animate (AnimationMode.EASE_OUT_BOUNCE,
3000, "y", stage.height / 2)
text_anim.timeline.start ()
while j < rectangles.length
animations[j] = rectangles[j].animate
(AnimationMode.EASE_OUT_BOUNCE, 3000, "x", Random.next_double () *
stage.width, "y", Random.next_double () * stage.height / 2 +
stage.height / 2, "rotation-angle-z", rectangles[j].rotation_angle_z,
"opacity", 0.0)
animations[j].timeline.start ()
j++
init
Clutter.init (ref args)
var demo = new ClutterDemo ()
demo.start ()
Clutter.main ()
Nicolas.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]