欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

难以言喻的情绪和线条

程序员文章站 2022-03-22 10:01:04
难以言喻的情绪&线条在上上篇博客的基础上,将测试中难以体现的情绪带入到了线条中。一起来康康!好奇、焦虑&赛博朋克(科技高度发达的世界中的混乱与秩序,上传限制,高糊画质)function setup() { createCanvas(400, 400);}function draw() { background(220); let T=millis(); DArc0417(15,40,T);}function DArc0417(R,A,T)//半径...

难以言喻的情绪&线条

在上上篇博客的基础上,将测试中难以体现的情绪带入到了线条中。一起来康康!

  • 好奇、焦虑&赛博朋克(科技高度发达的世界中的混乱与秩序,上传限制,高糊画质)
    难以言喻的情绪和线条
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  
  let T=millis();
  DArc0417(15,40,T);
}

function DArc0417(R,A,T)//半径R,圈数N,时间T
{

  for(var i=A;i>0;i--)
    {
      fill(10+255*sin(T/(80*i)),10+255*sin(T/(75*i)),
            10+255*sin(T/(150*i)));
      arc(200, 200,i*R,i*R,i*PI*(0.5+0.5*sin(T/5000)),(i+1)*PI,PIE) 
    }

}
  • 娱乐
    难以言喻的情绪和线条
    在上一次的基础上增加了运动轨迹,代码就不放了
  • 厌倦&困惑 (反正我是看久了会困)
    -其中应用了黄金分割比
    难以言喻的情绪和线条
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(255*abs(sin(millis()/4000)),255*abs(sin(millis()/4000*0.618)),255*abs(sin(millis()/4000*0.618^2)));
  translate(200,200);
  rotate(millis()/500);
  for(var i=1;i<=20;i*=1.618^2)
  {
    dr(i*20,millis()/i);
  }
  
}

function dr(size,t)
{
   for(var j=1;j<=10;j++)
    {
        SixAngleStar0424(size*abs(sin(t/2000)),size*abs(cos(t/2000)),10+10*(sin(t/1000)+cos(t/1000)),15,255)
    }
 
}
function triangle0424(x,y,size,C)//正三角形,位置,半径,灰度
{
  fill(C);
  triangle(x,y-size,x+size*cos(PI/6),y+size/2,x-size*cos(PI/6),y+size/2);
}

function SixAngleStar0424(x,y,size,N,C)
{
  for(var i=1;i<=N;i++)
    {
      rotate(2*PI/N);
      triangle0424(x,y,size,C*((N-i)/N)); 
    }

}

  • 痛苦&仇恨

难以言喻的情绪和线条
痛苦与恐惧
难以言喻的情绪和线条

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  translate(200,200);
  T=millis();
  rotate(1);
  fill(T/10%255,20,T/20%255)
  for(var i=1;i<=50;i++)
    {
      rotate(2*PI/50)
    arclinepluse0424(0,0,100+200*abs((sin(T/2000))),100+200*abs((sin(T/2000))),40*abs(sin(T/1000)));
    }
 
}

function arcline0424(x1,y1,x2,y2,D)
{
  bezier(x1,y1,x1+(x2-x1)/3+D/2-random(D),y1+(y2-y1)/3+D/2-random(D),x1+2*(x2-x1)/3+D/2-random(D),y1+2*(y2-y1)/3+D/2-random(D),x2,y2);
  
}
function arclinepluse0424(x1,y1,x2,y2,D)
{
  x3=x1+(x2-x1)/3+D/2-random(D);y3=y1+(y2-y1)/3+D/2-random(D);
  x4=x1+(x2-x1)/3*2+D/2-random(D);y4=y1+(y2-y1)/3*2+D/2-random(D);
  arcline0424(x1,y1,x3,y3,D);
  arcline0424(x3,y3,x4,y4,D);
   arcline0424(x4,y4,x2,y2,D);
}
  • 贪婪&欲望(画笔工具)
  • 通过键盘上下左右来控制画笔大小和波动程度按住mouse1来绘画难以言喻的情绪和线条
function setup() {
  createCanvas(400, 400);
  size=50;
  Distance=40;
}

function draw() {
  //background(220);
 // fill(255);
  //square(0,0, size*2); 
  T=millis();
  
  fill(T/10%255,20,T/20%255)

  translate(mouseX,mouseY);
  rotate(1);
  
 if (mouseIsPressed) {
    if (mouseButton === LEFT) {
      for(var i=1;i<=50;i++)
    {
    rotate(2*PI/50)
    arclinepluse0424(0,0,size,size,Distance*abs(sin(T/1000)));
    }
    }
}
}
function keyPressed() {
  if (keyCode === UP_ARROW) {
    size=size+10;
  } 
  else if (keyCode === DOWN_ARROW) {
    size=size-10;
  }
  else if(keyCode === RIGHT_ARROW)
    {
      Distance+=10;
    }
  else if(keyCode === LEFT_ARROW)
    {
      Distance-=10;
    }
  if(size<=10)
    {
      size=10;
    }
  if(Distance<=10)
    {
      Distance=10;
    }
  else if(keyCode === DELETE)
    {
      background(255);
    }
  return false; // prevent default
}

function arcline0424(x1,y1,x2,y2,D)
{
  bezier(x1,y1,x1+(x2-x1)/3+D/2-random(D),y1+(y2-y1)/3+D/2-random(D),x1+2*(x2-x1)/3+D/2-random(D),y1+2*(y2-y1)/3+D/2-random(D),x2,y2);
  
}
function arclinepluse0424(x1,y1,x2,y2,D)
{
  x3=x1+(x2-x1)/3+D/2-random(D);y3=y1+(y2-y1)/3+D/2-random(D);
  x4=x1+(x2-x1)/3*2+D/2-random(D);y4=y1+(y2-y1)/3*2+D/2-random(D);
  arcline0424(x1,y1,x3,y3,D);
  arcline0424(x3,y3,x4,y4,D);
   arcline0424(x4,y4,x2,y2,D);
}
  • 安静&秩序
    难以言喻的情绪和线条
function setup() {
  createCanvas(400, 400);
}


function draw() {
  background(200,200,0);
  let T=millis();
  for(var x=0;x<=400;x+=50)
    {
      for(var y=0;y<=400;y+=50)
    {
       circle0417(x,y,20+20*abs(sin(T/4000)),2+6*abs(sin(T/4000)),T)
    }
    }
  
 
}
function circle0417(x,y,size,N,T)//位置、尺寸、角度、数目
{
  for(var i=0;i<=N;i++)
    {
      fill(25+abs(sin(T/1000))*255*i/N);
      circle(x+size*sin(2*i*PI/N),y+size*cos(2*i*PI/N),
             size/2)
    }
}
  • 扭曲、嫉妒 四重柏林噪声+随机
    难以言喻的情绪和线条
function setup() {
  createCanvas(400, 400);
  noiseScale=0.02; 
 
}

function draw() {
  background(25);
  var T=millis()/10;
  noiseLinePluse0424(200,300,200,T)
  
}

function noiseLine0424(x1,y1,x2,y2,t)
{
   for (let x=x1; x <x1+ abs(x2-x1); x++) {
    let noiseVal = noise((x+t)*noiseScale, (t)*noiseScale);
     
  stroke(125+130*abs(sin(t/1000)),noiseVal*150,noiseVal*50); 
    line(x, y1+noiseVal*(y2-y1)+random(10), x, y2-(y2-y1)/4*noiseVal);
     
      stroke(125,(1-noiseVal)*50,(1-noiseVal)*250); 
    line(x, y1+noiseVal*(y2-y1)+random(10), x, y1+(y2-y1)/4*noiseVal);
  }
}

function noiseLinePluse0424(x,y,size,t)
{
  noiseLine0424(x-size,y-size,x+size,y,t-1000);
  
 // noiseLine0424(x-size,y,x+size,y+size,t-250);
}

本文地址:https://blog.csdn.net/h_ush_/article/details/111097581