zoukankan      html  css  js  c++  java
  • 随机颜色画线

    import flash.events.MouseEvent;
    
    var darw:Boolean;
    stage.addEventListener(MouseEvent.MOUSE_DOWN,down);
    stage.addEventListener(MouseEvent.MOUSE_MOVE,Move);
    stage.addEventListener(MouseEvent.MOUSE_UP,up);
    
    function down(e:MouseEvent)
    {
    	darw = true;
    	var color:int=Math.random() * 0xffffff + 0xff000000
    	this.graphics.lineStyle(2,color,1);
    	this.graphics.moveTo(mouseX,mouseY);
    }
    
    function up(e:MouseEvent)
    {
    	darw = false
    }
    
    function Move(e:MouseEvent)
    {
    	if (darw)
    	{
    		this.graphics.lineTo(mouseX,mouseY);
    	}
    }
    
    
    package 
    {
    	import flash.display.MovieClip;
    	import flash.geom.ColorTransform;
    	import flash.events.*;
    	public class Star extends MovieClip
    	{
    		private var starColor:uint;
    		private var starRotation:Number;
    		public function Star()
    		{
    			this.starColor = Math.random() * 0xffffff;
    			var colorInfo:ColorTransform = this.transform.colorTransform;
    			colorInfo.color = this.starColor;
    			this.transform.colorTransform = colorInfo;
    			this.alpha = Math.random();
    			//Assign a random rotation speed
    			//this.starRotation = Math.random() * 10 - 5;
    			this.starRotation = Math.random() > 0.5 ? -1:1 * Math.random() * 5 + 5;
    			this.scaleX = Math.random();
    			this.scaleY = this.scaleX;
    			addEventListener(Event.ENTER_FRAME,rotateStar);
    		}
    		private function rotateStar(e:Event):void
    		{
    			this.rotation +=  this.starRotation;
    		}
    	}
    }
    
  • 相关阅读:
    游戏开发中——垂直同步、绘制效率、显示器刷新频率与帧率
    python 异常
    python 多文件知识
    python if,for,while
    python 算术运算
    1.英语单词笔记
    Java import的作用
    java基础点
    Eclipse Java注释模板设置详解
    Java文档注释详解
  • 原文地址:https://www.cnblogs.com/602147629/p/1989959.html
Copyright © 2011-2022 走看看