安博电竞官方网址 > 盖世电竞:单例模式演示代码

盖世电竞:单例模式演示代码

;In this tutorial, I will guide you towards this end result:盖世电竞 11. Open a new canvas 400px for both width and height. Give it a black (#000000) backgroundcolor.2. Hit 'D' (the button, not my colleague )3. Add a new layer and select the Elliptical Marquee Tool with fixed dimensions width=300px, height=300px. Click somewhere in the left corner.4. Hit Ctrl+Backspace. The circle now fills with white.5. Hit Ctrl+T and center the circle (x=200, y=200)盖世电竞 2

;Shiny glass orbs have been popular fixtures for web interfaces and application skins for quite some time. In this tutorial, we will be going over a technique for making a standard interface orb.

js的单例写法

盖世电竞 3

JS单例情势

  1. Open a new document (250x250 pixels was used in this example) and choose the Circular Marquee Tool. We need to first make a metallic background object, so hold Shift and create a circle. Create a new layer named One and fill your circle with dark gray (such as #333333). Keep your selection and make a new layer named Two above it. Go Select>Modify>Contract 2 pixels, then go Select>Modify>Feather 5 pixels. Select a middle gray (such as #666666) as your foreground color. Fill your selection by hitting Alt+Backspace (Mac: Option+Delete). Create a third layer above named Three while keeping your selection. Choose white as your foreground color and select the Linear Gradient Tool. Make sure the Foreground to Transparent setting is selected. Click and drag from the top to the bottom of the selection (holding Shift) to fill in the gradient. Last, to brighten it up a little more, duplicate Three by going Layer>Duplicate Layer, then hit Ctrl+E (Command+E) to merge the layer down. Phew, now that we have some metal, we can begin.

你是?(单例)

盖世电竞 4

你是?(普通)

  1. Create a new layer above what you have so far named Four. Use the Circular Marquee Tool to create a smaller circle (holding Shift). Fill the circle with a blue (such as #6699dd).

[Ctrl+A 全选 注:如需引进外界Js需刷新工夫试行]

盖世电竞 5

loop.js是叁个单例方式的js类:
//一同初就用new 无名氏类的情势开创。那样就兑现了单例的成效。
var loop = new (function(){
    // 外界公共函数
    // 无限循环的操作
    this.setloop =     function(fn){Infinite_loop.setLoopFn(fn);} // 参数 1 参数类型 function
    this.deleteloop =     function(fn){Infinite_loop.deleteLoopFn(fn);} // 参数 1 参数类型 function
    this.stoploop = function(){Infinite_loop.stopLoop();}
    // 单次循环的操作
    this.setloopOne =     function(fn){one_loop.setLoopOneFn(fn);} // 参数 1 参数类型 function
    this.stoploopOne = function(){one_loop.stopLoopOne();}   

  1. old Ctrl (Command) and click the new layer button to create a new layer below Four. Name this one SubFour. Go Select>Modify>Expand 2 pixels. Now click on and choose Gradient Fill. Use a black to white gradient with these settings. Turn the opacity of SubFour down to 80%.

    // 上面是七个民用的单例形式成员
    // Infiniti循环推行的List对象
    var    Infinite_loop = new (function(){
        this.loop_stop = true;
盖世电竞:单例模式演示代码。        this.loop_action = new Array();
        this.loop_actionID = 0;
        var opp = this;
        this.setLoopFn = function(fn){
                if(typeof(fn)!="function"){
                     throw new Error("window.loop.setloop's argment is not a function!"); return;
                   }
                for(var i=0;i<this.loop_action.length;i++){
                        if(this.loop_action[i] == fn){
                            throw new Error(fn+" has been registered !");
                            return;
                        }
                    }
                this.loop_action.push(fn);
                this.startLoop();
            };
        this.deleteLoopFn = function(fn){
                    for(var i=0;i<this.loop_action.length;i++){
                        if(this.loop_action[i] == fn){
                            this.loop_action.splice(i,1);
                        }
                    }
            };

盖世电竞 6

        this.Loop = function(){
            var run = function(){
                if(opp.loop_action.length > 0){
                    (opp.loop_action[opp.loop_actionID])();
                    opp.loop_actionID++;
                    if(opp.loop_actionID>=opp.loop_action.length)opp.loop_actionID=0;
                    setTimeout(opp.Loop,20);
                    return;
                }
                opp.loop_stop = true;
            };
            run();
        }

  1. Next, go back to layer Four, right-click it and apply a Blending Options Inner Glow with these settings. Then, apply an Inner Shadow with these settings. Now comes a rather experimental part. Create a new layer above Four called Dodge set the Blending Mode to Linear Dodge. Choose the Brush Tool with a 100 pixel brush with 10% Hardness and Flow of 40%. Hold Ctrl (Command) and click layer Four to load it as a selection. Choose a turquoise color (such as #2d8e97) and fill in this layer until you get a nice dodge effect. To do this, you will likely need to use some lighter colors as well for the bottom area. If needed, turn down the layer's opacity to around 80%. After you are satisfied, hit Ctrl+E to merge this layer into Four.

        this.stopLoop = function(){
            this.loop_stop = true;
        }
        this.startLoop = function(){
            if(! this.loop_stop)return;
            this.loop_stop = false;
            this.Loop();
        }
    })();

盖世电竞 7

    /* 单次推行的list对象 */
    var one_loop = new (function(){
        this.loopOne_stop = true;
        this.loopOne_action = new Array();
        var opp = this;
        this.setLoopOneFn = function(fn){
            if(typeof(fn)!="function"){
                   throw new Error("window.loop.setloopOne's argment is not a function!"); return;
              }
            this.loopOne_action.push(fn);
            this.startLoopOne();
        }
        this.LoopOne = function(){
                function run(){
                    if(opp.loopOne_action.length>0 && !opp.loopOne_stop){
                        (opp.loopOne_action.shift())();
                        setTimeout(opp.LoopOne,20);
                        return;
                    }
                    opp.loopOne_stop = true;
                }
                run();
            }
        this.stopLoopOne = function(){
            this.loopOne_stop = true;
        }
        this.startLoopOne = function(){
            if(盖世电竞,! this.loopOne_stop)return;
            this.loopOne_stop = false;
            this.LoopOne();
        }
    })();
})();

  1. Create a new layer on top called Five. Hold Ctrl (Command) and click on Four to load it as a selection. Fill this area with white. Hit Ctrl+D (Command+D) to deselect. Set the Blending Mode to Overlay. Hit Ctrl+T to bring up the Free Transform box. Hold Shift and shrink the selection from a bottom corner to look like the sample to the left. Go Filter>Blur>Gaussian Blur width a radius of 2.8 pixels. Decrease the layer's opacity to 40% or as necessary.

下边是实例:loop.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ";
<html xmlns=";
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>loop.js</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="loop.js"></script>
<script type="text/javascript">

盖世电竞 8

function moveLayer1(){
    this.moveleft = true;
    this.movedown = true;
    this.x1 = 100
    this.y1 = 100;
    this.x2 = 800;
    this.y2 = 400;

  1. Next, create a new layer on top called Six. Hold Ctrl (Command) and click Four to load it as a selection. Fill the selection with a light teal (such as #80f2e1). Hit Ctrl+D (Command+D). Hit Ctrl+T (Command+T) to pull up Free Transform and contract the shape to look like the picture to the left. Go Filter>Blur>Boxed Blur with a 5 pixel radius (if you have an older version of Photoshop, a Gaussian blur as done above will work). Set the Blending Mode of the layer to Soft Light and the opacity to 75%.

}