Friday, September 14, 2018

ANIMATION IN JAVASCRIPT


GLSW4E BOOKS FACEBOOK  W4E INSTAGRAM W4E YOUTUBEW4E HOME
FOLLOW US

How to create simple animation in JavaScript

The simple JavaScript code below, create a beautiful line and round animation on the screen.

To learn more on how to install, setup, and prepare the environment to  writing and testing JavaScript codes, Go to this page. You can also find other  examples on that page.

Note, this program was written in P5 JavaScript editor. To learn how to write without  the P5 editor, please Go to this page.  


//Simple dot and line animation:
function setup (){
 createCanvas(600, 600);
}

function draw(){
background(0, 255, 0);

strokeWeight(3)
ellipse(100, 150, random(200), random(200));

strokeWeight(8);
line(random(width), random(height), 500, 100);
}

No comments:

Post a Comment

MORE JAVASCRIPT ARTICLES FROM GLS BELOW