Need help with an assignment!

I am supposed to create a rectangle using three line() commands. All fine and dandy. One requirement is to create a variable sclaing which could be used to up- or downscale the triangle. I am using:

size(900, 800);

background(85, 85, 85);

stroke(255, 0, 0);

float scaling = 1;

line(scaling * 150, scaling * 200, scaling * 200, scaling * 250);

line(scaling + 150, scaling * 200, scaling * 100, scaling * 300);

line(scaling * 100, scaling * 300, scaling * 200, scaling * 250);

When I set scaling = 1 all works fine. But as soon as I change it up to 2 it destroys the triangle and I can't wrap my head around why. Some outside perspective is appriciated and maybe some hints at how to do it better.

submitted by /u/Keyest
[link] [comments]

Expanding and Shrinking spheres using sin(), cos(), map()

Edit: Title should say "circles", not spheres

So, I'm trying to figure out how to make a set of 3 "breathing circles", meaning that each is supposed to increase/decrease in it's own time and incorporating sin() and cos(), such that a "breathing"motion is achieved.

Unfortunately I'm completely lost and the closest thing I've gotten is a version that uses x+=speed2;

sine = (sin(radians(x)))*(maxNumber),

& I'm not sure how to get it to work with the actual ellipses,

I'm not sure how to incorporate these trig functions in a way that works with the ellipses and allows them to expand and shrink, & even any basic info on how to incorporate sin() and cos() with the increasing circle size would be useful.

Any help would be appreciated!

submitted by /u/throwaway-question-1
[link] [comments]

Expanding and Shrinking spheres using sin(), cos(), map()

Edit: Title should say "circles", not spheres

So, I'm trying to figure out how to make a set of 3 "breathing circles", meaning that each is supposed to increase/decrease in it's own time and incorporating sin() and cos(), such that a "breathing"motion is achieved.

Unfortunately I'm completely lost and the closest thing I've gotten is a version that uses x+=speed2;

sine = (sin(radians(x)))*(maxNumber),

& I'm not sure how to get it to work with the actual ellipses,

I'm not sure how to incorporate these trig functions in a way that works with the ellipses and allows them to expand and shrink, & even any basic info on how to incorporate sin() and cos() with the increasing circle size would be useful.

Any help would be appreciated!

submitted by /u/throwaway-question-1
[link] [comments]

Need help with stuff

Okay, so I'm trying to solve a certain problem:

I've got a 300x300 window, and I'm trying to write a program in which A line is drawn everytime you click your mouse1, with starting point on 0,0 and ending point on your mouse coordinates.

How do I make it so after that first line, the starting points of the following lines would be the coordinates of the point where I clicked my mouse the previous time?

submitted by /u/fortificat
[link] [comments]