sister maria Monahan Posted on Mar 2 moving triangles #codepen Liquid syntax error: Unknown tag 'cod' Top comments (3) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Collapse Expand sister maria Monahan sister maria Monahan sister maria Monahan Follow I enjoying programming as a hobby Joined Oct 27, 2024 • Mar 2 Dropdown menu Copy link Hide <!DOCTYPE html> The flower moves var nums=[100,25,46,72,88,120,150,180,190,37,200,130,140,22,240,260,280,300,320,33,340,360,380,385]; var x=5; var isAnimating=false;//keep track of animation state function setup() { createCanvas(400, 400); noLoop();//start with no animation } function draw(){ background(22,30,100); for(var i=0;i< 24;i++){ stroke(255); //noFill(); //ellipse(x+100,200,nums[i],nums[i]); //square(x+10,105,nums[i]); triangle(x+30,nums[i],nums[i],nums[i],nums[i],nums[i]); triangle(x+30,75,60,20,86,75); //fill(100,0,200); triangle(x+100,380,nums[i],nums[i],nums[i],nums[i]); x+=0.1; if(x>width){ x=-80; } Enter fullscreen mode Exit fullscreen mode } } function mousePressed(){ if(isAnimating){ noLoop();//stop animation }else{ loop();//start animation } } Click on mouse Collapse Expand sister maria Monahan sister maria Monahan sister maria Monahan Follow I enjoying programming as a hobby Joined Oct 27, 2024 • Mar 2 Dropdown menu Copy link Hide codepen.io/srmaria/pen/VYwpZwZ Collapse Expand sister maria Monahan sister maria Monahan sister maria Monahan Follow I enjoying programming as a hobby Joined Oct 27, 2024 • Mar 2 Dropdown menu Copy link Hide codepen.io/srmaria/pen/VYwpZwZ Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
<!DOCTYPE html>
The flower moves
var nums=[100,25,46,72,88,120,150,180,190,37,200,130,140,22,240,260,280,300,320,33,340,360,380,385];
var x=5;
var isAnimating=false;//keep track of animation state
function setup() {
createCanvas(400, 400);
noLoop();//start with no animation
}
function draw(){
background(22,30,100);
for(var i=0;i< 24;i++){
stroke(255);
//noFill();
//ellipse(x+100,200,nums[i],nums[i]);
//square(x+10,105,nums[i]);
triangle(x+30,nums[i],nums[i],nums[i],nums[i],nums[i]);
triangle(x+30,75,60,20,86,75);
//fill(100,0,200);
triangle(x+100,380,nums[i],nums[i],nums[i],nums[i]);
}
}
function mousePressed(){
if(isAnimating){
noLoop();//stop animation
}else{
loop();//start animation
}
}
Click on mouse
codepen.io/srmaria/pen/VYwpZwZ
codepen.io/srmaria/pen/VYwpZwZ