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;
    		}
    	}
    }
    
  • 相关阅读:
    react-webpack
    react
    重置手机过程
    运用 Node-RED 开发 LoRa 应用
    IBM Node-RED 安装与使用教程
    Node-RED 入门教程:简介
    Thingsboard 3.0 修改 Title、默认语言、主题颜色
    Thingsboard 3.0 通过 tb-gateway 网关接入 MQTT 设备教程
    Thingsboard 入门学习笔记:属性
    ThingsBoard 3.0 版本发布
  • 原文地址:https://www.cnblogs.com/602147629/p/1989959.html
Copyright © 2011-2022 走看看