Draw Dollar effect

The dollar sign was created by my online Pixel Art editor. It is not a picture. It is a code suitable for P5 (processing 5) GUI.

This example has been created to show the way of creating graphics inside a web application, using only code and no graphic files.

The first 8-bit games were created in the times when there were no graphic editors. It is not impossible to do the same now.

I used a cycle "for" to place multiple signs in the window, and the math function Cosine to produce scale in and out effect in this example. Some functions are used only with the p5js library. 





Here is the code for P5JS Editor. Be free to copy and paste and use in your own P5JS application.

// The Code :  

let stepX;

let stepY;

let sW=80;

function setup() {

  createCanvas(400, 400);  

  stepX=round(width/sW);

  stepY=round(height/sW);

}


function draw() {

  background(220);  

  for (var i2=0;i2<stepY;i2++){

  let y=sW*i2+sW/2;

  for (var i=0;i<stepX;i++){

  let x=sW*i+sW/2; 

  push();

  translate(x,y);

  let sc=cos(millis()/1500)*1;

  scale(sc,sc);

  rotate(millis()/500);

  noStroke();

  tint(0);

  draw_dlrSimb(-74,-30);

  pop();

  }

  }

  /*  stroke(255,0,0);

  line(0,height/2,width,height/2);

  line(width/2,0,width/2,height);

  */

}

// This is a compressed function that creates a dollar sign for the example

function draw_dlrSimb( dlrSimb_X, dlrSimb_Y   ){fill(0,0,0);rect(72+dlrSimb_X,8+dlrSimb_Y,5,5);fill(0,0,0);rect(68+dlrSimb_X,12+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,12+dlrSimb_Y,5,5);fill(0,0,0);rect(76+dlrSimb_X,12+dlrSimb_Y,5,5);fill(0,0,0);rect(64+dlrSimb_X,16+dlrSimb_Y,5,5);fill(132,203,254);rect(68+dlrSimb_X,16+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,16+dlrSimb_Y,5,5);fill(132,203,254);rect(76+dlrSimb_X,16+dlrSimb_Y,5,5);fill(0,0,0);rect(80+dlrSimb_X,16+dlrSimb_Y,5,5);fill(0,0,0);rect(60+dlrSimb_X,20+dlrSimb_Y,5,5);fill(132,203,254);rect(64+dlrSimb_X,20+dlrSimb_Y,5,5);fill(0,0,0);rect(68+dlrSimb_X,20+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,20+dlrSimb_Y,5,5);fill(0,0,0);rect(76+dlrSimb_X,20+dlrSimb_Y,5,5);fill(132,203,254);rect(80+dlrSimb_X,20+dlrSimb_Y,5,5);fill(0,0,0);rect(84+dlrSimb_X,20+dlrSimb_Y,5,5);fill(0,0,0);rect(60+dlrSimb_X,24+dlrSimb_Y,5,5);fill(132,203,254);rect(64+dlrSimb_X,24+dlrSimb_Y,5,5);fill(0,0,0);rect(68+dlrSimb_X,24+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,24+dlrSimb_Y,5,5);fill(0,0,0);rect(76+dlrSimb_X,24+dlrSimb_Y,5,5);fill(0,0,0);rect(80+dlrSimb_X,24+dlrSimb_Y,5,5);fill(0,0,0);rect(84+dlrSimb_X,24+dlrSimb_Y,5,5);fill(0,0,0);rect(64+dlrSimb_X,28+dlrSimb_Y,5,5);fill(132,203,254);rect(68+dlrSimb_X,28+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,28+dlrSimb_Y,5,5);fill(132,203,254);rect(76+dlrSimb_X,28+dlrSimb_Y,5,5);fill(0,0,0);rect(80+dlrSimb_X,28+dlrSimb_Y,5,5);fill(0,0,0);rect(60+dlrSimb_X,32+dlrSimb_Y,5,5);fill(0,0,0);rect(64+dlrSimb_X,32+dlrSimb_Y,5,5);fill(0,0,0);rect(68+dlrSimb_X,32+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,32+dlrSimb_Y,5,5);fill(0,0,0);rect(76+dlrSimb_X,32+dlrSimb_Y,5,5);fill(132,203,254);rect(80+dlrSimb_X,32+dlrSimb_Y,5,5);fill(0,0,0);rect(84+dlrSimb_X,32+dlrSimb_Y,5,5);fill(0,0,0);rect(60+dlrSimb_X,36+dlrSimb_Y,5,5);fill(132,203,254);rect(64+dlrSimb_X,36+dlrSimb_Y,5,5);fill(0,0,0);rect(68+dlrSimb_X,36+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,36+dlrSimb_Y,5,5);fill(0,0,0);rect(76+dlrSimb_X,36+dlrSimb_Y,5,5);fill(132,203,254);rect(80+dlrSimb_X,36+dlrSimb_Y,5,5);fill(0,0,0);rect(84+dlrSimb_X,36+dlrSimb_Y,5,5);fill(0,0,0);rect(64+dlrSimb_X,40+dlrSimb_Y,5,5);fill(132,203,254);rect(68+dlrSimb_X,40+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,40+dlrSimb_Y,5,5);fill(132,203,254);rect(76+dlrSimb_X,40+dlrSimb_Y,5,5);fill(0,0,0);rect(80+dlrSimb_X,40+dlrSimb_Y,5,5);fill(0,0,0);rect(68+dlrSimb_X,44+dlrSimb_Y,5,5);fill(132,203,254);rect(72+dlrSimb_X,44+dlrSimb_Y,5,5);fill(0,0,0);rect(76+dlrSimb_X,44+dlrSimb_Y,5,5);fill(0,0,0);rect(72+dlrSimb_X,48+dlrSimb_Y,5,5);} 


Here it is -> https://editor.p5js.org/kirzh2020/present/teOYbQIXc

Comments

Popular posts from this blog

Connecting Wemos (ESP8266) to MB 4 Bot

About Game "8 Planes"

Connecting to the Open Web DB from Processing 3