OL-ringer

X-posisjonen på musa bestemmer radiusen til sirklene.

Kildekoden

import flash.events.MouseEvent;

stage.addEventListener(MouseEvent.MOUSE_MOVE, tegnSirkel);

function tegnSirkel(e: MouseEvent) {
	var radius:int = 40;			// define radius
	var blue:uint = 0x0000ff;		// define colours
	var black:uint = 0x000000;
	var yellow:uint = 0xffff00;
	var green:uint = 0x00ff00;
	var red:uint = 0xff0000;
	
	radius = (e.stageX / 10) + 20;

	graphics.clear(); // clear screen before generating things
	graphics.lineStyle(radius / 9, blue, 1);	// change color
	graphics.drawCircle(stage.stageWidth / 2 - 2*(radius + (1/8) * radius), stage.stageHeight / 2,radius);	// draw circle
	
	graphics.lineStyle(radius / 9, yellow, 1);	// etc
	graphics.drawCircle(stage.stageWidth / 2 - (radius + (1/8) * radius),  stage.stageHeight / 2 + (radius + (1/8) * radius),radius);
	
	graphics.lineStyle(radius / 9, black, 1);
	graphics.drawCircle(stage.stageWidth / 2, stage.stageHeight / 2, radius);
	
	graphics.lineStyle(radius / 9, green, 1);
	graphics.drawCircle(stage.stageWidth / 2 + (radius + (1/8) * radius),  stage.stageHeight / 2 + (radius + (1/8) * radius),radius);
	
	graphics.lineStyle(radius / 9, red, 1);
	graphics.drawCircle(stage.stageWidth / 2 + 2*(radius + (1/8) * radius), stage.stageHeight / 2,radius);
}

Sist redigert: 10/11/2015 @ 13:16:23

Kommentarer

test
Skrevet av Neethan, 10/11/2015 @ 13:39:32.

Legg til en kommentar

Navn:
300
Prøv også disse Twitch emotes: ANELE BibleThump Kappa KappaPride OSfrog PJSalt PogChamp SMOrc
Hva er 19885 + 997?