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;
    		}
    	}
    }
    
  • 相关阅读:
    hdfs 复制路径下所有文件
    吐槽scala
    scala
    spark 你要喧宾夺主么?好好干。
    信赖域算法
    scala shuffle
    自动梯度求解 反向传播算法的另外一种视角
    spark 2.0 Vector toBreeze
    自己玩的git
    js判断浏览器
  • 原文地址:https://www.cnblogs.com/602147629/p/1989959.html
Copyright © 2011-2022 走看看