personLvl 62
Im new to this forum but i figured i might give it a try. So how do you rotate text?
Im new to this forum but i figured i might give it a try. So how do you rotate text?
hmm this is a bit of a tough one especially if your new to this i mean technically i could give you a rundown on how it works
/* drawing context is based off of alignment in which we need to do certain things we normally wouldn't*/
push(); // extends the drawing context so any adjustments made here will be forgotten
translate(200,200) // is the actual offset of the text on the screen otherwise it'll be rotated
rotate(-20); // how many degrees you want the text off by
textSize(80);
textAlign(CENTER,CENTER) // IMPORTANT this ensures that the position of text stays relative to the offset
fill("black")
text("hello",0,0);
pop(); // end of drawing context
// Here's a demo showcasing what you can do course there is a bunch of other stuff but i think this is what you want
setInterval(function(){
background("white")
push();
translate(200, 200)
rotate(random(0,360));
textSize(80);
textAlign(CENTER, CENTER)
fill("black")
text("hello", 0, 0);
pop();
},300)
Also if your wondering if this is in code.orgs documentation it is most certainly not mostly because it's probably something like this i still think it's cool to get the hang of
oh wow...
Thanks. 😃
Varrience
remember because its code.org and because code.org is weird it's setTimeout.
also i think it's regularly pushMatrix() and not just push()?
ackvonhuelio Actually setInterval works i think both implementations also work as well but since they both basically do the same thing i just go with push, if i do ever use pushMatrix i'll probably use it for 3d because it sounds like that would more likely be it's use case