Rose curve animation

Developer
Size
2,083 Kb
Views
14,168

How do I make an rose curve animation?

What is a rose curve animation? How do you make a rose curve animation? This script and codes were developed by Takashi on 20 October 2022, Thursday.

Rose curve animation Previews

Rose curve animation - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>rose curve animation</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.21/p5.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Rose curve animation - Script Codes CSS Codes

body {padding: 0; margin: 0;} 

Rose curve animation - Script Codes JS Codes

var pSize = 6;
var maxAngle = 0;
var g_freq = 0;
var g_col_h = 0;
var g_col_i = 0;
var freq_increase = true;
var col_increase = true;
var radius = 0;
function setup(){ createCanvas(windowWidth, windowHeight); background(0); blendMode(ADD); colorMode(HSB); init();
}
function draw(){ clear(); background(0); translate(windowWidth/2, windowHeight/2); noStroke(); if(freq_increase){ g_freq += 0.01; }else{ g_freq -= 0.01; } if(g_freq>1000){ g_freq = 1000; freq_increase = false; }else if(g_freq<0){ g_freq = 0; freq_increase = true; } rose_curve();
}
function windowResized() { resizeCanvas(windowWidth, windowHeight); init();
}
/*
カスタム関数
-------------------------------*/
function rose_curve(){ var maxAngle = 360; for(var i=0; i<maxAngle; i+=1){ var a = sin(radians(i*5)); var r = a * radius; var x = cos(radians(i*g_freq)) * r; var y = sin(radians(i*g_freq)) * r; //g_col_h = g_col_h%360; //g_col_h = map(i,0,maxAngle,0,360); //g_col_h = map(a,-1,1,0,360); if(col_increase){ g_col_i += 0.003; }else{ g_col_i -= 0.003; } if(g_col_i>360){ col_increase = false; g_col_i = 360; }else if(g_col_i<0){ col_increase = true; g_col_i = 0; } g_col_h = map(a,-1,1,0,g_col_i); fill(g_col_h,100,100,1); ellipse(x,y,pSize,pSize); }
}
function init(){ if(windowWidth>windowHeight){ radius = windowHeight * 0.4; }else{ radius = windowWidth * 0.4; }
}
Rose curve animation - Script Codes
Rose curve animation - Script Codes
Home Page Home
Developer Takashi
Username tksiiii
Uploaded October 20, 2022
Rating 3
Size 2,083 Kb
Views 14,168
Do you need developer help for Rose curve animation?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Takashi (tksiiii) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!