I’ve been playing with rotating and looping the keyboard vertical bar, however when trying to replicate that by using a regular line I’m struggling with what it would be the equivalent to the textSize() function (length of the character). I’ve tried creating a line by using x, y, radius, sin, cos, theta etc but the ‘radius’ variable does not play the part of the textSize().
Any ideas?
color c = color(250,130,0);
void setup() {
size(800,800,P2D);
}
void draw() {
background(255);
translate(width/2,height/2);
for(int i = 1; i < 20; i++) {
rotate(radians(20));
fill(c);
textSize(3.75*i); //what would be this if using a line?
text("|",0,0);
}
}
Sure! The idea is to create first a horizontal line positioned at the canvas’ center then rotate it from its center point and I guess later to increase it’s length as it rotates? kinda x1,y1 += 1 or something like that?
color c = color(250, 130, 0);
void setup() {
size(800, 800, P2D);
}
void draw() {
background(255);
float a=1;
for (int i = 1; i < 360/4; i++) {
pushMatrix();
translate(width/2, height/2);
rotate(radians(4*i));
fill(c);
// textSize(3.75*i); //what would be this if using a line?
translate(-a/2, 0);
// text("|", 0, 0);
line(0, 0, a, 0);
a+=3.75;
popMatrix();
}
}
Yes you’re right! Thanks for that… I’ve been many hours in front of the computer trying stuff and might need some fresh eyes tomorrow lol
That was similar to what I had tried before however there’s some sort of ‘drag’ produced when rotating the keyboard bar (as it grows in size) that I don’t get with the line… will keep trying!
Thanks @glv, yeah I’m kinda familiar with the Unit Circle functions and their relationships.
I’ll have a look tomorrow to the Character Movement example. Seems to need some proper time
The issue with my output is that on a 800x800px size looks good, but I wanted to print that out to test definition and need at least a 6000x6000px, at which resolution I’m unable to replicate that figure
I’ve tried to use the PGraphics solution mentioned here to stretch the sketch window but doesn’t work, that’s why trying with rotating a line that emulates the “|” bar.
Just for future reference, I’ve managed to get something similar by taking a different approach. The keyboard vertical bar can also be represented as a rectangle of w=1px and h=12px, which is the default font size. By rotating this you are in much more control of the parameters than using a keyboard symbol!
Thanks for the help!