efl/src/examples/edje/physics_basic.edc

87 lines
2.2 KiB
Plaintext

/* This example demonstrates the most basic usage of physics.
*
* To make a part behaves like a body in a physics simulation,
* all that is needed is to set its attribute part.physics_body
* to something different from NONE. For example, RIGID_BOX,
* or CLOTH. It will define the shape of the part, and how it
* will interact with the environment.
*
* The remaining body attributes should be set inside the physics
* block of description. In this example we are customizing
* the restitution, that is how much the body bounces, and friction.
*
* It can be tested with edje_player
* $ edje_player physics_basic.edj
*/
collections {
images {
image: "bubble-blue.png" COMP;
}
group {
name: "example_group";
parts {
part {
name: "background";
type: RECT;
physics_body: NONE;
description {
state: "default" 0.0;
color: 255 255 255 255; /* white */
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
}
}
part {
name: "red_box";
type: RECT;
physics_body: RIGID_BOX;
description {
state: "default" 0.0;
color: 255 0 0 255; /* red */
rel1.relative: 0.75 0.1;
rel2.relative: 0.95 0.3;
aspect: 1 1;
physics {
restitution: 0.85;
}
}
}
part {
name: "blue_circle";
type: IMAGE;
physics_body: RIGID_SPHERE;
description {
state: "default" 0.0;
rel1.relative: 0.25 0.1;
rel2.relative: 0.45 0.3;
aspect: 1 1;
image {
normal: "bubble-blue.png";
}
}
}
part {
name: "floor";
type: RECT;
physics_body: BOUNDARY_BOTTOM;
description {
state: "default" 0.0;
visible: 0;
physics {
restitution: 0.92;
friction: 0.6;
}
}
}
}
}
}