Rotating parts in EDC file

This snippet shows how to use maps in .edc files to rotate a part around another part.
collections {
   group {
		name: "main";
		parts{
			part {
    			name: "anchor";
                type: RECT;
                mouse_events: 1;
                description { 
                    state: "default" 0.0;
                    rel1.relative: 0.2 0.4; 
                    rel2.relative: 0.8 0.41;
                    color: 200 130 200 255;
                }
            }
	    	part {
			 	name: "rectangle";
                type: RECT;
                mouse_events: 1;
                description { 
                	state: "default" 0.0;
                    rel1.relative: 0.25 0.5; 
                    rel2.relative: 0.75 0.75;
                    color: 200 200 200 255;
                    map {
                       	on: 1;
                       	rotation.x: 0;
                       	rotation.center: "anchor";
                       	perspective_on: 1;
                    }
                }
                description { 
            	state: "rotated" 0.0;
					inherit: "default" 0.0;
					color: 200 200 200 255;
                    map {
                       	rotation.x: 360;
                    }
                }
            }
   	    }   
        programs {
            program {
                name: "animation1";
                signal: "mouse,down,*";
                source: "rectangle";
                action: STATE_SET "rotated" 0.0;
                transition: LINEAR 1.0;
                target: "rectangle";
                after: "animation2";
            }
            program {
                name: "animation2";
                action: STATE_SET "default" 0.0;
                target: "rectangle";
                after: "animation2";
            }
        }      
	}
}

Responses

0 Replies