“dandelion_09_Vampire” by scottiehuang
https://openprocessing.org/sketch/1561142
License CreativeCommons Attribution NonCommercial ShareAlike
https://creativecommons.org/licenses/by-nc-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
CC Attribution NonCommercial ShareAlike
dandelion_09_Vampire
xxxxxxxxxx
//let keyP = [21387,327,418,12440,536,8393,11905,105,2103,4727,80,100,611,129,74];//01
//let keyP = [25200,528,420,15000,2560,6964,9940,53,2857,4802,53,111,413,110,183];//02
//let keyP = [25500,482,401,14200,3800,2600,9700,116,4762,5000,95,128,611,111,190];//03
//let keyP = [16899,210,420,4881,2202,3631,11131,142,3294,4722,60,69,762,104,71];//04
//let keyP = [20440,480,412,11548,10893,12560,12500,72,3929,5000,52,83,508,102,151];//05
//let keyP = [25500,514,403,14412,11574,1964,13060,80,3602,5159,96,144,413,105,119];//06
//let keyP = [23780,270,407,11071,3214,11012,12262,145,2017,4738,100,142,778,100,40];//07
//let keyP = [25400,612,416,11786,2381,1964,15000,60,1825,5000,51,169,270,90,16];//08
let keyP = [23881,360,412,14167,14286,2976,12619,91,3200,5040,128,114,611,129,95];//09
//let keyP = [22768,402,420,9762,8393,4226,476,169,2024,4762,33,139,254,65,-32];//10
const hVal = keyP[0];//1
const posX= keyP[1];//2
const posY = keyP[2];//3
let value = [];
value[0] = keyP[3];//4
value[1] = keyP[4];//5
value[2] = keyP[5];//6
value[3] = keyP[6];//7
const transparance = keyP[7];//8
const sc_goal = keyP[8];//9
const longer = keyP[9];//10
const stroke_width = keyP[10];//11
const scale_p = keyP[11];//12
const petiole_weight_p = keyP[12];//13
const petiole_transparent_p = keyP[13];//14
const SpointY_p = keyP[14];//15
let parameter;
function setup() {
createCanvas(windowWidth, windowHeight);
//createCanvas(800, 800);
noLoop();
background(0);
}
function draw() {
sc_g();
hb_p = map(hVal/100,0,100, 0.96, 1.02);//hVal(input1), hb_p(local/output)
scale(scale_p/100);//scale_p(input12)
ro = (posX / 800) * 120;//ro(local/output), posX(input2)
count_r = degrees(radians(ro));//count_r(local/output)
rule = 1.45-((posY / 800) * 100)/130;//posY(input3), rule(local/output)
if(windowWidth>windowHeight){
translate(width/(scale_p/100)/2, (height/(scale_p/100)*5/10+SpointY_p*windowHeight/800));
scale(windowHeight/800);}
else{
translate(width/(scale_p/100)/2, (height/(scale_p/100)*5/10+SpointY_p*windowWidth/800));
scale(windowWidth/800);}
stroke(255, petiole_transparent_p);
strokeWeight(petiole_weight_p/1000);
line(0, 0, 0, height+width);
strokeWeight(1);
angle_branch(parameter, a, b, 0);
}
function angle_branch(branch_length, a, b, layer){
const layer_stroke = (transparance/255)*(140-layer*9);
layer = layer + 1;
stroke(255,layer_stroke);
strokeWeight((stroke_width/100)/(scale_p/100));//stroke_width(input11); scale_p(input12)
const b_x = b*cos(radians(value[0]/100));//value[0](input4)
const b_y = b*sin(radians(value[1]/100));//value[1](input5)
const degree_a = degrees(acos(((branch_length-a)/2)/b));//+longer/100
const target_x = branch_length*cos(radians(value[2]/100-degree_a));//value[2](input2)
const target_y = -branch_length*sin(radians(value[3]/100-degree_a));//value[3](input3)
var branch_length_vr = branch_length;
a = a*longer/50/100;//longer(input10)
b = b*longer/50/100;
branch_length_vr = branch_length * rule;
if (branch_length_vr<parameter*1.944) { //35
push();
rotate(radians(-count_r));
line(0, 0, a, 0);
line(0, 0, -b_x, -b_y);
translate(target_x, target_y);
line(0,0,-target_x, -target_y);
rotate(radians(2*degree_a-60));
line(0, 0, a, 0);
line(0, 0, -b_x, b_y);
angle_branch(branch_length_vr, a * hb_p, b * hb_p, layer);
pop();
push();
rotate(radians(count_r));
line(0, 0, -a, 0);
line(0, 0, b_x, -b_y);
translate(-target_x, target_y);
line(0,0,target_x, -target_y);
rotate(-radians(2*degree_a-60));
line(0, 0, -a, 0);
line(0, 0, b_x, b_y);
angle_branch(branch_length_vr, a * hb_p, b * hb_p, layer);
pop();
}
}
function sc_g(){//sc_goal(input9)
sc = map(sc_goal/100, 0,100, 0,4);
unit= 3 * sc;//unite size //3
a = 2.5 + 2 * unit;//short side
b = a / sin(radians(45));//long side
parameter=18 * sc;//parameter(local/output)
}
See More Shortcuts