zoukankan      html  css  js  c++  java
  • 专门记录不常用,容易遗忘的帖子

    角度=弧度*180.0f/PI

    弧度=角度*PI/180.0f

    //js 操作数组插入元素到某个位置

    var arr=["a","b","c","d"]
    arr.splice(2,0,"ww");//2 表示 第三位; 0 表示 删除第三位后的0位, 同时在第三位插入 "ww"
    alert(arr)

    //多行文字 垂直居中

    <div class="outer">
      <div class="middle">
        把你要居中的文本放在这里
        这是第二行
      </div>
    </div>

    threejs 使用已有的canvas

    var renderer = new THREE.WebGLRenderer(
    {
    canvas: document.getElementById("canv")
    });
    //renderer.setSize( window.innerWidth, window.innerHeight );

    //求灰度

    var ascii = document.getElementById("ascii");
    for(var i = 0; i < colordata.length; i = i+4)
    {
    r = colordata[i];
    g = colordata[i+1];
    b = colordata[i+2];
    //converting the pixel into grayscale
    gray = r*0.2126 + g*0.7152 + b*0.0722;
    //overwriting the colordata array with grayscale values
    //colordata[i] = colordata[i+1] = colordata[i+2] = gray;

    //text for ascii art.
    //blackish = dense characters like "W", "@"
    //whitish = light characters like "`", "."
    if(gray > 250) character = " "; //almost white
    else if(gray > 230) character = "`";
    else if(gray > 200) character = ":";
    else if(gray > 175) character = "*";
    else if(gray > 150) character = "+";
    else if(gray > 125) character = "#";
    else if(gray > 50) character = "W";
    else character = "@"; //almost black

    //newlines and injection into dom
    if(i != 0 && (i/4)%W == 0) //if the pointer reaches end of pixel-line
    {
    ascii.appendChild(document.createTextNod

  • 相关阅读:
    站立会议(2)
    站立会议(1)
    学习进度条
    四则运算2
    学习进度条
    IDEA用maven创建springMVC项目和配置
    Itellij Idea全局搜索
    Spring各个jar包作用
    IDEA一定要改的八条配置
    Nio使用Selector客户端与服务器的通信
  • 原文地址:https://www.cnblogs.com/luoeeyang/p/4513146.html
Copyright © 2011-2022 走看看