scaling down in steps

31 views
Skip to first unread message

Outpost 31

unread,
Aug 19, 2017, 2:06:38 AM8/19/17
to CoSpaces Scripting
hi I can scale the block up in steps when I click on it but it auto shrinks when it hits 5 counts.  I want it to scale down when it is clicked, in steps, just like how it scales up. thnx for any help

Screen Shot 2017-08-18 at 11.06.22 PM.png

Daniel Pers

unread,
Aug 19, 2017, 8:37:00 AM8/19/17
to CoSpaces Scripting
Hi, 
If you scale up by N, dimensions are multiplicated by N.
You can scale down with 1/N and not -N.

Daniel Pers (LP2I, France)

Outpost 31

unread,
Aug 19, 2017, 10:01:35 AM8/19/17
to CoSpaces Scripting
Thanks that did it!

Outpost 31

unread,
Aug 19, 2017, 10:32:43 AM8/19/17
to CoSpaces Scripting
How would you do the same thing with width or length? You cannot drag the x,y,z block into the scale option?

Daniel Pers

unread,
Aug 20, 2017, 9:12:07 AM8/20/17
to CoSpaces Scripting
Hi,

Here is an exemple with .setSize() method :

See scene 2 for a basic example.



To see the code of scene 1:
https://edu.cospaces.io/#Login
Username: lp2i_guest
Password: lp2i2017

Outpost 31

unread,
Aug 20, 2017, 5:13:24 PM8/20/17
to CoSpaces Scripting
Thanks so much, that worked well, I can make my length larger until 5 then smaller until 10 but then I cannot change the length again.  Is there a way to have this sequence run infinitely so the user can scale up or down 5 times forever?
Screen Shot 2017-08-20 at 2.12.30 PM.png

Sean Naughton

unread,
Aug 22, 2017, 11:27:19 AM8/22/17
to CoSpaces Scripting
Hey Outpost!



You can achieve a up and down forever effect a couple ways. You are adding 1 to Bar1State every time the button is pressed, so once it hits 10, it keeps going and doesn't trigger the if or else if for resizing. You'll need to set it back to 0 once it is out of range so it goes through the resizing again.

Add this block into your else inside the on activate of button block and you should be good to go.



- Sean


Outpost 31

unread,
Aug 22, 2017, 4:36:56 PM8/22/17
to CoSpaces Scripting
thnx for the help!
Reply all
Reply to author
Forward
0 new messages