canvas

canvas動(dòng)畫(huà)思想

export class AppComponent implements OnInit{
  canvas
  ctx
  left=100
  ngOnInit(): void {
    this.canvas  = document.getElementById("canvas")
    this.ctx = this.canvas.getContext("2d")
    this.ctx.fillStyle = "blue"
    //this.ctx.fillRect(100,100,100,100)
   setInterval(()=>{
     this.ctx.clearRect(0,0,300,300)
     this.left++
     this.ctx.fillRect(this.left,100,100,100)
   },100)
    
    console.log(this.ctx)
  }
}

canvas 面向?qū)ο笏枷?/h3>
export class AppComponent implements OnInit{
  canvas
  ctx
  ngOnInit(): void {
    //獲取畫(huà)布
    this.canvas  = document.getElementById("canvas")
    //獲取上下文
    this.ctx = this.canvas.getContext("2d")
    //維護(hù)方法
    function Rect(x,y,w,h,color){
        this.x= x;
        this.y= y;
        this.w = w;
        this.h=h;
        this.color =color;
    }
    //更新方法察净,x坐標(biāo)加1(改變圖形位置)
    Rect.prototype.update = function(){
        this.x++;
    }
    //渲染方法
    Rect.prototype.render = function(){
      this.bind.ctx.fillStyle = "blue"
      this.bind.ctx.fillRect(100,100,50,50,);
    }
    var r1 = new Rect(100,100,50,50,"blue")
   setInterval(()=>{
     this.ctx.clearRect(0,0,this.canvas.whdth,this.canvas.height)
     r1.update()
     r1.render()
     
    //  console.log("hello")
   },1000)
    
    console.log(this.ctx)
  }
}

繪制矩形、直線

  • 填充矩形
export class AppComponent implements OnInit{
  canvas
  ctx
  ngOnInit(): void {
    //獲取畫(huà)布
    this.canvas  = document.getElementById("canvas")
    //獲取上下文
    this.ctx = this.canvas.getContext("2d")
    //填充顏色
    this.ctx.fillStyle = "blue"
    //開(kāi)始繪制填充矩形
    this.ctx.fillRect(100,100,100,100)
    console.log(this.ctx)
  }
}
  • 矩形邊框
export class AppComponent implements OnInit{
  canvas
  ctx
  ngOnInit(): void {
    //獲取畫(huà)布
    this.canvas  = document.getElementById("canvas")
    //獲取上下文
    this.ctx = this.canvas.getContext("2d")
    //邊框顏色
    this.ctx.strokeStyle="red"
    //開(kāi)始繪制
    this.ctx.strokeRect(100,100,100,100)
    console.log(this.ctx)
  }
}

擦除畫(huà)布

this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)
  • 繪制路徑
    (逆時(shí)針繪制)
export class AppComponent implements OnInit{
  canvas
  ctx
  ngOnInit(): void {
    //獲取畫(huà)布
    this.canvas  = document.getElementById("canvas")
    //獲取上下文
    this.ctx = this.canvas.getContext("2d")
    //創(chuàng)建一個(gè)路徑
    this.ctx.beginPath()
    //移動(dòng)畫(huà)筆繪制點(diǎn)
    this.ctx.moveTo(100,100)
    //描述行進(jìn)路徑節(jié)點(diǎn)
    this.ctx.lineTo(200,200)
    this.ctx.lineTo(400,180)
    this.ctx.lineTo(380,50)
    //封閉路徑
    this.ctx.closePath()
    //畫(huà)筆顏色
    this.ctx.strokeStyle = 'red'
    //開(kāi)始繪制
    this.ctx.stroke()
  }
}

線條可以不封閉---this.ctx.closePath()锅必,但fill會(huì)自動(dòng)封閉


image.png

繪制圓弧

export class AppComponent implements OnInit{
  canvas
  ctx
  ngOnInit(): void {
    //獲取畫(huà)布
    this.canvas  = document.getElementById("canvas")
    //獲取上下文
    this.ctx = this.canvas.getContext("2d")
    this.ctx.arc(200,200,100,0,2*Math.PI,false)
    //this.ctx.arc(200,200,100,0,2*3.14,false)
    
    this.ctx.fill()    //填充
    // this.ctx.stroke()      //邊框
    
  }
}

鼠標(biāo)炫彩小球效果

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            canvas{
                border: 1px solid #000;
            }
        </style>
    </head>
    <body>
        <canvas id="myCanvas" width="800" height="500"></canvas>
        <script type="text/javascript">
            var canvas = document.getElementById("myCanvas")
            var ctx = canvas.getContext("2d")
            //console.log(ctx)
            function Ball(x,y,r){
                this.x = x;
                this.y = y;
                this.r = r;
                this.color = getRandom();
                this.dx = parseInt(Math.random()*10)-5;//(0事格,10)-5 = (-5,5)
                this.dy = parseInt(Math.random()*10)-5;
                ballArr.push(this)
                console.log(this)
            }
            Ball.prototype.update = function(){
                this.x += this.dx;
                this.y += this.dy;
                this.r -= 0.4;
                if(this.r<0){
                    this.remove()
                }
            };
            Ball.prototype.remove = function(){
                for(var i=0;i<ballArr.length;i++){
                    if(ballArr[i]==this){
                        ballArr.splice(i,1);
                    }
                }
            };
            Ball.prototype.render = function(){
                ctx.beginPath()
                ctx.arc(this.x,this.y,this.r,0 ,Math.PI*2,false)
                ctx.fillStyle = this.color;
                ctx.fill()
            }
            //監(jiān)聽(tīng)canvas搞隐,傳人當(dāng)前x驹愚、y軸偏移和繪圖半徑
            canvas.addEventListener("mousemove",function(event){
                new Ball(event.offsetX,event.offsetY,30)
            })
            
            var ballArr = []
            setInterval(function(){
                ctx.clearRect(0,0,canvas.width,canvas.height)               
                for(var i=0;i<ballArr.length;i++){
                    ballArr[i].update()
                    if(ballArr[i]){
                        ballArr[i].render()
                    }   
                }
            },100)
            
            //產(chǎn)生一個(gè)隨機(jī)的16進(jìn)制顏色
            function getRandom(){
                var allType = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f";
                var allTypeArr = allType.split(",")
                //console.log(allTypeArr)
                var color = "#"
                for(var i =0;i<6;i++){
                    var random = parseInt(Math.random()*allTypeArr.length);
                    color+=allTypeArr[random];  
                }
                return color;
            }
            console.log(getRandom())
        </script>
    </body>
</html>

小球觸邊反彈

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
             canvas{
                 display: block;
                 border: 1px solid #000000;
             }
        </style>
    </head>
    <body>
        <canvas id="mycanvas" width="" height=""></canvas>
        <script type="text/javascript">
            var canvas = document.getElementById("mycanvas")
            var ctx=canvas.getContext("2d");
            console.log(ctx)
            canvas.width = document.documentElement.clientWidth-30;
            canvas.height = document.documentElement.clientHeight-30;
            //console.log(canvas.width,canvas.height)
            function Ball(){ 
                this.x = parseInt(Math.random()*canvas.width);
                this.y = parseInt(Math.random()*canvas.height);
                //console.log(this.x,this.y)
                this.color = "blue";
                this.r = 10;
                this.dx = parseInt(Math.random()*10)-5;
                this.dy = parseInt(Math.random()*10)-5;
                //console.log(this.dx,this.dy)
                ballArr.push(this);
            }
            Ball.prototype.update = function(){
                this.x += this.dx;
                this.y += this.dy;
                if(this.x < this.r || this.x >canvas.width-this.r){
                    this.dx = -this.dx
                }
                if(this.y < this.r || this.y > canvas.height-this.r){
                    this.dy = -this.dy
                }
            }
            Ball.prototype.render = function(){
                ctx.beginPath();
                ctx.globalAlpha = 1;
                ctx.arc(this.x,this.y,this.r,0,Math.PI*2,false);
                ctx.fillStyle = this.color;
                ctx.fill();
            }
            var ballArr = [];
            for(var i =0;i<20;i++){
                new Ball()
            }
            setInterval(function(){
                ctx.clearRect(0,0,canvas.width,canvas.height)
                for(var i = 0;i<ballArr.length;i++){
                    ballArr[i].update()
                    ballArr[i].render()
                }
            },20)
            
        </script>
    </body>
</html>

小球靠近連線

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
             canvas{
                 display: block;
                 border: 1px solid #000000;
             }
        </style>
    </head>
    <body>
        <canvas id="mycanvas" width="" height=""></canvas>
        <script type="text/javascript">
            var canvas = document.getElementById("mycanvas")
            var ctx=canvas.getContext("2d");
            console.log(ctx)
            canvas.width = document.documentElement.clientWidth-30;
            canvas.height = document.documentElement.clientHeight-30;
            //console.log(canvas.width,canvas.height)
            function Ball(){ 
                this.x = parseInt(Math.random()*canvas.width);
                this.y = parseInt(Math.random()*canvas.height);
                //console.log(this.x,this.y)
                this.color = "blue";
                this.r = 10;
                this.dx = parseInt(Math.random()*10)-5;
                this.dy = parseInt(Math.random()*10)-5;
                //console.log(this.dx,this.dy)
                ballArr.push(this);
                this.index = ballArr.length - 1;
            }
            Ball.prototype.update = function(){
                this.x += this.dx;
                this.y += this.dy;
                if(this.x < this.r || this.x >canvas.width-this.r){
                    this.dx = -this.dx
                }
                if(this.y < this.r || this.y > canvas.height-this.r){
                    this.dy = -this.dy
                }
            }
            Ball.prototype.render = function(){
                ctx.beginPath();
                ctx.globalAlpha = 1;
                ctx.arc(this.x,this.y,this.r,0,Math.PI*2,false);
                ctx.fillStyle = this.color;
                ctx.fill();
                
                for(var i= this.index;i < ballArr.length;i++){
                    if(Math.abs(ballArr[i].x - this.x) < 150&&Math.abs(ballArr[i].y-this.y )< 150){
                        ctx.strokeStyle = "#000000";
                        ctx.globalAlpha = 10 / Math.sqrt(Math.pow(ballArr[i].x-this.x,2)+Math.pow(ballArr[i].x - this.x,2))
                        ctx.beginPath();
                        ctx.moveTo(this.x,this.y);
                        ctx.lineTo(ballArr[i].x,ballArr[i].y);
                        ctx.closePath()
                        ctx.stroke()
                    }
                }
            }
            var ballArr = [];
            for(var i =0;i<20;i++){
                new Ball()
            }
            setInterval(function(){
                ctx.clearRect(0,0,canvas.width,canvas.height)
                for(var i = 0;i<ballArr.length;i++){
                    ballArr[i].update()
                    ballArr[i].render()
                }
            },20)
            
        </script>
    </body>
</html>

線型

渲染圖片到畫(huà)布

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas{
            border: 1px solid #000;
        }
    </style>
</head>
<body>
    <canvas id="mycanva" width="700" height="700"></canvas>
    <script>
        var canvas = document.getElementById("mycanva")
        var ctx = canvas.getContext("2d")
        var image = new Image()
        image.src = "./star.jpg"
        console.log(image.src)
        image.onload = function(){
            ctx.drawImage(image,100,100,50,50)
        } 
    </script>
</body>
</html>

資源管理器的封裝

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <canvas id="" width="600" height="500"></canvas>
        <script type="text/javascript">
            function Game(){
                this.dom = document.querySelector("canvas");
                this.ctx = dom.getContextP("2d");
                //添加屬性,保持圖片地址
                this.R = {
                    "gugong":"./images/0.jpg",
                    "niaochao":"./images/1.jpg",
                    "yiheyuan":"./images/2.jpg",
                    "tiantan":"./images/3.jpg",
                    "guojiadajuyuan":"./images/4.jpg"
                };
                //獲取資源圖片總數(shù)
                var allAmount = Object.keys(this.R).length;
                console.log(allAmount)
                //計(jì)數(shù)器(記錄加載完畢的數(shù)量)
                var count = 0;
                for(k in this.R){
                    //備份每一張圖片的地址
                    var src = this.R[k];
                    //創(chuàng)建一張圖片
                    this.R[k] = new Image();
                    //賦值src圖片地址
                    this.R[k].src = src;
                    //
                    this.R[k].onload = function(){
                        count++;
                        //console.log(count,allAmount)
                        //清屏
                        self.ctx.clearRect(0,0,600,500)
                        self.ctx.font = "16px Arial";
                        //設(shè)置資源加載文案
                        self.ctx.fillText("圖片已經(jīng)加載:" + cuont + "/“ + allAmount,10,50)
                        //
                        if(count == allAmount){
                            self.start();
                        }
                    }
                }
            }
            Game.prototype.start = function(){
                var self = this;
                this.ctx.drawImage(this.R["gugong"],200,200,100,80)
                //開(kāi)啟定時(shí)器
                //
            }
            console.log(new Game)
            
        </script>
    </body>
</html>

變形

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <canvas id="" width="600" height="500"></canvas>
        <script type="text/javascript">
            function draw(){
                var dom = document.querySelector("canvas");
                var ctx = dom.getContext("2d");
                
                ctx.fillRect(0,0,150,150);
                ctx.save() //保存
                
                ctx.fillStyle = '#09f'
                ctx.fillRect(15,15,120,120)
                ctx.save()//保存
                
                ctx.fillStyle = '#fff'
                ctx.fillRect(30,30,90,90)
                // ctx.save()
                
                ctx.restore()  //撤銷
                ctx.fillRect(45,45,60,60)
                
                ctx.restore()  //撤銷
                ctx.fillRect(60,60,30,30)
            }
            draw()
            
        </script>
    </body>
</html>


<canvas id="" width="600" height="500"></canvas>
        <script type="text/javascript">
            function draw(){
                var dom = document.querySelector("canvas");
                var ctx = dom.getContext("2d");
                
                ctx.save()
                ctx.translate(50,50)
                ctx.fillRect(0,0,120,120)
                
                ctx.restore()
                ctx.fillRect(0,200,120,120)
            }
            draw()
            
        </script>

刮刮樂(lè)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            position: relative;
            width: 300px;
            height: 70px;
            border: 1px solid #000;
            margin: 100px;
            text-align: center;
            line-height: 70px;
            font-size: 30px;
        }
        canvas{
            position: absolute;
            left: 0;
            top: 0%;
            /* background-color: #000; */
        }
    </style>
</head>
<body>
    <div class="box">
        中獎(jiǎng)100萬(wàn)
        <canvas id="" width="300" height="70"></canvas>
    </div>
    <script>
        var canvas = document.querySelector("canvas")
        var ctx = canvas.getContext("2d")
        ctx.fillStyle = "#000"
        ctx.fillRect(0,0,300,70)
        ctx.globalCompositeOperation = "destination-out"
        canvas.onmousedown = function(){
            console.log("鼠標(biāo)按下")
            canvas.onmousemove = function(){
                console.log("拖動(dòng)了")
                ctx.beginPath()
                ctx.arc(event.offsetX,event.offsetY,10,0,7,false)
                ctx.fill()
            }
        }
    </script>
</body>
</html>

拖拽

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas{
            position: absolute;
            left: 0;
            top: 0%;
            border: 1px solid #000;
            /* background-color: #000; */
        }
    </style>
</head>
<body>
    <canvas id="" width="500" height="500"></canvas>
    <script>
        var canvas = document.querySelector("canvas")
        var ctx = canvas.getContext("2d")

        const statusConfig = {
            IDLE:0,
            DRAG_START:1,
            DRAGGING:2,
        }
        const canvasInfo = {
            status:statusConfig.IDLE,
            dragTraget:null,
            lastEvtPos:{x:null,y:null},
            offsetEvtpos:{x:null,y:null}
        }
        const circles = []
        const drawCircle = (ctx,cx,cy,r)=>{
            ctx.save()
            ctx.beginPath()

            ctx.strokeStyle = 'blue'
            ctx.arc(cx,cy,r,0,Math.PI*2)
            ctx.stroke()

            ctx.closePath()
            ctx.restore()
        }
        
        drawCircle(ctx,100,100,20)
        circles.push({
            x:100,
            y:100,
            r:20
        })
        drawCircle(ctx,200,200,10)
        circles.push({
            x:200,
            y:200,
            r:10
        })
       // console.log(circles)
        const getCanvansPosition= e=>{
            return {
                x:e.offsetX,
                y:e.offsetY
            }
        }
        const getDistance = (p1,p2)=>{
            return Math.sqrt((p1.x-p2.x)**2+(p1.y-p2.y)**2)
        }
        const ifInCircle=(pos)=>{
            for(let i = 0;i < circles.length;i++){
                if(getDistance(circles[i],pos) < circles[i].r){
                    return circles[i]
                }
            }
            return false
        }
        canvas.addEventListener('mousedown',e=>{
            //console.log( getCanvansPosition(e))
            const canvasPosition = getCanvansPosition(e)
            // console.log(ifInCircle(canvasPosition))
            const circleRef = ifInCircle(canvasPosition)
            if(circleRef){
                canvasInfo.dragTraget = circleRef;
                canvasInfo.status = statusConfig.DRAG_START
                canvasInfo.lastEvtPos = canvasPosition
                //console.log(circles)
                canvasInfo.offsetEvtpos = canvasPosition

            }
        })
        canvas.addEventListener('mousemove',e =>{
            const canvasPosition = getCanvansPosition(e)
            if(ifInCircle(canvasPosition)){
                canvas.style.cursor = 'all-scroll'
            }else{
                canvas.style.cursor =''
            }
            // const canvasPosition = getCanvansPosition(e)
            if(canvasInfo.status ===statusConfig.DRAG_START&&getDistance(canvasPosition,canvasInfo.lastEvtPos)>5){
                console.log("dlksfjslk")
                canvasInfo.status = statusConfig.DRAGGING
                canvasInfo.offsetEvtpos = canvasPosition
            }else if(canvasInfo.status === statusConfig.DRAGGING){
                console.log('dragging')
                // const {dragTarget} = canvasInfo
                console.log("999999999999",canvasInfo)
                canvasInfo.dragTraget.x += (canvasPosition.x - canvasInfo.offsetEvtpos.x)
                canvasInfo.dragTraget.y += ( canvasPosition.y - canvasInfo.offsetEvtpos.y)
                ctx.clearRect(0,0,canvas.width,canvas.height)
                circles.forEach(c=>drawCircle(ctx,c.x,c.y,c.r))
                canvasInfo.offsetEvtpos = canvasPosition
            }
        })
        canvas.addEventListener('mouseup',e=>{
            if(canvasInfo.status === statusConfig.DRAGGING){
                canvasInfo.status = statusConfig.IDLE
            }
        })
    </script>
</body>
</html>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末劣纲,一起剝皮案震驚了整個(gè)濱河市逢捺,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌癞季,老刑警劉巖劫瞳,帶你破解...
    沈念sama閱讀 216,496評(píng)論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異绷柒,居然都是意外死亡志于,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,407評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門(mén)废睦,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)伺绽,“玉大人,你說(shuō)我怎么就攤上這事嗜湃∧斡Γ” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 162,632評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵购披,是天一觀的道長(zhǎng)钥组。 經(jīng)常有香客問(wèn)我,道長(zhǎng)今瀑,這世上最難降的妖魔是什么程梦? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,180評(píng)論 1 292
  • 正文 為了忘掉前任点把,我火速辦了婚禮,結(jié)果婚禮上屿附,老公的妹妹穿的比我還像新娘郎逃。我一直安慰自己,他們只是感情好挺份,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,198評(píng)論 6 388
  • 文/花漫 我一把揭開(kāi)白布褒翰。 她就那樣靜靜地躺著,像睡著了一般匀泊。 火紅的嫁衣襯著肌膚如雪优训。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 51,165評(píng)論 1 299
  • 那天各聘,我揣著相機(jī)與錄音揣非,去河邊找鬼。 笑死躲因,一個(gè)胖子當(dāng)著我的面吹牛早敬,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播大脉,決...
    沈念sama閱讀 40,052評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼搞监,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了镰矿?” 一聲冷哼從身側(cè)響起琐驴,我...
    開(kāi)封第一講書(shū)人閱讀 38,910評(píng)論 0 274
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎秤标,沒(méi)想到半個(gè)月后绝淡,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體箕戳,經(jīng)...
    沈念sama閱讀 45,324評(píng)論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,542評(píng)論 2 332
  • 正文 我和宋清朗相戀三年动漾,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了妻柒。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,711評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡剔难,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情屈嗤,我是刑警寧澤,帶...
    沈念sama閱讀 35,424評(píng)論 5 343
  • 正文 年R本政府宣布吊输,位于F島的核電站饶号,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏季蚂。R本人自食惡果不足惜茫船,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,017評(píng)論 3 326
  • 文/蒙蒙 一琅束、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧算谈,春花似錦涩禀、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,668評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至高每,卻和暖如春屿岂,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背鲸匿。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 32,823評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工爷怀, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人晒骇。 一個(gè)月前我還...
    沈念sama閱讀 47,722評(píng)論 2 368
  • 正文 我出身青樓霉撵,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親洪囤。 傳聞我的和親對(duì)象是個(gè)殘疾皇子徒坡,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,611評(píng)論 2 353

推薦閱讀更多精彩內(nèi)容

  • canvas 是HTML5中新增的一個(gè)標(biāo)簽(video),繪制操作通過(guò)Javascript完成瘤缩。Svg 矢量圖符合...
    LorenaLu閱讀 766評(píng)論 0 0
  • 標(biāo)簽:canvas 簡(jiǎn)單示例 入門(mén)知識(shí)作者: 張耀國(guó) ( IgorZhang )E-mail: igorzhang...
    IgorZhang閱讀 2,777評(píng)論 4 7
  • 一喇完、初識(shí)canvas canvas畫(huà)布默認(rèn)寬高是 300 * 150 px canvas寬高要使用canvas標(biāo)簽...
    福爾摩雞閱讀 441評(píng)論 0 0
  • js 不建議用css控制canvas寬高,會(huì)等比縮放剥啤。852 CanvasRenderingContext2D.f...
    zjh111閱讀 246評(píng)論 0 0
  • canvas 最早由Apple引入WebKit,用于Mac OS X 的 Dashboard,后來(lái)又在Safari...
    Berkelium閱讀 279評(píng)論 0 0