Discuss Scratch

Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Hi all. A new challenge in the AMC series.

Modify the template project to allow the user to move, resize, stretch and rotate a rectangle by dragging the coloured dots that define it.
Template project: https://scratch.mit.edu/projects/132686716/
* I have updated the template project so that the dots are draggable.
You may add data variables and/or lists to represent the corner, side, centre and rotation dots. (The template is very basic).

User drags the Red centre dot to move the rectangle in any direction.
User drags a Blue corner dot to resize the whole rectangle in proportion (ie. all four corners move).
User drags a Green Dot to stretch just the selected side and the opposite side in proportion.
User drags Purple Dot to rotate the rectangle.

* The rotation makes the problem interesting as then resizing and stretching the rectangle is no longer trivial.

* Another difficulty is that when a dot is dragged, eg. a side dot, the user will not move it along a perfect line to the new position of the side dot.
You make your own rules/decisions about what happens to the dot positions as the mouse moves.

A timeframe: 2 weeks to Saturday 10th December.
* Let me know if the timeframe is too short.
Project must be in Scratch: No hacked blocks.

Judging Criteria in order of importance:
1. It works including when rectangle is rotated!
2. It is user friendly - easy to use.
3. Code is nicely commented and laid out, variable, list and block names are meaningful.
4. First project submitted relevant only if projects are similar according to the above criteria.

Projects should be mostly your own work.
But you can remix another entry, especially if it is incomplete in functionality or if you are adding substantially to the user interface to make it user friendly.

* I have made a studio for entries: https://scratch.mit.edu/studios/3592649/
.

Last edited by Scratch-Minion (Nov. 25, 2016 19:50:20)

jokebookservice1
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

First!

Also, is stretching when rotating just stretching when not rotating and then rotating after you have done evrything else?

Last edited by jokebookservice1 (Nov. 25, 2016 12:52:36)

IcyCoder
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

cool!
dzaima
Scratcher
100+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Can I change the template to use clones instead of a sprite for each dot?
chooper100
Scratcher
500+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Definitely interested in this!
Are there any restrictions on what blocks we can use?
-ScratchOs
Scratcher
71 posts

[AMC #4] Movable Stretchable Rotatable Rectangle

this sounds interesting!

EDIT: I have made a moveable, rotatable rectangle, now to make it resizable

Last edited by -ScratchOs (Nov. 25, 2016 18:15:18)

dzaima
Scratcher
100+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Question: for the corner dots should they, when moved, transform the rectangle on diagonals or on the distance from center? 1st would be where if the rectangle, non-rotated, would not change size if I'd move the mouse on diagonals and 2nd - circles. The latter makes more sense for me but want your opinion.
EDIT: for the sides, it should still be the 1st option (aka if the rect is at 0 degrees and you, holding the side node, move your mouse around the X/horizontal axis, nothing would change.)

Last edited by dzaima (Nov. 25, 2016 19:04:04)

dzaima
Scratcher
100+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

boom, done. Using the circle method for corners.
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Can the dot sprites be replaced with pen-drawn buttons?
Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

jokebookservice1 wrote:

First!

Also, is stretching when rotating just stretching when not rotating and then rotating after you have done evrything else?

Rotating and stretching are intended to be independent. ie. the rectangle cannot be stretched with the rotation dot, or rotated with the stretch dot.
.
Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

dzaima wrote:

Can I change the template to use clones instead of a sprite for each dot?
Yes

dzaima wrote:

Question: for the corner dots should they, when moved, transform the rectangle on diagonals or on the distance from center? 1st would be where if the rectangle, non-rotated, would not change size if I'd move the mouse on diagonals and 2nd - circles. The latter makes more sense for me but want your opinion.
EDIT: for the sides, it should still be the 1st option (aka if the rect is at 0 degrees and you, holding the side node, move your mouse around the X/horizontal axis, nothing would change.)

The corner dots when moved must stretch the rectangle along the diagonals so that the rectangle is not rotated.
You decide how far to stretch the rectangle depending on the dot or mouse position and I think using distance from centre to get a scale factor is a good idea. Thus I see the two ideas both being used and not mutually exclusive.
.
Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

chooper100 wrote:

Definitely interested in this!
Are there any restrictions on what blocks we can use?

No hacked blocks, otherwise no block restrictions.
.
Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Chibi-Matoran wrote:

Can the dot sprites be replaced with pen-drawn buttons?
Yes
.
Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Notes:

I have updated the template project so that the dots are draggable.

I have made a studio for entries: https://scratch.mit.edu/studios/3592649/

You do not have to use the dot sprites - if anyone wants to attempt the more usual interface for resizing rectangles with double headed arrows to stretch the sides and corners and the four headed arrow within the rectangle to move it you are welcome to do this.

If the time frame is too short, please let me know! (I am new to the Advanced Topics area).
.

Last edited by Scratch-Minion (Nov. 25, 2016 19:59:55)

Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

dzaima wrote:

boom, done. Using the circle method for corners.
Already!! Stunned!!
(I have put it in the studio I have now created).
.

Last edited by Scratch-Minion (Nov. 25, 2016 20:01:16)

CodeLegend
Scratcher
500+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

Aww, I was going to do this, but now that dzaima has a perfectly working program, it seems trivial…
jokebookservice1
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

CodeLegend wrote:

Aww, I was going to do this, but now that dzaima has a perfectly working program, it seems trivial…
That one isn't well commented though, somebody else can still beat it.
dzaima
Scratcher
100+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

just made a newer version of my project, supporting multiple rectangles and comments!
IcyCoder
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

dzaima wrote:

just made a newer version of my project, supporting multiple rectangles and comments!
Wow
Scratch-Minion
Scratcher
1000+ posts

[AMC #4] Movable Stretchable Rotatable Rectangle

dzaima wrote:

just made a newer version of my project, supporting multiple rectangles and comments!
Double Wow
.

Powered by DjangoBB